Repository navigation
fix(codex): restore installed skills with catalog-backed models - #140422
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 24, 2026, 5:16 PM ET / 21:16 UTC (Revision 11). ClawSweeper reviewWhat this changesThe Codex plugin carries installed-skill catalogs in thread instructions when no managed inference relay is available, refreshes them across thread reuse and compaction, and retains parent-only request delivery on managed connections. Merge readiness⛔ Blocked before merge - 4 items remain Current Priority: P2 Review scores
Verification
How this fits togetherThe Codex plugin turns an OpenClaw skill snapshot into instructions sent through the Codex app server. The selected connection determines whether the catalog reaches only the parent model request or becomes part of native thread context. flowchart LR
A[Installed skills] --> B[OpenClaw skill snapshot]
B --> C{Managed inference relay?}
C -->|Yes| D[Parent request instructions]
C -->|No| E[Codex thread instructions]
E --> F[Refresh after reuse or compaction]
D --> G[Model request]
F --> G
Decision needed
Why: The branch repairs a real delivery gap, but its native carrier has scope and freshness semantics different from the shipped managed path; code review cannot decide whether that product tradeoff is acceptable. Before merge
Agent review detailsSecurityNone. PR surfaceSource +216, Tests +1035, Docs +26. Total +1277 across 38 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep managed delivery parent-only and request-local; use the fallback only with an explicit maintainer decision on child inheritance and compaction timing, documented as user-visible limits. Do we have a high-confidence way to reproduce the issue? Yes from source: on current Is this the best way to solve the issue? Yes as a bounded technical repair: the branch leaves managed parent-only delivery in place and uses the existing thread carrier for uncovered connections. Acceptance of that carrier's child and compaction semantics remains a product choice. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 30e67dbd5fe6. LabelsLabel changes: No label changes. Label 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 (10 earlier review cycles; latest 8 shown)
|
|
I can confirm that I also have this issue |
aa64f4d to
135dbba
Compare
135dbba to
37dd066
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4c77da3 to
3e3a2da
Compare
|
Issue seem to be fixed by #142276 |
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).
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).
Extract joinPresentSections into a zero-import leaf module so thread-requests.ts no longer imports run-attempt-state.ts, which closed a 10-file strongly connected component in extensions/codex/src/app-server. The merge base is clean, so the cycle was introduced by this branch. Register the two new skills test files in the vitest project that already owns the comparable run-attempt.native-hook-relay test, so full-suite file ownership is exactly one project per file.
An incognito thread carries its skill catalog in creation-time native developer instructions. A mid-session catalog change is delivered as a client-authored developer message, but Codex remote compaction drops those messages unless retain_client_developer_messages is enabled (off by default) and rebuilds initial context from the unchanged native instructions. The host had already recorded the refreshed catalog as delivered, so later turns skipped reinjection and the conversation silently reverted to the catalog it started with: edited skills kept stale descriptions and removed skills stayed visible. Track the creation-time catalog separately from the current one and re-deliver the current catalog after every compaction, including compaction inside a turn, via the existing onContextCompacted hook. An unchanged catalog still sends nothing, because compaction rebuilds it natively.
Drive the packaged Codex app-server binary through a real compaction on a live incognito thread: turn two refreshes the catalog, turn three exceeds the resolved auto-compact limit, and turn four must still show the model the current catalog. The continuation request after summarization is asserted to carry the creation-time catalog and not the refresh, which reproduces the reversion natively. The creation-time catalog stays in the ephemeral thread's immutable developer instructions and is re-emitted on every request, so restoration is pinned by catalog ordering rather than absence. Pin nativeSkillsInstructions in the ephemeral policy binding assertions so a refresh is shown never to rewrite what compaction will restore.
…tore A failed or aborted restore was logged and dropped while the retained record still named the refreshed catalog as delivered. Warm reuse compares that record, so every later turn skipped the refresh and the conversation stayed stranded on the creation-time catalog for the rest of its life. Record what compaction actually restored when the injection fails, so the next turn delivers the current catalog again.
The restore is issued as soon as a compaction completes, but that turn's own continuation request may already have been built, so the guaranteed floor is the following request rather than the remainder of the compacting turn.
Standalone compaction re-retained the live thread without its ephemeral policy, so the record lost the creation-time generic policy and the catalog it had delivered. The next turn then read the live incognito thread as policy drift, and the discarded catalog refresh was never re-sent. Carry the ephemeral policy back through the re-retain and record the catalog compaction actually restored, so an edited or withdrawn skill is delivered again on the next turn instead of reverting for the rest of the conversation.
Standalone compaction only claims and re-retains a thread for non-incognito session keys, so the previous reversion never ran for the conversations it was written for. An incognito thread keeps its own live subscription, leaving the retained record still naming the discarded refresh as delivered. Correct the retained record in place after a completed compaction, and cover both session kinds so an incognito key can no longer be masked by an ordinary one in the regression.
The three post-compaction catalog re-delivery tests never observed `thread/inject_items`, which read as the repair being broken. It was not. Compaction runs the real `before_compaction` hook, which performs an actual mirrored-session history read; its first worker start costs several seconds. `createParams` defaults `timeoutMs` to 5s, so the attempt execution budget expired inside that read, aborted projection, and the `onContextCompacted` restore never ran -- reproducing precisely the symptom these tests assert against. Give these turns the same budget the sibling compaction tests already use in `run-attempt.skills.native.test.ts` and `run-attempt.hooks.test.ts`. Every assertion is unchanged.
3483e61 to
371c186
Compare
…claw#140422) * fix(codex): restore installed skills with catalog-backed models * fix(codex): keep skill catalog refreshable on live incognito threads 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). * test(codex): cover catalog refresh on reused persistent threads 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 1e6e072 (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). * fix(codex): break app-server import cycle and register skills test lanes Extract joinPresentSections into a zero-import leaf module so thread-requests.ts no longer imports run-attempt-state.ts, which closed a 10-file strongly connected component in extensions/codex/src/app-server. The merge base is clean, so the cycle was introduced by this branch. Register the two new skills test files in the vitest project that already owns the comparable run-attempt.native-hook-relay test, so full-suite file ownership is exactly one project per file. * fix(codex): keep refreshed incognito skill catalogs across compaction An incognito thread carries its skill catalog in creation-time native developer instructions. A mid-session catalog change is delivered as a client-authored developer message, but Codex remote compaction drops those messages unless retain_client_developer_messages is enabled (off by default) and rebuilds initial context from the unchanged native instructions. The host had already recorded the refreshed catalog as delivered, so later turns skipped reinjection and the conversation silently reverted to the catalog it started with: edited skills kept stale descriptions and removed skills stayed visible. Track the creation-time catalog separately from the current one and re-deliver the current catalog after every compaction, including compaction inside a turn, via the existing onContextCompacted hook. An unchanged catalog still sends nothing, because compaction rebuilds it natively. * test(codex): cover catalog restoration across native compaction Drive the packaged Codex app-server binary through a real compaction on a live incognito thread: turn two refreshes the catalog, turn three exceeds the resolved auto-compact limit, and turn four must still show the model the current catalog. The continuation request after summarization is asserted to carry the creation-time catalog and not the refresh, which reproduces the reversion natively. The creation-time catalog stays in the ephemeral thread's immutable developer instructions and is re-emitted on every request, so restoration is pinned by catalog ordering rather than absence. Pin nativeSkillsInstructions in the ephemeral policy binding assertions so a refresh is shown never to rewrite what compaction will restore. * fix(codex): re-deliver the catalog after a failed post-compaction restore A failed or aborted restore was logged and dropped while the retained record still named the refreshed catalog as delivered. Warm reuse compares that record, so every later turn skipped the refresh and the conversation stayed stranded on the creation-time catalog for the rest of its life. Record what compaction actually restored when the injection fails, so the next turn delivers the current catalog again. * docs(codex): state catalog restore timing precisely The restore is issued as soon as a compaction completes, but that turn's own continuation request may already have been built, so the guaranteed floor is the following request rather than the remainder of the compacting turn. * fix(codex): keep incognito creation policy across standalone compaction Standalone compaction re-retained the live thread without its ephemeral policy, so the record lost the creation-time generic policy and the catalog it had delivered. The next turn then read the live incognito thread as policy drift, and the discarded catalog refresh was never re-sent. Carry the ephemeral policy back through the re-retain and record the catalog compaction actually restored, so an edited or withdrawn skill is delivered again on the next turn instead of reverting for the rest of the conversation. * fix(codex): revert the catalog on the incognito compaction path Standalone compaction only claims and re-retains a thread for non-incognito session keys, so the previous reversion never ran for the conversations it was written for. An incognito thread keeps its own live subscription, leaving the retained record still naming the discarded refresh as delivered. Correct the retained record in place after a completed compaction, and cover both session kinds so an incognito key can no longer be masked by an ordinary one in the regression. * fix(codex): preserve trajectory helper import after rebase * test(codex): budget the compaction history read in skill catalog tests The three post-compaction catalog re-delivery tests never observed `thread/inject_items`, which read as the repair being broken. It was not. Compaction runs the real `before_compaction` hook, which performs an actual mirrored-session history read; its first worker start costs several seconds. `createParams` defaults `timeoutMs` to 5s, so the attempt execution budget expired inside that read, aborted projection, and the `onContextCompacted` restore never ran -- reproducing precisely the symptom these tests assert against. Give these turns the same budget the sibling compaction tests already use in `run-attempt.skills.native.test.ts` and `run-attempt.hooks.test.ts`. Every assertion is unchanged. * fix(codex): preserve parent-only skills on managed connections * test(codex): validate managed instructions before collection --------- Co-authored-by: Rook <[email protected]> Co-authored-by: Colton Harris <[email protected]> Co-authored-by: jalehman <[email protected]>
Related: #95058.
What Problem This Solves
Installed OpenClaw skills can disappear from the model-facing prompt on Codex connections without a managed inference relay: model-owned collaboration instructions replace the field that previously carried the catalog. Skill discovery and prompt accounting can still report success while the model sees no catalog.
Why This Change Was Made
Preserve the shipped managed behavior and repair only the uncovered delivery path:
User Impact and Limits
Managed users retain parent-only skill scope and request-local freshness. Users of uncovered connections receive installed skills even with catalog-backed collaboration instructions.
The fallback still has explicit native-runtime limits: children can inherit its thread catalog; an automatic compaction's immediate continuation can see the creation-time catalog before restoration reaches the following request; lightweight cron turns sharing a fallback thread withdraw the catalog until the next ordinary turn. These are not changes to managed connections. Persona and memory delivery are outside this skills-only repair.
Review Feedback Addressed
Rebase
Rebased onto main at
1514b7c4b5c120ebe201d042400ffa345381f19a; candidate head371c1866dd0a66af15e234590d7a7de0d73831af. Preserved the contributor commits. Resolved the standalone-compaction conflict by retaining main'scanRetainThreadOwnershipsafety gate and tracking successful native compaction separately for catalog invalidation. This preserves rejection/uncertain-start cleanup and refreshes the catalog after completed compaction, including incognito threads. The previous upstream CI inventory repairs are included through the new base.Evidence
Current rebased head
tsconfig.extensions.jsonandtest/tsconfig/tsconfig.extensions.test.json.git diff --checkpassed.extensions/tsconfig.json) and produced graph/root-directory errors. Both actual production/test type-check entry points above passed. No product or test changes were needed.scoped-clean, no actionable P0–P2 findings. Static review covered the complete rebased diff; runtime evidence is the checks above. Hosted CI for head371c1866dd0a66af15e234590d7a7de0d73831afis green: 77 successful checks, 48 skipped, no failed or pending checks, includingopenclaw/ci-gate.Earlier implementation evidence
CI lint follow-up
Commit
8b666705896removes the test's object-to-string coercion and explicitly requires string instructions before collecting them. The exacttypescript(no-base-to-string)error reproduced before the repair. Type-aware oxlint with--tsconfig extensions/tsconfig.jsonnow passes (zero warnings/errors), as do formatting andgit diff --check. All five tests inrun-attempt.skills.test.tspass with--maxWorkers=1(17.04 s runner wall; 4.205 s test execution). Earlier broader runtime/review evidence below applies to the preceding implementation; this follow-up changes only the test's string validation.The lint fix passed hosted CI. The remaining tooling failure was the extracted wrapper inventory omitting
src/config/config-journal-snapshot.kernel.ts, introduced by an upstream config-journal refactor. Main repaired it in5b210a8eea758c654ba2fe07bd834805936a9df8; the previous branch head merged main through that exact commit, also incorporating the earliercli-root-optionsinventory repair. That earlier merge was conflict-free and preserved contributor history; the current rebase includes the same repairs through its base.Post-merge local proof: all 18 tests in
eager-import-closure.test.tsandpr-wrapper-source-closure.test.tspassed (25.98 s runner wall), including the exact CI failure. All 255 tests acrossthread-lifecycle.binding.test.ts,run-attempt.skills.test.ts, andrun-attempt.skills.native.test.tspassed (88.86 s runner wall). Production extension type checking andgit diff --checkpassed. Fresh independent integration review found no actionable P0–P2 issues (scoped-clean, static review of the candidate against the merged base). New-head hosted CI is pending; this does not claim a green full CI run.test/vitest-projects-config.test.ts; the new tests are owned exactly once by the current database-worker project (84.95 s command wall).tsgo:extensions,tsgo:extensions:test).oxlintandoxfmt --check,git diff --check, both import-cycle checks passed. Documentation link audit: 14,554 checked, zero broken.scoped-clean, patch correct). This was a static diff review; runtime evidence comes from the checks above.Measured per-file test execution cost (
--maxWorkers=1, excluding shared transform/setup):client-runtime.test.tscompact.test.tsrun-attempt.skills.native.test.tsrun-attempt.skills.test.tsrun-attempt.test.tsthread-lifecycle.binding.test.tsthread-lifecycle.native-config.test.tsthread-lifecycle.test.tsThe native fixture proves the real Codex-to-Responses carrier and compaction contract; a mocked discovery test cannot substitute. CI duration is pending this push. An initial isolated test startup refused a concurrent lockfile stat change before executing tests; the final direct-Node run avoided package-manager reconciliation and passed. Type errors from moved helpers/callers and module-size lint findings found during rebase were fixed, not suppressed.
The packaged-native regression inspects actual loopback Responses request bodies with a synthetic model-owned collaboration catalog, then exercises native compaction after skill edits and withdrawal. The managed regression drives the production attempt and inference context, checks the outgoing parent body, excludes the catalog from child/compaction bodies and native thread requests, and verifies refresh plus lightweight omission without thread recreation.
No production Gateway or real user session was modified. Merge authorized by Josh Lehman on 2026-09-24 after accepting the documented fallback limitations.