Skip to content

fix(codex): preserve protected scheduled continuations - #181528

Merged
RomneyDa merged 7 commits into
mainfrom
fix/codex-targeted-protected-continuations
Oct 27, 2026
Merged

RomneyDa merged 7 commits into
mainfrom
fix/codex-targeted-protected-continuations

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Problem

A same-session scheduled or internal continuation can arrive while its retained Codex thread is still protected by native/background work. If the current dynamic-tool surface or producer-owned turn context differs, warm reuse can fall through to cold replacement and fail with:

Codex thread ... is claimed by active work; stop it first.

What changed

  • Recover the accepted native tool catalog only for a verified local protected binding.
  • Rebuild executors from the current turn and bind only definitions whose names, schemas, and descriptions exactly match the accepted contract, so current authority remains decisive at tool I/O.
  • Mark producer-owned conversation context as turn-local and relay it outside immutable thread identity.
  • Annotate the direct cron delivery prompt path that was missing from fix(codex): preserve native catalog and completion continuity #174900.
  • Keep compaction/plan restoration distinct from transient developer handoff context.
  • Pass the exact admitted session workspace to existing media-root validation; sibling/shared workspace access remains excluded.

Safety boundaries

  • Genuine immutable policy, provider, runtime, MCP, and plugin changes still rotate or reject.
  • Genuine simultaneous claimed ownership is still rejected; this is not a concurrent claim-takeover mechanism.
  • Direct/no-relay connections remain fail-closed: handoffs supplement creation policy, and changed protected context without a safe relay still refuses.
  • Accepted catalogs restore declarations only. Executors and execution-policy checks are rebuilt from the current admitted turn.
  • This intentionally avoids the broader persisted-catalog and completion-ownership architecture in fix(codex): preserve native catalog and completion continuity #174900.

ClawSweeper remediation evidence

Concern Evidence added
Allowed current owner Retained declarations execute through freshly prepared current executors.
Identityless/private completion Owner-only effects remain unavailable without current admitted authority.
Authority revoked before tool I/O Revocation is asserted before executor invocation; no second executor call occurs.
Scheduled context delivery Producer-to-harness and direct cron delivery paths are covered.
Post-compaction context Current transient context is restored separately from compacted native history.
Existing stored data A concrete v2026.10.6 stored binding is decoded and recovered without schema migration.
No-relay behavior Documented and tested as fail-closed for changed protected context.
Consumer regressions History, skill, attribution, subscription, and context-budget assertions now distinguish the exact conversation handoff while preserving their original semantics.
Provider mocks and protected hook Real runtime exports are preserved and native metadata is seeded from the actual accepted declaration.
Media isolation Production steering with workspaceOnly:false delivers the exact session-workspace image and withholds sibling-session and shared-workspace images before native dispatch or transcript persistence.

Relationship to existing work

Validation

  • Merged current main at 364c0d4ebcd; GitHub reports the branch mergeable.
  • Native app-server steering-media proof: 3/3 boundary cases passed through the packaged codex-cli 0.164.0 app-server, and 15/15 tests passed in the complete steering-media suite.
  • Red-on-without-fix: removing only the session-workspace argument from the production media-root call produced 2 failures / 1 pass:
    • exact admitted session image: expected accepted, observed rejected;
    • sibling-session image: remained rejected;
    • shared-workspace image: expected rejected, observed accepted.
  • Fixed-head changed-file oxlint: 0 warnings/errors.
  • Fixed-head changed-file oxfmt --check and git diff --check: passed.
  • Independent P0-P2 review found no actionable findings. The normal autoreview helper could not launch because this host has no codex executable; the permitted separate reviewer assessed the supplied exact diff and production control flow without helper-owned frozen-input guarantees.

Native app-server proof (redacted)

The proof ran in an isolated temporary OpenClaw namespace; artifacts contain no credentials, personal identifiers, public IPs, or non-public endpoints.

  • Shipped native transport: each case starts the repository-pinned codex-cli 0.164.0 app-server, verifies its reported version, creates a real native turn, and sends steering through the real client. A deterministic loopback Responses endpoint keeps provider output credential-free.
  • Steering authorization boundary, workspaceOnly:false:
    • exact admitted session workspace → accepted;
    • sibling session workspace → rejected;
    • shared workspace → rejected.
  • Final native effect: the accepted case receives a successful native turn/steer acknowledgment whose input contains the expected synthetic PNG bytes as a data URI.
  • Forbidden final effects: both rejected cases emit zero turn/steer requests, make zero persistApproved calls, and create zero visible transcript entries.
  • Red/base behavior: without the production fix, the same proof withholds the admitted session image and exposes the shared-workspace image. The sibling remains withheld.
  • Production path exercised: runCodexAppServerAttempt → packaged native app-server process → active turn → production steering queue → detectAndLoadAgentHarnessPromptImages → production media-root resolver → native turn/steer acknowledgment. The rejection occurs before beforeSubmit, so forbidden media cannot be persisted or dispatched.

The deterministic provider endpoint proves native app-server delivery and acknowledgment, not downstream model interpretation of the image. No live credentials were copied or migrated.

Additional previously supplied evidence covers scheduled context, immediate post-compaction inference, lifecycle revocation before provider/native I/O, and automation final-effect authorization.

Remediation revision

The current proof revision is 7f8792a8855fe18420bffda5dc35555f59b4f1a6. It preserves the exact RomneyDa coauthor trailer and the existing human attribution.

CI ratchet justification

The native packaged-app-server proof adds a distinct transport and lifecycle regression matrix that cannot be represented by the protocol fixture. Hosted CI measured 6,286,693 test lines on the current merged tree, exactly matching the updated ceiling; revision 7f8792a8855fe18420bffda5dc35555f59b4f1a6 raises config/test-lines-baseline.txt to that exact observed total. The ratchet passes locally against current origin/main, and an independent P0-P2 review found no findings.

@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex size: XL labels Oct 23, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 23, 2026
@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR supplies the admitted workspace to Codex steering-image validation and updates continuation tests and documentation.

Example: With workspaceOnly:false, an active Codex session receives /state/sandboxes/session-a/image.png.

  • Before: The admitted session image is rejected, while shared-workspace images can remain eligible.
  • After: The session image is accepted, while sibling-session and shared-workspace images are rejected.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with sufficient native transport and forbidden-input evidence; the deterministic provider proof does not establish downstream model interpretation.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied isolated production-harness run uses packaged codex-cli 0.164.0 with a deterministic loopback provider: admitted image bytes receive a native turn/steer acknowledgment, while sibling and shared workspace images produce no dispatch or transcript writes; the red comparison removes only the repaired workspace argument.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Active Codex steering can refuse images from the admitted session workspace while retaining shared-workspace eligibility.
Reason: The maintainer-authored direction restores an existing isolation contract through its current owner.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: its focused steering-media repair remains necessary on main, and no actionable introduced defect was found. The earlier conflict is resolved; required CI is pending.

Priority: P2
Reviewed head: 7f8792a8855fe18420bffda5dc35555f59b4f1a6

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Codex harness prepares queued attachments, validates their local paths, persists approved input, and dispatches it to the native app-server.

flowchart LR
  A[Queued message and attachments] --> B[Codex active turn]
  B --> C[Session media roots]
  C --> D[Image preparation]
  D --> E[Approved transcript input]
  E --> F[Native turn steer]
Loading

Technical review

Best possible solution:

Retain the workspace argument and focused boundary coverage, then land when required checks pass.

Do we have a high-confidence way to reproduce the issue?

Main omits the authoritative workspace argument, and the supplied red comparison rejects the admitted image while accepting the shared-workspace image; this read-only review ran no target code.

Is this the best way to solve the issue?

Passing admitted workspace context to the existing resolver is the smallest complete repair, and the consumer changes preserve their original assertions while excluding exact conversation handoffs.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 364c0d4ebcd4.

Provenance checked

  • Codex steering image hydration keeps the original intent (5105688: fix(codex): keep stored images in active-turn steering #132429 established recorder-aware hydration, ordered image delivery, rejection before dispatch, and current-turn checks.)
  • Session-scoped media roots keeps the original intent (fca0489: fix(media): bind local media roots to the active session #144347 requires trusted session context to preserve own-workspace access without restoring shared isolation parents.)
  • Continuation consumer assertions keeps the original intent (c853069: The merged continuation implementation adds developer handoffs; the changed assertions distinguish those requests from history and skill restoration. Local follow-history inspection reached an unavailable older object; supplied provenance, available history, current source, and linked PR explanations establish the relevant intent.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5105688 adds extensions/codex/src/app-server/run-attempt-active-turn.ts:263 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 510568848fd1; files: extensions/codex/src/app-server/run-attempt-active-turn.ts)
  • Paul Bohm: Raw commit c853069 adds docs/plugins/codex-harness-reference/dynamic-tools.md:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c85306952ac7; files: docs/plugins/codex-harness-reference/dynamic-tools.md)

PR surface

Source 0, Tests +299, Docs +26, Other -2. Total +323 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 12 329 30 +299
Docs 1 26 0 +26
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 3 -2
Total 16 357 34 +323

Review metrics

Metric Value Why it matters
Production versus test changes Production +1/-1; tests and test support +329/-30 Growth preserves continuation consumer assertions and adds distinct protocol-fixture and native-transport isolation coverage.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The remaining repair restores session-workspace image steering and applies the established isolation contract without adding configuration or lifecycle machinery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-23T09:31:07.589Z sha c361c03 :: needs real behavior proof before merge. :: [P2] Migrate handoff-sensitive consumer assertions | [P2] Preserve runtime exports in the provider-review mock | [P2] Seed native metadata in the protected prompt-hook fixture | [P3] Document the retained no-relay creation policy
  • reviewed 2026-10-24T00:18:16.018Z sha 0f97a98 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-26T03:49:16.643Z sha 92b46cc :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-27T04:38:44.778Z sha 080193f :: needs maintainer review before merge. :: none
  • reviewed 2026-10-27T04:45:50.160Z sha 080193f :: needs maintainer review before merge. :: none
  • reviewed 2026-10-27T18:27:48.310Z sha f9e0548 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-27T18:44:56.358Z sha 8561cbf :: needs changes before merge. :: none

Reviewed October 27, 2026, 3:32 PM ET / 19:32 UTC (Revision 8).

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 24, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 24, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
Raise the test-line ceiling to the exact CI merge-tree total so the durable packaged app-server isolation proof can remain in the PR.

Co-authored-by: RomneyDa <[email protected]>
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
Resolve the test-line baseline conflict at the exact merged-tree total while preserving the native steering proof.

Co-authored-by: RomneyDa <[email protected]>
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants