Skip to content

fix(codex): list skills by name when skills_read can load them - #206995

Merged
obviyus merged 2 commits into
mainfrom
core/codex-skills-catalog
Nov 27, 2026
Merged

obviyus merged 2 commits into
mainfrom
core/codex-skills-catalog

Conversation

@obviyus

@obviyus obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Codex runtime sends a 13.8 KB <thread_policy> developer message on every request. 9.5 KB of it is the full <available_skills> catalog: name, description and file location for every installed skill.

The embedded runtime stopped doing this in #206537. When skills_read loads a skill by name, the location is unused. When skills_search is callable, it matches descriptions on demand. The Codex plugin renders its own catalog section and kept the full form.

Measured on main e916ef677a95 through an isolated Gateway: <thread_policy> 13,801 B, of which <available_skills> 9,469 B.

Solution

renderCodexSkillsInstructions (extensions/codex/src/app-server/attempt-context.ts) passes the catalog through the core owner compactCatalogForSkillRead, as the embedded route does:

  • skills_read and skills_search callable: names only;
  • only skills_read callable: names and descriptions;
  • skills_read not callable: unchanged XML with locations. The Gateway-only location rewrite still runs for remote workspaces.

compactCatalogForSkillRead is added to openclaw/plugin-sdk/agent-harness-runtime, next to the other harness prompt builders.

User impact

  • Population: every Codex-runtime turn with installed skills (Gateway and one-shot).
  • <thread_policy>: 13,801 → 4,511 B per request (−9,290 B).
  • No change to which skills exist or how they load.
  • Existing threads see the changed instructions on their next cold resume: one prompt-cache miss per thread.

Evidence

  • Isolated Gateway bench, fake provider: <thread_policy> 13,801 → 4,511 B; tool schemas unchanged.
  • Codex-route behavior suite, gpt-5.4-mini, 3 trials per case, model-judged:
    • main 24/30, this PR 26/30;
    • skill loading 3/3 on both, through the same path (skills_read first in 6 of 6 trials, no extra tool search);
    • reply-directive 0/3 on both: an existing Codex-route gap, not caused here.
  • Tests: dynamic-tool-skills.test.ts, run-attempt.remote-skills.test.ts and run-attempt.skills.native.test.ts pass. plugin-sdk:check-exports passes.
  • Local ClawSweeper on this head: patch is correct, no findings.

- Render the Codex skills catalog through the core owner compactCatalogForSkillRead, as the embedded route does: names only when skills_search is callable, names plus descriptions otherwise.
- Locations go when skills_read resolves by name, so the Gateway-only location rewrite now runs only when skills_read is unavailable.
- The full catalog was 9.5 KB of the 13.8 KB <thread_policy> sent on every Codex request.
…able

- Read-enabled remote catalogs drop paths and the Gateway-only note; the no-read fallback keeps them.
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

The Codex plugin reuses core skill-catalog compaction according to whether skills_read and skills_search are available.

Example: Codex has skills_read and skills_search available and an installed release-guide skill.

  • Before: The catalog includes release-guide, its description, and its SKILL.md location.
  • After: The catalog lists - "release-guide", with full instructions available through skills_read.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and source-consistent, while the reported runtime results lack inspectable supporting output.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Codex users repeatedly pay context cost for skill locations and descriptions already available through callable tools.
Reason: The focused change extends an existing optimization through its current owner, retains loading fallbacks, and adds no configuration or persisted state.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a useful, focused improvement that current main still lacks; no introduced correctness defect was found.

Reviewed head: 2ed7768db05bca150440db187550ab8304bcd183

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Codex adapter combines the prepared skill catalog with callable tool names to produce developer instructions sent to the native app-server.

flowchart TD
  A[Prepared skill catalog] --> C[Codex instruction renderer]
  B[Callable dynamic tools] --> C
  C --> D[Shared catalog compactor]
  D --> E[Native thread instructions]
  E --> F[Codex model]
  F --> G[Host skill tools]
Loading

Technical review

Best possible solution:

Use the existing core compactor in the Codex renderer while preserving capability-dependent descriptions and no-read location handling.

Do we have a high-confidence way to reproduce the issue?

Source inspection establishes that current main retains full skill metadata in Codex instructions even when host skill tools can supply it on demand; no runtime reproduction was executed.

Is this the best way to solve the issue?

Reusing the established compactor is the smallest complete change and avoids the parallel parser and unconditional loading assumptions in the earlier proposal.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 519d22d2ca15.

Provenance checked

  • Remote Gateway-only skill locations keeps the original intent (44f24d8: Remote native file tools cannot read Gateway library paths, so the catalog must direct readers to host tools or explain unavailability.)
  • Capability-aware catalog compaction keeps the original intent (perf(agents): render the system prompt from one manifest and halve it #206537: Remove redundant locations and descriptions while retaining descriptions when search cannot provide selection information.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 219b6b0 adds src/agents/system-prompt-skills.ts:7 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 219b6b0f8025; files: src/agents/system-prompt-skills.ts)
  • Free Wortley: Raw commit 44f24d8 adds extensions/codex/src/app-server/attempt-context.ts:456 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 44f24d839842; files: extensions/codex/src/app-server/attempt-context.ts)

PR surface

Source +3, Tests +24. Total +27 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 16 13 +3
Tests 2 26 2 +24
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 42 15 +27

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The PR adds a supported Plugin SDK export; this is additive, preserves existing signatures, and has direction approval through maintainer authorship.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • merge-risk: 🚨 compatibility: The PR adds a supported Plugin SDK export; this is additive, preserves existing signatures, and has direction approval through maintainer authorship.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Attach the existing redacted runtime capture connecting compact Codex instructions to successful skill loading.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 27, 2026, 6:14 PM ET / 23:14 UTC.

@obviyus
obviyus merged commit f538874 into main Nov 27, 2026
137 checks passed
@obviyus
obviyus deleted the core/codex-skills-catalog branch November 27, 2026 23:18
obviyus added a commit that referenced this pull request Nov 28, 2026
…lot (#207061)

## Problem
- `AgentHarnessSideQuestionRequest` was published in the Plugin SDK (#205963) only so the bundled Copilot plugin could name its side-question request. It has no other consumer.
- Main's SDK budget check is red: #206995 added `compactCatalogForSkillRead` to `agent-harness-runtime` (consumer: bundled Codex harness) without a budget line.

## Change
- Copilot declares its own `CopilotSideQuestionRequest`, the same four fields. The SDK export is removed.
- Budgets: public −1 (the type) +1 (`compactCatalogForSkillRead`) = 3932, unchanged. Callable +1 = 2260, recorded with a budget line like `hasReplyRestartResume`.

## User impact
None. The type is structural, so Copilot side questions send the same request.

## Evidence
- ClawHub `sdk-export:openclaw/plugin-sdk/agent-harness-runtime#AgentHarnessSideQuestionRequest`: 0 public consumers (2338 complete / 432 partial / 3 failed coverage). The only bundled consumer is Copilot, migrated here. The export is in no released tag.
- `pnpm plugin-sdk:surface:check`: pass (`no unauthorized removals`). `tsgo:extensions`: clean.
- Copilot `side-question.test.ts`, `isolated-completion.*.test.ts`: 8/8 pass.
- Adversarial review (Fable): no finding. The local type assigns both ways to the host's `prepareRequest`.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 28, 2026
## Problem

#206995 added a Plugin SDK export without a surface budget line and merged with green PR CI. Main's SDK surface check then failed (`public exports 3933 > 3932`, `public callable exports 2260 > 2259`) until a follow-up added the line.

Why PR CI did not catch it:
- `check:changed` selects `plugin-sdk:check-exports` and `plugin-sdk:surface:check` for SDK paths. But PR CI calls it lint-only (`ci.yml`, "Run changed lint", `lintOnly: true`), so only lint commands run.
- The only other runner is the `generated-doc-baselines` job in `workflow-sanity.yml`. It runs only on `workflow_dispatch`, never on a pull request.

## Fix

The baseline-ratchets job (`scripts/ci-baseline-ratchets.mts`) already runs on every node PR. It now also runs `plugin-sdk:check-exports` and `plugin-sdk:surface:check` on every run:
- The surface check is a large TypeScript program, so it runs in the same slot as the database-worker and database-dialect snapshots. They run one after another and never overlap (the memory rule from `c695d653`). The export check is light and joins the shared queue.
- It runs on every PR, not only SDK-path PRs: the SDK import closure reaches far outside `src/plugin-sdk`. For example, adding `@deprecated` to `src/channels/chat-type.ts` moves the deprecated-export count, and no changed-path rule sees that.

No new workflow or job.

## Impact

Contributors: a PR that changes the SDK export surface without its budget line now fails `checks-fast-baseline-ratchets` instead of turning main red after merge. Cost per PR: one surface check (about 7 s and 3.5 GB peak locally) in the existing job.

## Evidence

- Red/green on a PR-like change set: a scratch copy of main with #206995's export added on top of a tagged base, run with `pnpm check:baseline-ratchets --base <base> --no-merge-base`:
  - a new SDK function without a budget line: `plugin-sdk-surface` fails, `public exports 3933 > 3932`, `public callable exports 2261 > 2260`, exit 1;
  - the same change plus the budget lines: `[ok] plugin-sdk-exports`, `[ok] plugin-sdk-surface`, exit 0.
- `test/scripts/ci-baseline-ratchets.test.ts`: the expected command list now includes both SDK checks in their slots (4/4).
- Adversarial review: a first version selected the checks by changed path. The review showed that version missed real budget inputs outside `src/plugin-sdk` and reproduced a miss. This version drops path selection.
- Local review on this head: patch is correct, 0 findings.
- CI cost on this PR's runner: `plugin-sdk-surface` 8.48 s and `plugin-sdk-exports` 0.28 s inside `checks-fast-baseline-ratchets`, which took 4m50s in total.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…law#206995)

## Problem

The Codex runtime sends a 13.8 KB `<thread_policy>` developer message on every request. 9.5 KB of it is the full `<available_skills>` catalog: name, description and file location for every installed skill.

The embedded runtime stopped doing this in openclaw#206537. When `skills_read` loads a skill by name, the location is unused. When `skills_search` is callable, it matches descriptions on demand. The Codex plugin renders its own catalog section and kept the full form.

Measured on main `a62d6b8eff91` through an isolated Gateway: `<thread_policy>` 13,801 B, of which `<available_skills>` 9,469 B.

## Solution

`renderCodexSkillsInstructions` (`extensions/codex/src/app-server/attempt-context.ts`) passes the catalog through the core owner `compactCatalogForSkillRead`, as the embedded route does:

- `skills_read` and `skills_search` callable: names only;
- only `skills_read` callable: names and descriptions;
- `skills_read` not callable: unchanged XML with locations. The Gateway-only location rewrite still runs for remote workspaces.

`compactCatalogForSkillRead` is added to `openclaw/plugin-sdk/agent-harness-runtime`, next to the other harness prompt builders.

## User impact

- Population: every Codex-runtime turn with installed skills (Gateway and one-shot).
- `<thread_policy>`: 13,801 → 4,511 B per request (−9,290 B).
- No change to which skills exist or how they load.
- Existing threads see the changed instructions on their next cold resume: one prompt-cache miss per thread.

## Evidence

- Isolated Gateway bench, fake provider: `<thread_policy>` 13,801 → 4,511 B; tool schemas unchanged.
- Codex-route behavior suite, gpt-5.4-mini, 3 trials per case, model-judged:
  - main 24/30, this PR 26/30;
  - skill loading 3/3 on both, through the same path (`skills_read` first in 6 of 6 trials, no extra tool search);
  - reply-directive 0/3 on both: an existing Codex-route gap, not caused here.
- Tests: `dynamic-tool-skills.test.ts`, `run-attempt.remote-skills.test.ts` and `run-attempt.skills.native.test.ts` pass. `plugin-sdk:check-exports` passes.
- Local ClawSweeper on this head: patch is correct, no findings.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…lot (openclaw#207061)

## Problem
- `AgentHarnessSideQuestionRequest` was published in the Plugin SDK (openclaw#205963) only so the bundled Copilot plugin could name its side-question request. It has no other consumer.
- Main's SDK budget check is red: openclaw#206995 added `compactCatalogForSkillRead` to `agent-harness-runtime` (consumer: bundled Codex harness) without a budget line.

## Change
- Copilot declares its own `CopilotSideQuestionRequest`, the same four fields. The SDK export is removed.
- Budgets: public −1 (the type) +1 (`compactCatalogForSkillRead`) = 3932, unchanged. Callable +1 = 2260, recorded with a budget line like `hasReplyRestartResume`.

## User impact
None. The type is structural, so Copilot side questions send the same request.

## Evidence
- ClawHub `sdk-export:openclaw/plugin-sdk/agent-harness-runtime#AgentHarnessSideQuestionRequest`: 0 public consumers (2338 complete / 432 partial / 3 failed coverage). The only bundled consumer is Copilot, migrated here. The export is in no released tag.
- `pnpm plugin-sdk:surface:check`: pass (`no unauthorized removals`). `tsgo:extensions`: clean.
- Copilot `side-question.test.ts`, `isolated-completion.*.test.ts`: 8/8 pass.
- Adversarial review (Fable): no finding. The local type assigns both ways to the host's `prepareRequest`.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…aw#207167)

## Problem

openclaw#206995 added a Plugin SDK export without a surface budget line and merged with green PR CI. Main's SDK surface check then failed (`public exports 3933 > 3932`, `public callable exports 2260 > 2259`) until a follow-up added the line.

Why PR CI did not catch it:
- `check:changed` selects `plugin-sdk:check-exports` and `plugin-sdk:surface:check` for SDK paths. But PR CI calls it lint-only (`ci.yml`, "Run changed lint", `lintOnly: true`), so only lint commands run.
- The only other runner is the `generated-doc-baselines` job in `workflow-sanity.yml`. It runs only on `workflow_dispatch`, never on a pull request.

## Fix

The baseline-ratchets job (`scripts/ci-baseline-ratchets.mts`) already runs on every node PR. It now also runs `plugin-sdk:check-exports` and `plugin-sdk:surface:check` on every run:
- The surface check is a large TypeScript program, so it runs in the same slot as the database-worker and database-dialect snapshots. They run one after another and never overlap (the memory rule from `4d6287da`). The export check is light and joins the shared queue.
- It runs on every PR, not only SDK-path PRs: the SDK import closure reaches far outside `src/plugin-sdk`. For example, adding `@deprecated` to `src/channels/chat-type.ts` moves the deprecated-export count, and no changed-path rule sees that.

No new workflow or job.

## Impact

Contributors: a PR that changes the SDK export surface without its budget line now fails `checks-fast-baseline-ratchets` instead of turning main red after merge. Cost per PR: one surface check (about 7 s and 3.5 GB peak locally) in the existing job.

## Evidence

- Red/green on a PR-like change set: a scratch copy of main with openclaw#206995's export added on top of a tagged base, run with `pnpm check:baseline-ratchets --base <base> --no-merge-base`:
  - a new SDK function without a budget line: `plugin-sdk-surface` fails, `public exports 3933 > 3932`, `public callable exports 2261 > 2260`, exit 1;
  - the same change plus the budget lines: `[ok] plugin-sdk-exports`, `[ok] plugin-sdk-surface`, exit 0.
- `test/scripts/ci-baseline-ratchets.test.ts`: the expected command list now includes both SDK checks in their slots (4/4).
- Adversarial review: a first version selected the checks by changed path. The review showed that version missed real budget inputs outside `src/plugin-sdk` and reproduced a miss. This version drops path selection.
- Local review on this head: patch is correct, 0 findings.
- CI cost on this PR's runner: `plugin-sdk-surface` 8.48 s and `plugin-sdk-exports` 0.28 s inside `checks-fast-baseline-ratchets`, which took 4m50s in total.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
## Problem

#206995 added a Plugin SDK export without a surface budget line and merged with green PR CI. Main's SDK surface check then failed (`public exports 3933 > 3932`, `public callable exports 2260 > 2259`) until a follow-up added the line.

Why PR CI did not catch it:
- `check:changed` selects `plugin-sdk:check-exports` and `plugin-sdk:surface:check` for SDK paths. But PR CI calls it lint-only (`ci.yml`, "Run changed lint", `lintOnly: true`), so only lint commands run.
- The only other runner is the `generated-doc-baselines` job in `workflow-sanity.yml`. It runs only on `workflow_dispatch`, never on a pull request.

## Fix

The baseline-ratchets job (`scripts/ci-baseline-ratchets.mts`) already runs on every node PR. It now also runs `plugin-sdk:check-exports` and `plugin-sdk:surface:check` on every run:
- The surface check is a large TypeScript program, so it runs in the same slot as the database-worker and database-dialect snapshots. They run one after another and never overlap (the memory rule from `c695d653`). The export check is light and joins the shared queue.
- It runs on every PR, not only SDK-path PRs: the SDK import closure reaches far outside `src/plugin-sdk`. For example, adding `@deprecated` to `src/channels/chat-type.ts` moves the deprecated-export count, and no changed-path rule sees that.

No new workflow or job.

## Impact

Contributors: a PR that changes the SDK export surface without its budget line now fails `checks-fast-baseline-ratchets` instead of turning main red after merge. Cost per PR: one surface check (about 7 s and 3.5 GB peak locally) in the existing job.

## Evidence

- Red/green on a PR-like change set: a scratch copy of main with #206995's export added on top of a tagged base, run with `pnpm check:baseline-ratchets --base <base> --no-merge-base`:
  - a new SDK function without a budget line: `plugin-sdk-surface` fails, `public exports 3933 > 3932`, `public callable exports 2261 > 2260`, exit 1;
  - the same change plus the budget lines: `[ok] plugin-sdk-exports`, `[ok] plugin-sdk-surface`, exit 0.
- `test/scripts/ci-baseline-ratchets.test.ts`: the expected command list now includes both SDK checks in their slots (4/4).
- Adversarial review: a first version selected the checks by changed path. The review showed that version missed real budget inputs outside `src/plugin-sdk` and reproduced a miss. This version drops path selection.
- Local review on this head: patch is correct, 0 findings.
- CI cost on this PR's runner: `plugin-sdk-surface` 8.48 s and `plugin-sdk-exports` 0.28 s inside `checks-fast-baseline-ratchets`, which took 4m50s in total.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit 7c16b31)

Release adaptation: Add both existing SDK checks without overlapping the large SDK surface check with either large database check.

Follow-up audit: No required nonselected PR/SHA follow-up. Other same-path candidates (9c9e3c7) are not selected prerequisites in the source assessment; owner proof below checks the selected stable contract.

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant