Skip to content

codex runtime: stop the Flair task loop on shutdown #781

Closed

Description

@tps-flint

Found while triaging a CI failure on #759 (Docker Integration, run 42243604181). The failure was in review-trigger-loop.test.ts, whose warnings contained [testbot] Task loop catch-up read unavailable (ConnectionRefused). Those warnings came from the task loop that codex-presence-444.test.ts starts for testbot, still polling in the same Bun process.

runCodexRuntime (packages/cli/src/utils/codex-runtime.ts ~831) starts the Flair task loop and keeps no stop handle. shutdownHandler (~702) stops only the heartbeat before the final beat and exit(0).

What the fix does:

  • The runtime keeps the task loop's stop handle. The SIGINT/SIGTERM shutdown handler stops the task loop together with the heartbeat, before the final Presence beat. The startup-failure path stops it too.
  • codex-presence-444.test.ts asserts that no catch-up request reaches its fake server after the shutdown handler ran, so no loop outlives the test.

Activity

  1. moved this to Triage in Office queueon Nov 6, 2026
  2. moved this from Triage to In review in Office queueon Nov 6, 2026
  3. self-assigned this
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions