Skip to content

Announce provider failures to the active Telegram chat - #78

Merged
TerrifiedBug merged 3 commits into
TerrifiedBug:masterfrom
W1tcherr:failure-notices
Sep 19, 2026
Merged

TerrifiedBug merged 3 commits into
TerrifiedBug:masterfrom
W1tcherr:failure-notices

Conversation

@W1tcherr

@W1tcherr W1tcherr commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #77.

A Telegram-initiated run that fails at the provider (quota exhausted, 429, ...) died silently: the extension only forwarded assistant text, and a failed run has none.

This change narrates the failure lifecycle to every chat with a live Telegram turn (same routing as replies, plain text):

  • auto_retry_start — first retry announced once per run (error + attempt/max + backoff).
  • auto_retry_end — recovery confirmed; exhaustion announces the terminal failure with a /model + /sessions hint.
  • retry_fallback_applied — model fallback switch announced.
  • agent_end — terminal failure detected via the assistant message with stopReason "error" (covers failures with no retry cycle); skipped when willContinue (a continuation is scheduled, its own events narrate) and deduplicated against the retry-end notice.
  • explicit streaming mode opts out, like the idle notify; task subagents never announce.

Plus Outbound.activeTargets()/announce() (gated on live Telegram turns by construction), lastRunError() helper, wiring + unit tests (6 + 3 new), and a Notifications entry in docs/guide.md.

Checks: tsc --noEmit clean, bun test 324 pass / 2 pre-existing env failures (inbox, voice transcription — fail on clean HEAD on Windows too).

TerrifiedBug added 2 commits September 19, 2026 01:12
Keep chat and prompt-tool state until terminal settlement. Stop failure lookup at the current assistant result or user boundary, so healthy turns cannot announce historical errors. Require omp 18.1.16+ for the continuation lifecycle contract.
# Conflicts:
#	src/outbound.test.ts
@TerrifiedBug

Copy link
Copy Markdown
Owner

I pushed two fixes to this branch before merging:

  • Keep chat routing and Telegram prompt tools alive across agent_end { willContinue: true }. Only terminal settlement tears them down.
  • Stop error lookup at the latest assistant result or user boundary, so a healthy run cannot report an old failure.

The regressions failed on the original revision and pass now. They cover retry exhaustion, successful recovery and its answer in the original topic, prompt-tool preservation, and historical errors. I also integrated #80 and checked that failure notices stay plain text with rich output enabled.

The combined tree passes typechecking and all 380 tests on Bun 1.3.14. The documented minimum is now omp 18.1.16 because this relies on the continuation lifecycle contract.

@TerrifiedBug
TerrifiedBug merged commit b67cfd1 into TerrifiedBug:master Sep 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run failures (provider errors, e.g. quota exhausted / 429) are silently swallowed — nothing reaches the Telegram topic

2 participants