Repository navigation
fix(codex): restore installed skills with catalog-backed models - #138944
Colton-Harris wants to merge 4 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 6, 2026, 3:46 PM ET / 19:46 UTC. ClawSweeper reviewWhat this changesMoves installed-skill catalogs into Codex thread instructions and adds catalog refresh handling, regression tests, and documentation for persistent and incognito conversations. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 7 items remain This remains a useful fix for a problem still present on main. The new live transcript demonstrates natural skill selection and loading, but the incognito compaction defect remains and the new regression suites lack full-suite registration. Priority: P2 Review scores
Verification
How this fits togetherThe Codex plugin translates OpenClaw’s eligible skill catalog into instructions sent to the native Codex runtime. Those instructions tell the model which skills it can discover and load during a conversation. flowchart TD
A[Installed skills] --> B[Eligible skill catalog]
B --> C[Codex thread instructions]
C --> D[Persistent or incognito thread]
D --> E[Catalog refresh]
E --> F[Native context and compaction]
F --> G[Model selects and reads skills]
Decision needed
Why: The existing carrier already inherits, but adding the catalog changes child behavior; the contributor explicitly leaves this choice to maintainers. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +90, Tests +476, Docs +13. Total +579 across 25 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one current catalog across native context rebuilds without ending incognito conversations, and document the maintainer-approved child-inheritance contract. Do we have a high-confidence way to reproduce the issue? Yes, source establishes both the original collaboration-carrier loss and the remaining incognito defect: change or withdraw a catalog, compact the native thread, then continue with the same catalog snapshot. No contributor code was executed during this review. Is this the best way to solve the issue? Partly: thread instructions avoid model-catalog replacement, but a history-only refresh is not a durable replacement for canonical native context. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a860f648b669. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Moving the installed-skill catalog into thread developer instructions made every catalog refresh look like a generic policy change. On a live incognito thread the warm-reuse guard compared the whole creation string, so editing a skill description and sending another message threw CodexIncognitoPolicyChangeError before turn/start. The catalog is now a separate lifecycle input (`skillsInstructions`). The request builder joins it onto the wire developer carrier after the generic policy, so catalog-backed models still receive it and persistent threads keep cold-resuming through the existing policy handoff. The retained ephemeral record splits the immutable generic policy from the catalog last delivered; incognito warm reuse compares only the generic policy (unchanged guard, still fail-closed) and delivers a changed catalog with a `thread/inject_items` developer message, tracked so an unchanged catalog is not re-sent. Docs: the runtime guide, system-prompt concept, and token-use reference still said the catalog rode turn-scoped collaboration instructions; they now match the thread carrier and the incognito refresh. Codex protocol behavior checked in sibling ../codex (main 459a79e): core/src/context/world_state/collaboration_mode.rs:30-42 (catalog messages replace caller collaboration instructions), app-server-protocol v2 thread.rs (thread/settings/update has no developerInstructions), turn_processor.rs thread_inject_items, context-fragments/src/additional_context.rs (1,000-token cap rules out additionalContext as the catalog carrier). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_0176wGf7ZCkA23SA13tChzt8
Resolves the reported merge conflict in extensions/codex/src/app-server/run-attempt-turn-request.ts. Upstream reshaped the buildTurnStartParams call (prompt context images spread into the runtime params, plus messageToolAvailable and requireExplicitMessageTarget); this branch removed the skillsCollaborationInstructions turn carrier. The resolution keeps the upstream call shape and drops only that removed option, which no longer exists on CodexAttemptContext or the turn-params contract. Co-Authored-By: Claude Opus 5 <[email protected]>
Adds the missing half of the reused-thread coverage. The incognito case already proved an edited catalog reaches a live ephemeral thread through thread/inject_items. This covers the persistent case: the catalog rides the thread developer carrier, so it participates in the thread-config fingerprint (thread-fingerprints.ts:121). An edited skill therefore invalidates warm reuse and cold-resumes the SAME thread with the new catalog, instead of either losing the conversation or answering from the stale catalog. Mutation-checked: dropping options.skillsInstructions from the join in buildCodexThreadConfiguration fails both this test and the incognito two-turn test, so neither assertion is vacuous. Also adapts the native skills test to upstream's changed shutdown contract. closeAndWait() returns CodexAppServerCloseResult rather than boolean since bcef3b3 (openclaw#139657); the assertion now uses the same toMatchObject({ exited: true }) form as the other native tests (thread-lifecycle.native.test.ts:142, settled-turn-finalizer.native.test.ts:57). Co-Authored-By: Claude Opus 5 <[email protected]>
|
Recreated from my personal fork as #140422 (same commits, identical head SHA |
Related: #95058 (Codex/OpenClaw skill prompt-contract differences).
What Problem This Solves
An ordinary Codex-backed OpenClaw agent could not use installed skills when the active model supplies its own collaboration-mode instructions. The OpenClaw skill snapshot and the system-prompt report could both show the complete catalog while the model received none of it.
Why This Change Was Made
Codex intentionally prefers
model_messages.collaboration_modesover caller-suppliedcollaborationMode.settings.developer_instructions(openai/codex#36351). OpenClaw was using that replaceable field to transport its skill catalog, so a catalog-backed model silently replaced it.The eligible skill catalog now travels with the ordinary thread developer instructions, after the generic policy. Model-owned collaboration policy is preserved, and the catalog is no longer replaceable.
Skill catalog lifetime (revised after review)
The first revision folded the catalog into the generic policy string. That made an ordinary skill edit look like a generic-policy change, and a live incognito thread would refuse the next turn with
CodexIncognitoPolicyChangeError. That was a real regression and it is fixed.The catalog is now a separate lifecycle input (
skillsInstructions), joined onto the wire developer carrier at request build rather than mixed into the policy:thread/inject_items, and an unchanged catalog is not re-sent. Editing a skill no longer ends an incognito conversation; changing generic policy still refuses the turn.Codex protocol behaviour was checked directly in a sibling
openai/codexcheckout:core/src/context/world_state/collaboration_mode.rs:30-42(catalog messages replace caller collaboration instructions), app-server-protocol v2thread.rs(thread/settings/updatecarries nodeveloperInstructions),turn_processor.rs(thread_inject_items), andcontext-fragments/src/additional_context.rs(the 1,000-token cap rules outadditionalContextas the catalog carrier).User Impact
Ordinary root conversations receive the eligible OpenClaw skill catalog even with catalog-backed Codex models. No skill-file copying or configuration workaround is required. Editing a skill mid-session refreshes the catalog on both persistent and incognito conversations without ending either.
Native child inheritance — maintainer decision requested
Review asked whether native Codex children should inherit the parent's skill catalog, and recommended preserving root-local scope. One correction to the premise, then the actual question.
The thread developer carrier already flowed to native children before this PR. At the pre-PR base
1a727ee,extensions/codex/src/app-server/thread-requests.ts:215-216already setdeveloperInstructionsinbuildCodexThreadConfiguration, andcodex-rs/core/src/tools/handlers/multi_agents_common.rs:205copies that field into child configuration unconditionally:This repo's own docs already documented that as intended for the same carrier —
docs/concepts/system-prompt.md:124: "OpenClaw adds the configured agent workspace's boundedAGENTS.mdsnapshot to the thread-level developer instructions so native Codex sub-agents inherit it." So this change does not newly expand the carrier's scope; it appends one section to a field children already inherited. Workspace persona, identity, and user profile stay on the turn-scoped collaboration carrier and still do not reach children.The real question, for a maintainer: should the skill catalog specifically reach native children?
Root-local scope is implementable, and here is the exact shape, so the decision does not need another research round-trip.
multi_agents_common.rs:206-213honoursfeatures.multi_agent_v2.subagent_developer_instructions, which OpenClaw can set through the untypedconfigmap onthread/start/thread/resume(the same channelnative-skill-isolation.tsalready uses forskills.include_instructions). It would be roughly five lines inbuildCodexThreadConfigurationsetting that key to the non-catalog half.Two caveats that argue for deciding it deliberately rather than folding it into this repair:
MultiAgentVersion::V2(multi_agents_common.rs:206). Under V1 it is inert, so it would claim root-local scope while still inheriting on V1 paths.Happy to implement it in this PR or a follow-up — it is a product call about child capability, not a blocker I want to guess at.
Merge conflicts resolved
upstream/main(c9095375c0) is merged into this branch. Exactly one file conflicted,extensions/codex/src/app-server/run-attempt-turn-request.ts: upstream reshaped thebuildTurnStartParamscall (context images spread into runtime params, plusmessageToolAvailable/requireExplicitMessageTarget) while this branch removed theskillsCollaborationInstructionsoption. The resolution keeps upstream's call shape and drops only that removed option;rg -n "skillsCollaborationInstructions"over the merged tree returns no hits.The merge also surfaced a silent contract break worth calling out: upstream
bcef3b3526d(#139657) changedcloseAndWait()fromPromise<boolean>toPromise<CodexAppServerCloseResult>, so the native skills test's.toBe(true)cleanup assertion failed. It now uses this repo's own convention for native tests (thread-lifecycle.native.test.ts:142,settled-turn-finalizer.native.test.ts:57):toMatchObject({ exited: true }). Still asserts a clean process exit.Evidence
mergeable=MERGEABLEat head164d85a4e5e(wasCONFLICTING/DIRTY).run-attempt.skills.test.tsdrives three turns through the realrunCodexAppServerAttemptand pins the exact request sequencethread/start, turn/start, thread/inject_items, turn/start, turn/start— turn 2 refreshes an edited catalog on the live thread with no new thread and no refusal; turn 3 repeats the catalog and sends nothing extra. It assertsthread/starthadephemeral: true, so this is a genuine incognito thread.thread-lifecycle.binding.test.tscase asserts an edited catalog invalidates warm reuse and cold-resumes the samethreadIdwithgeneric policy\n\n<new catalog>onthread/resume, plus the refreshed catalog in thethread/inject_itemshandoff.policycase fail withpromise resolved ... instead of rejecting, while theskillscases keep passing. Catalog refresh is permitted; policy drift is still refused.options.skillsInstructionsfrom the join inbuildCodexThreadConfigurationfails both.npx tsgo --noEmit -p tsconfig.jsonproduces an error set identical to unmodifiedupstream/main(109 = 109, all pre-existingTS7016/TS7006underscripts/). Zero new errors; zero inextensions/codexorsrc/skills.oxfmt --checkandoxlintclean over all 25 touched files. Both were first run against a deliberately broken probe file and both flagged it, so the clean result is a real pass rather than a silent no-op.git diff --check: clean.Live skill-read proof (addresses the "needs real behavior proof" block)
The prior loopback run was a fair criticism: synthetic provider, tools off, so it proved delivery but not selection. Here is an ordinary conversation on a real provider with tools enabled.
Setup: OpenClaw built from this branch, isolated state dir, real
weatherSKILL.md installed at workspace precedence tier 1, managed Codex app-server0.153.4, modelopenai/gpt-5.6-solover the OpenAI Platform Responses API. No gateway was started or modified.The prompt, verbatim and complete — it names no skill, no skill system, and no path:
The model's first tool call, verbatim from the Codex rollout transcript:
immediately preceded by:
That path is byte-identical to the
<location>inside the<available_skills>block delivered in the thread developer instructions — the carrier this PR introduces:Catalog delivered in the thread carrier → model selected
weatherfrom it → model read exactly that path → model followed the skill's own method (livewttr.infetches) → answered. Five real tool calls, real network responses.Meanwhile, in the same turn,
turn_context.collaboration_mode.settings.developer_instructionswas 1288 chars of Codex's own model-owned Default policy and contained no<available_skills>— which is precisely the PR's premise that this slot is model-owned and unsuitable as the catalog carrier.One honest negative. A pre-fix contrast build (this branch with the two skill commits reverted) was run on the identical conversation, and it also delivered the catalog and read the skill. On
gpt-5.6-solover the API-key route, Codex0.153.4composed the caller's collaboration instructions with a shorter model-owned policy rather than replacing them, so the old carrier was not broken on that route. The catalog-drop reproduction therefore still rests on the packaged-binary native test and on Codex's documented precedence (collaboration_mode.rs:30-42), not on this live run. The live run proves the fixed behaviour end to end; it does not independently reproduce the original defect.Change surface
Production +124/−34 (net +90), tests +487/−11, docs +23/−10, across 25 files. The earlier revision was a net −4 production change; the incognito lifecycle repair is why production grew — the catalog became a first-class lifecycle input with its own refresh path rather than a string concatenation.
Docs
docs/plugins/codex-harness-runtime.mdcontradictedcodex-harness-reference.mdabout the skill carrier. Both now describe the thread carrier and the refresh semantics. Two further stale statements of the same claim were corrected indocs/concepts/system-prompt.mdanddocs/reference/token-use.md.Remaining acceptance
The native-child scope question above is the one open item that needs a maintainer, not more evidence.
The same replaceable carrier is also used for persona/memory/cron overlays. Those are deliberately not moved in this skills-only repair; their root-local delivery contract is a separate follow-up.
AI-assisted contribution prepared by Rook, submitted at the operator's explicit request.