Skip to content

Add a supervised worker recovery and revision example - #5503

Merged
markstuart-oai merged 38 commits into
feat/codex-harnessfrom
feat/supervised-worker-example
Nov 5, 2026
Merged

markstuart-oai merged 38 commits into
feat/codex-harnessfrom
feat/supervised-worker-example

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Review stack: #5504 (CI) > #5499 (turn controls) > #5500 (receipts) > #5501 (executor) > #5502 (recovery) > #5503 (example) > #5495 (docs) > #5509 (automatic compaction during cancellation). Combined reference: #5494.

Requirements · REQ733, REQ736, REQ737, REQ738, REQ779, REQ780, REQ781.

Summary

The application checks the effect journal's session ID, turn ID and result before it reports completion. A stale journal entry or missing effect keeps the worker out of the completed state.

Applications need a concrete way to supervise work across client disconnects and process failure. Add a two-process worker example using separate workspaces, native histories and application journals. Each worker uses Turn.steer_exact() for exact steering, denies unattended approvals, selects trusted MCP/instruction inputs and applies startup/turn deadlines with explicit cancellation cleanup.

Validate the structured claim against the complete expected artifact and native command evidence before acceptance. The verifier checks the command output byte for byte and reads one byte beyond the expected file length to catch trailing data. The worker records acceptance in its original journal directory only after its session and provider close successfully. A secondary close error preserves the original artifact read failure. Request revisions in the same conversation, reconnect a status client to existing records and reconcile a simulated effect after a crash with UncertainCall.reconcile(). Publication writes a separate local marker with a stable key. The application owns deployment, journals, acceptance and external publication policy.

The example records separate startup, follow-up, first-tool and completion intervals. These reference measurements do not establish comparative speed or acceptance by a production application. Managed model login/billing remain excluded under REQ731.

Layer 5 of 5; base feat/worker-reconciliation. Documentation/adoption is tracked separately under REQ753.

When a deadline or observer fails and cancellation also fails, the worker re-raises the original error with its cause and logs the cleanup error with its traceback.

The supervisor must keep each private job directory at the same canonical path while a worker, status reader, or publisher is using it. The example supports reconnecting to that existing directory. Archive or replace it after those operations finish.

Test plan

The combined PR's Windows 3.10 and 3.14 jobs both failed two artifact tests on the missing Unix flag O_NOFOLLOW. Those tests now run on the same Linux and macOS platforms supported by the local worker. The platform-independent worker tests still run on Windows.

The dual-failure regression reproduced on the previous worker and passed on Python 3.10 and 3.13. The ordinary caller-cancellation case also passed.

The integrated worker source passed 141 focused tests, with five platform-dependent cases skipped locally. Those tests include receipt, recovery, executor and worker behavior. Current hosted checks and independent review are running.

Six focused cases failed before the fix. The updated worker passed all 15 cases, including a directory symlink retargeted during shutdown, withheld acceptance during close, preservation of a prior accepted record, exact command output, and artifact read/close errors.

The complete two-worker scenario passed on a hosted Ubuntu runner in 10.73 seconds with its original deadline. It exercised acceptance, reconnect, effect recovery and publish-once using the updated worker source and a previously built official native wheel. Installed worker run

Issue number

None linked. Owning requirements database IDs are listed above.

Checks

  • I've added new tests, if relevant
  • I've run the applicable checks in AGENTS.md, including .agents/skills/code-change-verification/scripts/run.sh when required
  • I've confirmed all required checks pass
  • I've completed the review required by AGENTS.md

@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners November 4, 2026 04:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 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-11-05T02:23:12.001775Z dc279d7 New commits
🔒 Security Review ✅ Completed 2026-11-05T02:24:20.032523Z dc279d7 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.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at b2c6f2b. Reviewed the example and integration coverage against the reconciliation layer: isolated worker roots, exact steering, artifact and command verification, immutable publication records, cancellation cleanup, and application-confirmed recovery. No actionable findings. The full source tree matches the previously approved implementation at be0951f.

Static review only; no candidate code or tests run. Hosted lint/docs checks passed; Linux/macOS native CI remains running and Windows checks are skipped. Leave unmerged as requested.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at 114be08.

Reviewed the example update against its immediate base. Calls use steer_exact with the observed native ID and the reconciliation convenience method only after the existing application-record checks. No actionable findings in this layer; underlying executor blockers remain tracked on5501.

Static review only; no candidate code or tests run. Fresh hosted CI remains pending. Leave unmerged as requested.

@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: 114be08838

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread examples/supervised_worker/README.md Resolved
@markstuart-oai
markstuart-oai force-pushed the feat/worker-reconciliation branch from d2f6580 to 94defa9 Compare November 4, 2026 05:54
@markstuart-oai
markstuart-oai force-pushed the feat/supervised-worker-example branch from 114be08 to 5b32b3e Compare November 4, 2026 05:54
@markstuart-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 5b32b3ee13

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 5b32b3ee13

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The worker-layer changes are clean, but this stacked head inherits the confirmed recovery input-corruption issue in #5502 (comment). Please carry the upstream fix through this layer before merging. No additional inline finding.

Static review only; no candidate code or tests executed. Hosted CI: pending: native-linux / Native package (ubuntu-24.04), native-linux / Native package (ubuntu-24.04), native-macos / Native package (macos-latest), native-macos / Native package (macos-latest); no failed checks observed.

@markstuart-oai
markstuart-oai force-pushed the feat/worker-reconciliation branch from 94defa9 to 109e6e0 Compare November 4, 2026 06:07
@markstuart-oai
markstuart-oai force-pushed the feat/supervised-worker-example branch from 5b32b3e to 09656bc Compare November 4, 2026 06:07

@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: 09656bceac

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread examples/supervised_worker/__main__.py Resolved
Comment thread examples/supervised_worker/__main__.py Resolved

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The upstream custom-input recovery issue is fixed. Two existing worker findings remain valid: #5503 (comment) — return the verified journal result after recovery instead of arbitrary model narration; #5503 (comment) — subtract submission time before supervision so effect/recovery share one per-turn timeout budget, as work already does. No duplicate inline comments.

Static review only; no candidate code or tests executed. Hosted CI: pending: native-linux / Native package (ubuntu-24.04), native-linux / Native package (ubuntu-24.04), native-macos / Native package (macos-latest), native-macos / Native package (macos-latest); no failed checks observed.

@markstuart-oai
markstuart-oai force-pushed the feat/supervised-worker-example branch from 09656bc to 86d35e4 Compare November 4, 2026 06:15
@markstuart-oai
markstuart-oai force-pushed the feat/worker-reconciliation branch from 22e656e to deb5647 Compare November 4, 2026 21:08
@markstuart-oai
markstuart-oai force-pushed the feat/supervised-worker-example branch from bdffdba to 38cea47 Compare November 4, 2026 21:08

@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: 38cea47d38

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread examples/supervised_worker/__main__.py Resolved

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The shared physical write-root and storage protections are sound: filesystem identities cover alternate paths, checklist aliases and hard links are checked, and private runtime symlinks fail closed. Disjoint storage and write grants remain supported. Both prior worker findings are addressed: verification output is compared exactly, and Unix-only helper cases are guarded on Windows. Acceptance is persisted only after owned resource cleanup succeeds; directory identity is captured once and primary read failures survive cleanup failures. The executor startup fixture removes the parent-selected port race.

Coordinator and independent static reviews of actual old/new file contents found no actionable issue. Hosted CI on this new head remains pending; prior-head results do not qualify it. No candidate code or local tests executed.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved the supported-platform guard. The only incremental change restricts the prior-snapshot publication test to Linux/macOS, matching the example’s directory-fsync requirements and neighboring tests. This resolves the reported Windows PermissionError without removing supported-platform coverage. Coordinator and independent static review found no new issue. Current-head hosted checks: {'SUCCESS': 3, 'IN_PROGRESS': 2, 'SKIPPED': 2}. Native validation remains pending; the earlier Cargo fixture timeout is separate. No candidate code or local tests executed.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Static re-review: immutable-record publication now retries directory fsync after an identical existing record, so retry success follows durable directory publication. The regression covers two failed directory syncs followed by successful idempotent publication. Other feature changes remain unchanged. Coordinator and independent review found no actionable issues. Hosted CI remains pending; no candidate code or local tests executed.

Base automatically changed from feat/worker-reconciliation to feat/codex-harness November 5, 2026 03:16
@markstuart-oai
markstuart-oai merged commit 7d2ee17 into feat/codex-harness Nov 5, 2026
57 checks passed
@markstuart-oai
markstuart-oai deleted the feat/supervised-worker-example branch November 5, 2026 03:25
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.

3 participants