Repository navigation
fix(codex): stop quoted context from triggering explicit skill mentions - #123345
Conversation
Codex byte-scans every turn text input for $name skill mentions and [@name](plugin://...) links (codex-rs/skills/src/mentions.rs), so historical $skill tokens inside OpenClaw's projected <conversation_context> block and inbound quoted-reply/room-backlog context counted as current explicit invocations and injected skill bodies the user never requested. Neutralize mention sigils with same-length fullwidth lookalikes (the escapeCodexChatText technique) in projected history and inbound context; only the raw current request stays selectable. Fixes #122812
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 6:28 PM ET / 22:28 UTC. ClawSweeper reviewWhat this changesThe PR makes projected Codex history and quoted inbound context inert for explicit skill scanning while preserving skill mentions in the current user request. Merge readinessKeep open for maintainer review. The supplied patch and tests support a focused fix, but the read-only sandbox failed before any repository, history, scoped-policy, or Codex dependency inspection could run; the protected Priority: P2 Review scores
Verification
How this fits togetherThe Codex extension combines OpenClaw context with the active request before submitting a Codex turn. Codex skill selection then scans that submitted text, so this boundary determines whether a mention is historical reference text or a current invocation. flowchart LR
A[Conversation history] --> C[Codex context projection]
B[Current user request] --> C
D[Quoted reply or room backlog] --> E[Inbound context envelope]
C --> F[Codex turn input]
E --> F
F --> G[Skill mention selection]
G --> H[Agent run]
Decision needed
Why: The PR carries a protected maintainer label, and the required local source and Codex-contract inspection could not be completed in this review environment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +18, Tests +41. Total +59 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land a narrowly scoped projection-boundary safeguard only after a maintainer confirms on the current head that every reference-context input is neutralized without changing genuine current-turn invocation behavior. Do we have a high-confidence way to reproduce the issue? Unclear: the PR body supplies a concrete regression scenario, but sandbox failure prevented an independent current-head reproduction or source trace. Is this the best way to solve the issue? Unclear: neutralizing reference-context text at the Codex projection boundary appears appropriately narrow, but the complete input-path and Codex-contract checks could not be performed. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against ba3cb317773c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
#123345 added the file without a project owner; the full-suite coverage guard fails for any PR that runs it.
#123345 added extensions/codex/src/app-server/run-attempt-state.test.ts without a lane owner; the full-suite ownership audit (test/vitest-projects-config.test.ts) fails on main and every PR. Register it beside its run-attempt siblings in the attempt-extra lane.
* feat(docker): schedule image refreshes * docs(docker): explain weekly image refreshes * test(scripts): gate workflow-step execution on bash 4 mapfile support Stock macOS bash 3.2 lacks mapfile; CI truth is Linux bash 5. * test: cover docker-release suffix threading and sanctioned second caller * test(codex): wire run-attempt-state into the attempt-extra project #123345 added the file without a project owner; the full-suite coverage guard fails for any PR that runs it. * fix(ci): run build-artifacts PR validation on hosted runners ci-build-artifacts-testbox.yml pinned PR runs to blacksmith-16vcpu and ran Testbox lifecycle steps unconditionally, so the prepare-run landing gate starved for every PR during a Blacksmith outage even with OPENCLAW_CI_RUNNER_BACKEND=github. PR events now build on ubuntu-24.04 with dispatch-only Testbox steps, mirroring ci-check-testbox.yml. * test(ci): align build-artifacts dispatch guard
…ns (openclaw#123345) Codex byte-scans every turn text input for $name skill mentions and [@name](plugin://...) links (codex-rs/skills/src/mentions.rs), so historical $skill tokens inside OpenClaw's projected <conversation_context> block and inbound quoted-reply/room-backlog context counted as current explicit invocations and injected skill bodies the user never requested. Neutralize mention sigils with same-length fullwidth lookalikes (the escapeCodexChatText technique) in projected history and inbound context; only the raw current request stays selectable. Fixes openclaw#122812
…law#123363) openclaw#123345 added extensions/codex/src/app-server/run-attempt-state.test.ts without a lane owner; the full-suite ownership audit (test/vitest-projects-config.test.ts) fails on main and every PR. Register it beside its run-attempt siblings in the attempt-extra lane.
…#123348) * feat(docker): schedule image refreshes * docs(docker): explain weekly image refreshes * test(scripts): gate workflow-step execution on bash 4 mapfile support Stock macOS bash 3.2 lacks mapfile; CI truth is Linux bash 5. * test: cover docker-release suffix threading and sanctioned second caller * test(codex): wire run-attempt-state into the attempt-extra project openclaw#123345 added the file without a project owner; the full-suite coverage guard fails for any PR that runs it. * fix(ci): run build-artifacts PR validation on hosted runners ci-build-artifacts-testbox.yml pinned PR runs to blacksmith-16vcpu and ran Testbox lifecycle steps unconditionally, so the prepare-run landing gate starved for every PR during a Blacksmith outage even with OPENCLAW_CI_RUNNER_BACKEND=github. PR events now build on ubuntu-24.04 with dispatch-only Testbox steps, mirroring ci-check-testbox.yml. * test(ci): align build-artifacts dispatch guard
Fixes #122812
What Problem This Solves
Codex-backed agents could invoke a skill because its
$skill-nametoken appeared in projected conversation history or quoted inbound context (reply quotes, room backlog) rather than in the raw current user message. Codex byte-scans every turn text input for explicit$nameskill mentions and[@name](plugin://...)links (codex-rs/skills/src/mentions.rs,codex-rs/skills/src/selection.rs:94-103) with no quoting or code-fence awareness, and OpenClaw's Codex adapter packs projected history plus the current request into oneUserInput::Text— so a historical$example-manualinside<conversation_context>was indistinguishable from a freshly typed one. Codex selected the skill and injected its full body, exactly the deterministic signature in the issue report.Why This Change Was Made
Codex's
UserInputenum has no unscanned text variant, so the only correct owner for the fix is OpenClaw's projection boundary. The repo already has the canonical technique pointing the other direction:escapeCodexChatText(extensions/codex/src/command-formatters.ts) neutralizes mention triggers with fullwidth lookalikes so Codex output cannot ping channel users. This change mirrors it channel→Codex:neutralizeCodexExplicitMentionSigilsswaps$name→$nameand[@name](→[@name](inside the rendered<conversation_context>block (the single choke point shared by fresh-thread continuity, context-engine, and stale-binding-resume projections) and the inbound quoted-reply/room-backlog envelope. Fullwidth characters keep identical UTF-16 lengths, so no truncation/range math changes. The raw current request stays untouched: a$skillthe user actually types this turn still resolves.The other half of #122812 — external channels not resolving
$skillat all — is the documented WebChat/Control-UI-only product contract (docs/tools/skills.md, feature commit 7fa95e2) and is intentionally unchanged here, matching the ClawSweeper recommendation on the issue.User Impact
Codex-harness agents no longer falsely report that the user explicitly invoked a skill when the
$skilltoken only exists in history, summaries, quoted replies, or room backlog. Genuine current-turn explicit mentions keep working.Evidence
node scripts/run-vitest.mjs extensions/codex/src/app-server/context-engine-projection.test.ts extensions/codex/src/app-server/run-attempt-state.test.ts→ 25 passed.node scripts/check-changed.mjsgreen (remote proof backend unreachable; local fallback per policy).91d6f48992ad(skills/src/selection.rs,skills/src/mentions.rs,protocol/src/user_input.rs).Supersedes the approach in #123311 for the reported defect; the cross-channel
$skillexpansion proposed there remains a separate product decision. Thanks @hannesrudolph for the report and the detailed provenance diagnosis.