Skip to content

fix: A transient Telegram startup failure permanently disables the bot - #971

Open
sam-saffron-jarvis wants to merge 1 commit into
SamSaffron:mainfrom
sam-saffron-jarvis:feat/codereview-e31e13a4
Open

fix: A transient Telegram startup failure permanently disables the bot#971
sam-saffron-jarvis wants to merge 1 commit into
SamSaffron:mainfrom
sam-saffron-jarvis:feat/codereview-e31e13a4

Conversation

@sam-saffron-jarvis

Copy link
Copy Markdown
Contributor

What changed

  • Supervise each non-web platform loop instead of invoking Platform.Run only once.
  • Retry unexpected returns with context-aware exponential backoff from 1 second to 30 seconds.
  • Reset the backoff after a platform has remained running for one minute.
  • Stop retrying immediately when the serve context is cancelled.
  • Add a focused fake-platform regression test covering a transient first-run failure, successful restart, and prompt cancellation without an extra retry.

Why this is high-value

Telegram is a daily Jarvis interface, while the web server and jobs can remain healthy if Telegram's startup getMe request hits a transient DNS, network, timeout, or API failure. Previously that one failure terminated the only Telegram goroutine, silently leaving the bot unavailable until the whole serve process was manually restarted. The supervisor lets Telegram recover automatically while preserving normal shutdown behavior and bounding retry frequency.

Validation

  • gofmt -w cmd/serve.go cmd/serve_platform_test.go
  • go build ./...
  • HOME=$(mktemp -d) XDG_CONFIG_HOME=$HOME/.config CODEX_HOME=$HOME/.codex go test ./...
  • go test ./cmd -run TestRunPlatformSupervisorRetriesAndStopsOnCancellation -count=100
  • git diff --check

The unisolated full test command also ran; two existing skill-catalog tests failed because the agent host's 30 user-global skills exhausted their configured visible-skill budgets. The same complete suite passes with an isolated HOME as shown above.

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.

1 participant