Skip to content

Harden Codex stop gate supervision - #662

Open
gon7187 wants to merge 25 commits into
openai:mainfrom
gon7187:codex/gate-supervision
Open

gon7187 wants to merge 25 commits into
openai:mainfrom
gon7187:codex/gate-supervision

Conversation

@gon7187

@gon7187 gon7187 commented Aug 19, 2026 •

Copy link
Copy Markdown

Detached Codex workers and concurrent Stop hooks could leave queued jobs, duplicate reviews or stale ALLOW decisions after cancellation, removal or a crash. This makes lifecycle outcomes authoritative and Stop reviews reusable only for the exact Claude response.

  • Publish queued jobs before spawning workers; serialize mutable state updates and reconcile dead workers.
  • Use immutable startup, admission, terminal and removal claims to prevent duplicate execution and resurrection. Publish JSON claims by linking a fully written temporary file, so readers never see partially written claims while the first writer still wins.
  • Recover dead, unindexed gate workers even when their mutable job file already exists; persist and index the failed outcome for subsequent Stop hooks and status commands.
  • Bound cancellation interrupts and stop workers in finally, including when job/state persistence fails. Resolve broker shutdown when initialization creates no transport.
  • Fence ended sessions before cleanup snapshots and preserve the generation across repeated starts of an active session. Recover locks and reap guards left by dead owners, with lifecycle deadlines below the hook timeout.

Validation: npm test passes all 158 tests, including crash recovery, admission/cancellation publication races, concurrent Stop hooks, broker stalls, persistence failures and session cleanup. npm run build, npm run check-version, syntax checks for the changed JavaScript files and git diff --check pass.

A zero-byte .removed tombstone remains for each retired job to fence paused late workers; mutable job files, logs and lifecycle sidecars are cleaned up.

@gon7187
gon7187 marked this pull request as ready for review August 27, 2026 08:30
@gon7187
gon7187 requested a review from a team August 27, 2026 08:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5379993feb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/lib/state.mjs
The SessionEnd hook and the state lock both had a 5 second deadline, so a
live, invalid, or unreapable lock could let the hook be killed before it
fenced tombstones or stopped the session's workers.

- fence and terminate session workers from a lock-free snapshot first, then
  prune state under a 1 second lock deadline
- give the broker shutdown request a 2 second socket timeout so a silent
  broker cannot hold the hook
- raise the SessionEnd hook timeout to 15 seconds and guard the margin with
  a test
- keep cleanup going past unreadable jobs or state instead of aborting

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lbfiwm6KGT2FVh1emKpBdM
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-10T12:17:01.174249Z 2e4f37e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e92ff66859

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/lib/tracked-jobs.mjs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e8961e7ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/lib/state.mjs
Comment thread plugins/codex/scripts/codex-companion.mjs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fe3c059de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/codex-companion.mjs Outdated
Comment thread plugins/codex/scripts/lib/app-server.mjs
Comment thread plugins/codex/scripts/session-lifecycle-hook.mjs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6175b52e7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/lib/state.mjs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e4f37e1ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/lib/tracked-jobs.mjs Outdated
Comment thread plugins/codex/scripts/lib/tracked-jobs.mjs Outdated
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