Skip to content

fix(codex): preserve project instructions in restricted turns - #126891

Merged
jalehman merged 3 commits into
mainfrom
fix/125431-preserve-project-docs
Aug 21, 2026
Merged

jalehman merged 3 commits into
mainfrom
fix/125431-preserve-project-docs

Conversation

@jalehman

@jalehman jalehman commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

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.md when 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.md was 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.md snapshot 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.md instructions. Security-sensitive native capability restrictions remain fail-closed.

Evidence

  • Current-main reproduction: Blacksmith Testbox run 32428472431 reproduced the missing AGENTS.md marker in a fresh restricted Codex session while the baseline session retained all workspace markers.
  • Fixed A/B proof: Blacksmith Testbox run 32430308177 repeated the same fresh-session methodology against a synthetic head containing exactly the seven changed files (remote content-manifest SHA-256 22770b84dab06374825c1393737db3cf362f81671c59ae96c0d5bfff2fad0218). Both unrestricted and restricted sessions received the AGENTS.md, SOUL.md, IDENTITY.md, and USER.md markers. The restricted turn still used environments: [], made zero tool calls, and kept native agents, multi-agent, MCP, skills, image generation, hooks, and web search disabled. The AGENTS.md snapshot appeared exactly once in both its rollout and thread/start.developerInstructions. The inner proof command exited 0 with PROOF_COMPLETE=true; the outer workflow is marked canceled because the Testbox lease was stopped after proof collection and cleanup.
  • Ring-zero security regression: the combined ring-zero + policy-restricted test demonstrably failed on the prior PR head because project_doc_max_bytes remained 64_000 instead of 0. The repaired start/resume boundary now forces zero, retains environments: [] and every native/MCP denial, preserves host-authored ring-zero instructions, and excludes the ambient workspace AGENTS.md carrier even when the execution workspace inherits the agent workspace.
  • Regression coverage: 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.
  • Repository gates: node scripts/check-changed.mjs -- <changed files> passed, including extension typechecks, lint, max-lines, boundary, dead-export, database-first, and import-cycle checks.
  • Docs: the Codex guide and reference now define policy-restricted turns, every restriction source, the audited safe-deny behavior, transient thread handling, ring-zero activation and isolation, and the project-instruction rules for adjacent internal modes. pnpm docs:check-mdx passed for 777 files, pnpm docs:check-links found 0 broken links across 6,526 internal links, and pnpm docs:check-i18n-glossary passed.
  • Review: fresh autoreview --mode uncommitted --base origin/main reported no accepted/actionable findings (patch is correct, confidence 0.96).
  • Codex contract: pinned Codex 0.148 source confirms that native project-document loading is independently budgeted and environment-backed, while explicit thread developer instructions are accepted through a separate path and become model-visible developer content. Both paths must therefore be suppressed for ring zero (project-document loading, thread start processing, model-visible developer instructions).
  • Live-proof gap: real openclaw setup Testbox 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
source: [LOCAL_SESSION]
redaction: local paths, emails, phone-shaped strings, token-shaped strings, auth headers, auth query params
omitted: raw tool outputs, system/developer prompts, local paths, secrets, browser/session/auth details
stats: {"agent":"openclaw","entries":3,"user":1,"assistant":1,"toolCalls":9,"toolOutputsDropped":9,"web":0,"redactions":6,"omittedUnsafe":0,"rawEntries":15}

[user]
[instructions recap omitted; policy/config text, not task dialogue]

[assistant]
[instructions recap omitted; policy/config text, not task dialogue]

The implementation worktree is clean and based on the current `origin/main` SHA. The local sibling Codex checkout exists but does not yet have the pinned `rust-v0.148.0` tag, so the Codex contract gate requires fetching that exact tag before I edit or make the final architectural claim.

The regression test now demonstrably fails pre-fix (`project_doc_max_bytes` was forced from `64_000` to `0`). The implementation separates project-document context from native tool restriction: ordinary policy-restricted turns retain the 128 KiB default or an authored override, while ring-zero, message-only, lightweight, and explicit tool-disabled paths still force zero. This follows the pinned Codex 0.148 contract: project-doc loading is budgeted and filesystem-backed independently from tool-router construction.

The test-audit gate is satisfied: the new regression protects the observable project-document budget at the thread start/resume boundary, fails on pre-fix code for the reported zero-budget reason, extends existing ring-zero coverage rather than adding a test seam, and separately pins the intentional tool-disabled zero-budget path. I’m also applying the technical-documentation workflow now because the existing Codex harness page describes the old coupled behavior and must change with the runtime contract.

The owner regression and full thread-lifecycle suite pass. A broader combined Codex run exposed two unrelated plugin-app inventory assertions in `run-attempt.test.ts`; neither touches project-doc or restricted-tool config. I’m rerunning those exact failures in isolation before classifying them, rather than attributing shared test-state noise to this patch.

Local validation is progressing cleanly: the full Codex thread-lifecycle suite is 153/153, formatting and the initial changed-file guards are green, and the longer extension type/lint/dead-export/import-cycle plan is still running. The only broader failure so far is an isolated pre-existing plugin-app inventory assertion outside the changed surface; I’m keeping it separate from the issue proof. The Crabbox baseline lease is active on exact `origin/main` and running the fresh unrestricted/restricted A/B turns.

The changed-file gate caught the file’s 700-line ceiling, which is useful pressure here: I’m compressing the ownership split rather than adding a suppression or a new abstraction. The revised form keeps the same semantics while simplifying the lightweight config merge and staying within the existing module boundary.

Implementation validation is now green: 153/153 owner tests, the full changed-file plan (format, extension typechecks, lint, max-lines, boundary/dead-export/database/import-cycle guards), and the 777-file docs MDX check all pass. The diff is production +16/−13 (net +3), tests +41, docs +4/−2; the remaining production growth is the explicit separation between tool authority and project-document context. I’m starting the mandatory fresh Codex autoreview now; fixed-head Crabbox proof begins only after that review is clean.

Baseline is reproduced on exact `origin/main`; the owner-boundary fix and regression test are implemented, focused checks are green, and autoreview found no actionable issues. The same fresh-session Crabbox A/B is now running against the dirty worktree to prove the fix without changing methodology.

The trace is definitive: the budget is now 128 KiB and every native restriction remains enforced, but `environments: []` intentionally removes Codex’s filesystem reader, so no workspace project document can load. I’m preserving that security boundary and moving the repair to OpenClaw’s existing bounded developer-instruction carrier specifically for ordinary policy-restricted turns.

The revised boundary is green under the changed-file gate and all 153 lifecycle tests. I’m doing the required diff cleanup pass now, then a fresh autoreview; the two pre-existing app-inventory assertions remain the only failures in the broad attempt file, while the changed regression test passes independently.

Deslop found no comment, guard, cast, compatibility, or style cleanup to make. The remaining +6 production lines are the explicit security/context ownership split: preserve the isolated tool environment while selecting the existing bounded thread-instruction carrier.

The revised live A/B now passes at the user-visible and owner boundaries: both fresh sessions receive all four workspace markers; the restricted turn keeps `environments: []`, zero tools, and every native/MCP capability disabled. The worker is rerunning once to remove an overstrict baseline rollout-count assertion that misclassified Codex’s native serialization, not product behavior.

[tool summary]
2 read, 7 other; raw tool outputs dropped: 9

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@jalehman
jalehman marked this pull request as ready for review August 21, 2026 00:04
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: S maintainer Maintainer-authored PR labels Aug 21, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 9:14 PM ET / August 21, 2026, 01:14 UTC.

ClawSweeper review

What this changes

This 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 provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No 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
Reviewed head: 22c04b58ff89cf08ed1910a7277b7c5c1e37f8ce

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair and post-fix evidence are strong, with one remaining upstream-contract verification step before merge.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides an after-fix fresh-session Testbox A/B run showing AGENTS.md delivery while the restricted native environment and zero-tool restriction remain in effect.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides an after-fix fresh-session Testbox A/B run showing AGENTS.md delivery while the restricted native environment and zero-tool restriction remain in effect.
Evidence reviewed 7 items Current-main defect: Current main applies the restricted-tool patch whenever plugin harness policy is restricted; that patch included project_doc_max_bytes: 0, creating the reported AGENTS.md delivery gap.
Fixed owner boundary: The PR separates project-document suppression from ordinary tool-policy restriction, then carries only the configured agent-workspace AGENTS.md through the existing frozen thread developer-instruction path.
Ring-zero regression coverage: Start and resume retain project_doc_max_bytes: 0 when ring-zero overlaps policy restriction, while ordinary restricted turns preserve the configured project-document budget and tool-disabled turns remain suppressed.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

runner@runnervm76f27:/tmp/clawsweeper-live-proof-126891-KUW8nV/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 77.01 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.6s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 11.1s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 6268ms (slowest: bundled plugin metadata 2967ms)

OpenClaw 2026.8.1 (22c04b5) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (silent|fatal|error|warn|info|
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - The exact Codex 0.148 source contract could not be independently inspected because the required sibling checkout is unavailable in this review environment; confirm the developer-instruction and project-document behavior before merge.
  • Resolve merge risk (P1) - Production code grows by 16 net lines for a bug fix; that is justified only by the two separate owners that must receive the same ring-zero fact: native thread configuration and OpenClaw’s instruction carrier.
  • Complete next step (P2) - No repair is identified; complete the exact Codex contract check and exact-head CI before deciding to merge.
Agent review details

Security

None.

PR surface

Source +16, Tests +90, Docs +4. Total +110 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 37 21 +16
Tests 3 90 0 +90
Docs 1 6 2 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 133 23 +110

Review metrics

Metric Value Why it matters
Production versus test LOC production +37/-21 (net +16); tests +90/-0; docs +6/-2 The production growth carries the ring-zero policy fact across the separate thread-config and instruction-carrier owners; tests cover ordinary restriction plus ring-zero precedence.

Stored data model

Persistent data-model change detected: serialized state: extensions/codex/src/app-server/attempt-context.test.ts, serialized state: extensions/codex/src/app-server/run-attempt.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #125431
Summary: This PR is the active candidate fix for the restricted-tool-policy AGENTS.md delivery failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Recheck the pinned Codex contract (recommended)
    Before merge, inspect the pinned Codex 0.148 thread processor and session sources to confirm developer instructions remain a separate model-visible path from project-document loading.
  2. Pause for contract access
    Hold the PR if the pinned Codex source cannot be inspected, since this change deliberately crosses the restricted-turn instruction boundary.

Technical review

Best 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.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides an after-fix fresh-session Testbox A/B run showing AGENTS.md delivery while the restricted native environment and zero-tool restriction remain in effect.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Ordinary restricted Codex sessions can silently lose their workspace operating instructions on current main.
  • merge-risk: 🚨 security-boundary: The patch changes model-visible workspace guidance in restricted and ring-zero execution modes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides an after-fix fresh-session Testbox A/B run showing AGENTS.md delivery while the restricted native environment and zero-tool restriction remain in effect.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix fresh-session Testbox A/B run showing AGENTS.md delivery while the restricted native environment and zero-tool restriction remain in effect.

Evidence

Acceptance criteria:

  • [P1] Inspect pinned Codex 0.148 project-document loading, thread processing, and session developer-instruction behavior.
  • [P1] Confirm the focused Codex lifecycle and attempt-context tests on the exact head.
  • [P1] Require exact-head CI to finish green.

What I checked:

Likely related people:

  • Peter Steinberger: History shows repeated maintenance of Codex project-document, thread-policy, and AGENTS.md visibility behavior. (role: recent area contributor; confidence: high; commits: d5aff660a248, 491dc7f8b1be; files: extensions/codex/src/app-server/thread-requests.ts, extensions/codex/src/app-server/attempt-context.ts)
  • Ayaan Zaidi: History associates this person with the earlier native-subagent workspace-instruction inheritance path reused by the carrier. (role: workspace-inheritance contributor; confidence: medium; commits: d412c6b284e4; files: extensions/codex/src/app-server/attempt-context.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Recheck the pinned Codex 0.148 source contract in an environment containing the required sibling checkout.
  • Require exact-head CI completion before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-21T00:11:09.339Z sha b4be559 :: found issues before merge. :: [P1] Keep ring-zero project documents suppressed

@jalehman

Copy link
Copy Markdown
Contributor Author

Addressed the ring-zero isolation finding in 22c04b58ff89cf08ed1910a7277b7c5c1e37f8ce.

  • Ring zero now overrides an overlapping ordinary policy restriction in the thread config, so start and resume retain project_doc_max_bytes: 0.
  • The prepared ring-zero fact is required by the workspace-context owner and gates the entire ambient AGENTS.md carrier, including the inherited-agent-workspace branch. Host-authored ring-zero instructions remain intact.
  • Combined-mode coverage proves both suppression paths together: zero native project-doc budget, no ambient developer-instruction marker, environments: [], and the existing native/MCP/delegation/skills/hooks/web restrictions.
  • The new config regression demonstrably failed on the prior PR head (expected 0, received 64000) and passes after the repair. The context/lifecycle suites pass 161/161; the changed-file gate is green; fresh autoreview reports no actionable findings.
  • I directly rechecked pinned Codex rust-v0.148.0: codex-rs/core/src/agents_md.rs, codex-rs/app-server/src/request_processors/thread_processor.rs, and codex-rs/core/src/session/mod.rs. Native project-doc loading and explicit developer instructions are independent model-context paths, so ring zero suppresses both.

The PR body records the exact commands, production/test LOC, and a concrete real-flow proof gap. Two Testbox openclaw setup attempts were blocked before the target ring-zero turn by setup's existing exact inference-owner drift guard (instrumented run, stock Codex run after full build); neither is represented as successful product proof.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

@MertBasar0 Addressed the documentation gap in 87d0eb14536.

The docs now make the terminology and triggers explicit:

  • a restriction is normally per turn, not a permanently "restricted session"
  • ordinary policy-restricted turns list the policy layers and allow/deny shapes that activate the isolated Codex native surface
  • the reference enumerates the current audited safe-deny set and uses tools.deny: ["nodes"] as the concrete fail-closed example
  • ring zero is defined as the host-owned setup/repair path with the exact single openclaw tool, not a user-selectable chat mode
  • ordinary policy restriction, ring zero, lightweight context, message-only replies, and tool-disabled internal turns now have distinct project-instruction behavior documented
  • the runtime/reference pages now explain the bounded AGENTS.md developer-instruction carrier and when it is suppressed

Validation: docs:check-mdx passed for 777 files; docs:check-links found 0 broken links across 6,526 internal links; docs:check-i18n-glossary and git diff --check passed.

@MertBasar0

Copy link
Copy Markdown
Contributor

Thanks for addressing both the runtime behavior and the documentation gap, while preserving the ring-zero isolation boundary. Great to see this merged.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
…aw#126891)

* fix(codex): preserve restricted project instructions

* fix(codex): preserve ring-zero context isolation

* docs(codex): explain restricted turns and ring zero
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 maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

[Bug]: Codex restricted tool policy silently disables workspace AGENTS.md

2 participants