Skip to content

fix(codex): restore session, crew, and audit integration - #15

Merged
ancongui merged 2 commits into
mainfrom
hotfix/codex-integration
Nov 11, 2026
Merged

ancongui merged 2 commits into
mainfrom
hotfix/codex-integration

Conversation

@ancongui

@ancongui ancongui commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Codex chats started outside a repository could lose project context, route crew commands to another chat, and omit requests received during a turn. This hotfix restores those workflows, isolates scratch files and write attribution, and preserves complete crew messages. Runtime changes are specific to Codex, with paired tests preserving Claude behavior.

Changes

  • Bind an existing Codex session to its own managed checkout after executed work, including short tasks, failed commands, and deferred results; use that binding for context and canary checks.
  • Validate session ownership across shared host processes and nested commands; explain ambiguous callers as command refusals instead of internal crashes, and clear capacity refusals only after successful readmission.
  • Align native Codex audit actors, runs, and crew context; preserve registered Claude processes and authoritative hook payloads, and require proven ownership before retaining a child's parent. Audit metadata grants no permissions.
  • Create isolated scratch folders for app and CLI crew members, including reviewers, while rejecting foreign sessions, sibling lanes, and symlink escapes.
  • Record accepted patches before execution, distinguish pending or failed attribution from certain authorship, and check canonical repository paths and actual patch destinations.
  • Preserve complete sanitized crew messages, acknowledge successful output, retain moot-message audit events, and distinguish documented wait outcomes from real failures.
  • Recover human steering immediately from the validated root rollout, backfill older current-turn requests in bounded reads, and keep chronological continuity without granting approval authority.
  • Document live observations, contract coverage, and host limitations separately; package 26.11.12 on merged PR fix(install): keep dev on the PATH and pin on every Mac (26.11.11) #14 without changing its installer or tests.

How to verify

  • Local CI is green on 13d9f8bcf8d2c42f25a191738e7d410638fd90f8 (tree 33f5ab79d076885e8bd77360cd011c3baf5344c6): Python 3.13.18, dev ci --run --resume --step-timeout 90, all seven stages passed in 27m45s. The supported affected-test selection covers 205 files: raw unittest output reports 4,303 cases, zero failures/errors, one transcript-dependent skip, and no expected failures. Compilation and all five pinned security scanner commands passed; OSV found no package sources to scan. dev ci --evidence accepts the exact clean commit. Its partial-run parser reports 4,288; the raw count is authoritative and the shared reporting discrepancy is tracked separately.
  • Independent code and security reviews approved the final delta with no open findings. Remote CI #38 passed all three jobs on the exact reviewed SHA: Python 3.9, Python 3.13, and security.
  • Final full remote suites each ran 4,341 cases, with zero failures/errors and no expected failures: Python 3.9 in 2,200.557 seconds (41 skipped), and Python 3.13 in 2,298.614 seconds (40 skipped). The skips are environmental: 32 require native gitleaks, two historical tags, and one each requires a transcript, ripgrep, actionlint, a personal account, Starship, or Homebrew Codex; Python 3.9 additionally lacks TOML support. Tool/tag/TOML checks passed locally. The unchanged personal-account check passed in the initial full suite and was outside the final affected selection. No changed Codex regression was skipped.
  • Additional regression proofs against ce94953: seven audit cases fail without the correction; the final eight-case proof selection passes twice, including a control that preserves existing backup and embargo restrictions. Actual ambiguous watch and watches commands fail without the specific refusal handling and pass twice with it. Existing controls and fixture maintenance that pass on the baseline are not counted as newly proven fixes.
  • Regression proofs: affected Codex fixes fail against c6d3eb0 and pass with the correction. Admission coverage characterizes existing behavior; it is not presented as a fixed defect.
  • Documentation checks: Markdown and local links pass; 19 diagrams validate. Existing prose warnings remain outside this change.
  • Installed-host check remains pending: use the supported developer update/install workflow, restart Codex, then check a projectless chat's repository identity, canary score, real crew launch/stop evidence, scratch isolation, and a request received during a tool call. No global installation or approval grants were performed to manufacture this evidence.

Risk and rollback

The affected boundaries are Codex session identity, permission checks, concurrent attribution, and continuity. Paired Claude controls and negative Codex tests cover rejection paths. Running sessions keep their pinned hooks until the developer updates and restarts them; source tests do not certify every host UI or installed lifecycle. Codex still exposes no pre-launch hook, so an over-limit member can only be restricted after launch. Historical attribution flags require reconciliation with evidence and are not automatically erased.

Revert this PR through the normal review process if the new Codex behavior regresses. This preserves the preceding installer hotfix.

Links

Projectless Codex chats lost repository context and mid-turn requests, while shared host processes could misroute crew commands. Restore these workflows without changing Claude behavior.

Root cause: Codex reused repository-only context checks and ambiguous process identity, omitted pending patches from attribution, and skipped its rollout during mid-turn capture. Wait delivery truncated consumed messages and classified expected exits as failures.

Bind executed work to its own session, isolate app and CLI scratch, preserve patch and message provenance, and recover human steering with bounded reads. Add provider comparisons and regression proofs, document observed host limits, and package 26.11.12 on the merged installer hotfix.

Verified: Independent review: 88 focused tests and 31 Python 3.9 compatibility tests pass; dev sec scan exits 0; changed documentation checks pass with historical prose warnings. Regression proofs and paired Claude controls pass.

Refs: #14
Codex commands need accurate audit provenance without changing Claude behavior or relaxing crew restrictions.

Root cause: Audit ignored native thread identity and shared context with backup restrictions, while Codex ownership refusals reached the generic CLI crash handler.

Separate native record enrichment from public caller context, preserve explicit hook and process identity, explain Codex ownership refusals, and align existing contract fixtures with the corrected hooks.

Verified: Python 3.13 and 3.9: audit identity plus shared-state acceptance, 9 passed each; schema and backup controls, 13 passed each; focused ownership checks, 62 passed each. Final proof: 8 audit cases pass twice, 7 fail on ce94953 and one preserves baseline restrictions. Independent code and security reviews approved; security scans exit 0; test audit and diff checks clean. Full local CI resume follows this commit.

Refs: #14
@ancongui
ancongui merged commit a03ac6d into main Nov 11, 2026
3 checks passed
@ancongui
ancongui deleted the hotfix/codex-integration branch November 11, 2026 00:19
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