Repository navigation
fix(codex): preserve project instructions in restricted turns - #126891
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 9:14 PM ET / August 21, 2026, 01:14 UTC. ClawSweeper reviewWhat this changesThis PR carries a bounded workspace AGENTS.md snapshot into ordinary restricted Codex threads while retaining tool restrictions and suppressing ambient workspace instructions for ring-zero and internal turns. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo new blocking patch defect found; the prior ring-zero isolation finding is addressed. Keep this maintainer-labeled PR open while exact-head checks finish and the required pinned Codex source contract is rechecked by an environment that has that checkout. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Codex extension translates an OpenClaw turn’s tool policy into Codex app-server thread configuration and developer instructions. That thread setup determines both native tool availability and the workspace guidance visible to the model. flowchart LR
A[OpenClaw agent turn] --> B[Codex context preparation]
B --> C{Turn policy}
C -->|Ordinary restricted| D[Bounded AGENTS snapshot]
C -->|Ring-zero or internal| E[Suppress ambient project guidance]
D --> F[Codex thread start or resume]
E --> F
F --> G[Model context and restricted tools]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +90, Docs +4. Total +110 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one bounded AGENTS.md carrier for ordinary restricted threads, with explicit ring-zero, message-only, lightweight, and tool-disabled suppression at their existing policy owners. Do we have a high-confidence way to reproduce the issue? Yes—current-main source selects the restricted patch that zeroes native project-document loading, and the submitted fresh-session A/B proof exercises that path. Is this the best way to solve the issue? Yes for the OpenClaw owner boundary: the carrier reuses existing bounded workspace context rather than restoring filesystem authority; final confidence requires the pinned Codex source-contract recheck. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 319df0e7a154. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Addressed the ring-zero isolation finding in
The PR body records the exact commands, production/test LOC, and a concrete real-flow proof gap. Two Testbox @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@MertBasar0 Addressed the documentation gap in The docs now make the terminology and triggers explicit:
Validation: |
|
Thanks for addressing both the runtime behavior and the documentation gap, while preserving the ring-zero isolation boundary. Great to see this merged. |
…aw#126891) * fix(codex): preserve restricted project instructions * fix(codex): preserve ring-zero context isolation * docs(codex): explain restricted turns and ring zero
Closes #125431
AI-assisted: yes. The implementation, validation, and live proof were performed with OpenClaw/Codex and reviewed with the repository autoreview workflow.
What Problem This Solves
Fixes an issue where ordinary Codex-harness turns silently lost their workspace
AGENTS.mdwhen an OpenClaw conversation tool policy selected the restricted native-tool path.The restriction correctly removed native tool and MCP authority, but it also disabled native project-document discovery. Because same-workspace
AGENTS.mdwas excluded from OpenClaw's own instruction carrier, the model received neither copy of the workspace operating contract.Why This Change Was Made
This separates workspace instruction delivery from native tool authority. Ordinary policy-restricted turns keep the isolated Codex environment and all existing tool, MCP, hook, delegation, image-generation, and web-search restrictions, while OpenClaw carries the bounded workspace
AGENTS.mdsnapshot through the existing frozen thread-level developer-instruction path.Lightweight, ring-zero, message-only, and explicitly tool-disabled internal turns continue to suppress project documents. Ring-zero now has explicit precedence over an overlapping ordinary conversation-policy restriction in both native project-document configuration and OpenClaw's developer-instruction carrier. The Codex harness documentation describes the distinction.
User Impact
Operators can restrict a Codex session's callable tools without silently removing workspace
AGENTS.mdinstructions. Security-sensitive native capability restrictions remain fail-closed.Evidence
AGENTS.mdmarker in a fresh restricted Codex session while the baseline session retained all workspace markers.22770b84dab06374825c1393737db3cf362f81671c59ae96c0d5bfff2fad0218). Both unrestricted and restricted sessions received theAGENTS.md,SOUL.md,IDENTITY.md, andUSER.mdmarkers. The restricted turn still usedenvironments: [], made zero tool calls, and kept native agents, multi-agent, MCP, skills, image generation, hooks, and web search disabled. TheAGENTS.mdsnapshot appeared exactly once in both its rollout andthread/start.developerInstructions. The inner proof command exited 0 withPROOF_COMPLETE=true; the outer workflow is marked canceled because the Testbox lease was stopped after proof collection and cleanup.project_doc_max_bytesremained64_000instead of0. The repaired start/resume boundary now forces zero, retainsenvironments: []and every native/MCP denial, preserves host-authored ring-zero instructions, and excludes the ambient workspaceAGENTS.mdcarrier even when the execution workspace inherits the agent workspace.node scripts/run-vitest.mjs extensions/codex/src/app-server/attempt-context.test.ts extensions/codex/src/app-server/thread-lifecycle.test.ts— 161 tests passed. The strengthened full app-server policy boundary also passed independently. A broader 305-test attempt/context/lifecycle run retained two pre-existing plugin-app inventory failures outside this change; the changed regression passed independently.node scripts/check-changed.mjs -- <changed files>passed, including extension typechecks, lint, max-lines, boundary, dead-export, database-first, and import-cycle checks.pnpm docs:check-mdxpassed for 777 files,pnpm docs:check-linksfound 0 broken links across 6,526 internal links, andpnpm docs:check-i18n-glossarypassed.autoreview --mode uncommitted --base origin/mainreported no accepted/actionable findings (patch is correct, confidence 0.96).openclaw setupTestbox attempts on the exact six-file candidate were blocked before the target ring-zero turn by setup's existing exact inference-owner drift guard, first with RPC instrumentation (run 32434610344) and then with the stock Codex executable after a full build (run 32434965527). Neither run reached the behavior under test, so they are recorded as blocked setup proof rather than product success.Production LOC: +37/-21 (net +16) | Tests: +82/-0 | Docs: +127/-21. The production growth is the explicit security ownership split: a required prepared ring-zero fact is carried to the context owner so the same stronger policy governs both Codex's native project-document budget and OpenClaw's independent instruction carrier.
Agent Transcript
Redacted openclaw session transcript