Skip to content

feat(codex): pass explicit skill selections as structured turn input - #123441

Merged
steipete merged 2 commits into
mainfrom
steipete/issue-123367-phase2-codex-skill-inputs
Aug 14, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/issue-123367-phase2-codex-skill-inputs

Conversation

@steipete

@steipete steipete commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #123367 (Phase 2, final phase)

What Problem This Solves

Phase 1 (#123387) made explicit $skill-name references resolve on every channel via the reply-pipeline instruction block. On the Codex app-server harness, Codex's own byte scanner also selects skills it discovers from the same $ tokens, so a skill known to both products was handled twice (OpenClaw instruction + Codex native body injection), and OpenClaw had no way to hand Codex a structured, provenance-clean selection.

Why This Change Was Made

OpenClaw-resolved selections now travel as data (ExplicitSkillSelection { name, path }) from the inline-action resolver through the queue/drain and embedded-runner params to the Codex adapter, which matches them against the Codex catalog (skills/list, path-matched, enabled-only) and appends structured UserInput::Skill items to the turn input. Codex contract (verified in codex-rs at 91d6f48992ad): UserInput::Skill exists in the v2 app-server protocol (app-server-protocol/src/protocol/v2/turn.rs:292-324) and structured skill inputs add their names to blocked_plain_names (skills/src/selection.rs:60-92), so Codex's text scanner cannot double-select the same skill while Codex-native-only names stay scannable. Catalog misses and RPC errors fail open to the instruction path — the turn never fails on skill lookup, and the instruction block keeps owning skills Codex cannot see.

One red-main heal rides this PR per landing policy:

  • fix(plugins): llama-cpp's llama-server-install.ts statically imported the ssrf-runtime barrel inside the doctor/legacy-setup closure (landed with refactor(plugins): replace node-llama-cpp with managed llama-server #123105), failing the doctor-contract closure guard whenever a PR selects that lane. Deferred to a dynamic import at download time, the guard's stated remedy.
  • (An initial lane-ownership heal for run-attempt-state.test.ts was superseded mid-flight by c28e9a4 on main, which settled ownership on the attempt-light lane; the commit was dropped from this PR after verifying the audit is green on the rebased head.)

User Impact

Codex-harness agents get native skill injection for explicitly referenced skills with no double selection; behavior on other harnesses is unchanged. No config surface added.

Evidence

  • Focused suites green: explicit-skill-input (stub client: match, disabled/unmatched skip, RPC-error fail-open, no-RPC-on-empty), turn-params shape, inline-actions selection capture, queue media-carrier merge — 169 tests across 4 files; ownership audit 21 passed (fails on current origin/main, proving the heal); doctor closure guard + llama-cpp suites green post-heal.
  • pnpm plugin-sdk:surface:check passed (field flows structurally; no regen needed).
  • Codex autoreview clean (gpt-5.6-sol, high): "patch is correct (0.98)".
  • Production LOC ~+115/−9 (new capability: structured selection threading + codex matcher); tests +172/−5.

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 14, 2026 02:59
Thread OpenClaw-resolved explicit $skill selections through the reply
pipeline to the Codex app-server harness and emit them as structured
UserInput::Skill turn items when the Codex catalog (skills/list) knows the
same SKILL.md path. Codex then injects the skill natively and blocks its
text scanner from double-selecting the same name, while unmatched names
stay scannable for Codex-native-only skills and the prompt instruction
block keeps owning skills Codex cannot see. Catalog misses and RPC errors
fail open to the instruction path; the turn never fails on skill lookup.

Part of #123367
The doctor-contract closure guard forbids the SSRF barrel in the
doctor/legacy-setup closure (cold-loads DNS, proxy state, logging); the
static import landed with the managed llama-server switch (#123105) and
first fails when a PR selects the guard lane. Defer to a dynamic import at
download time per the guard's stated remedy.
@steipete
steipete force-pushed the steipete/issue-123367-phase2-codex-skill-inputs branch from 87c0098 to 4986384 Compare August 14, 2026 03:14
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 11:16 PM ET / August 14, 2026, 03:16 UTC.

ClawSweeper review

What this changes

The PR passes explicitly resolved inbound skill references through the embedded-runner flow into Codex app-server turns as structured skill inputs, while moving llama-cpp’s SSRF helper import to actual download time.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review. This protected maintainer PR implements the remaining phase of the canonical skill-reference work, but the review environment could not read the checkout or directly inspect the affirmative Codex app-server protocol dependency, so no safe correctness or merge verdict is possible.

Priority: P2
Reviewed head: 4986384600d81c38022fbb326b7d847dc7fcf479
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The proposal has a coherent scoped design and stated tests, but independent source and Codex-contract verification were unavailable.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned PR is not subject to the external-contributor real-behavior-proof gate; its stated harness evidence still needs normal current-head review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned PR is not subject to the external-contributor real-behavior-proof gate; its stated harness evidence still needs normal current-head review.
Evidence reviewed 3 items Review inspection unavailable: The required read-only repository inspection could not start: the sandbox aborted every command before it read files, history, scoped policy, or the sibling Codex source.
Affirmative Codex dependency signal: The PR body and changed Codex adapter describe compatibility with Codex app-server v2 UserInput::Skill and skills/list behavior; repository policy requires direct sibling Codex source inspection before a verdict on that contract.
Canonical work remains open: The PR is explicitly Phase 2 for the open canonical skill-reference issue and should be reviewed as its candidate implementation, not closed before merge.
Findings None None.
Security None None.

How this fits together

Inbound messages are parsed by the reply pipeline, which selects named skills and queues an embedded agent run. The Codex extension turns those selections into app-server turn input so Codex can inject matching skills without reselecting the same text reference.

flowchart LR
  A[Authorized inbound message] --> B[Reply pipeline]
  B --> C[Explicit skill resolver]
  C --> D[Queued embedded run]
  D --> E[Codex app-server adapter]
  E --> F[Codex skill catalog lookup]
  F --> G[Structured turn input]
  G --> H[Codex skill injection]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned PR wait for a review environment that can directly verify the Codex app-server contract and current source before merge? Wait for direct verification: Re-run review where the OpenClaw checkout and sibling Codex source can be inspected, then decide from the actual protocol and selection implementation.

Why: The PR’s central behavior relies on Codex protocol and selection semantics, and the required direct dependency inspection was blocked before any source could be read.

Before merge

  • Resolve merge risk (P1) - The structured input depends on exact Codex app-server selection semantics; that contract could not be directly checked because repository inspection is unavailable.
  • Complete next step (P2) - A direct Codex dependency-contract check and full-source review are required before this PR can receive a correctness or merge verdict.
Agent review details

Security

None.

PR surface

Source +106, Tests +167. Total +273 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 15 115 9 +106
Tests 4 172 5 +167
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 287 14 +273

Review metrics

Metric Value Why it matters
Reported production versus test delta production +115/-9; tests +172/-5 (reported in PR body) The new capability threads state across core and extension boundaries, so the production growth needs owner-boundary review.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/auto-reply/reply/queue.media-carrier.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the protocol contract before merge (recommended)
    Confirm the pinned Codex app-server UserInput::Skill and duplicate-selection behavior against sibling source, then run the focused current-head path.
  2. Accept the compatibility risk
    Merge based on the PR’s stated contract and tests if a maintainer is satisfied that the pinned Codex behavior is stable.

Technical review

Best possible solution:

Verify the exact sibling Codex protocol and selection implementation, then review the full threaded data flow and focused regression evidence on the current head before merging.

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

Unclear: the PR describes focused harness coverage, but the review environment could not inspect or run the current source and direct protocol verification is unavailable.

Is this the best way to solve the issue?

Unclear: structured turn inputs may be the right ownership boundary, but the exact Codex selection contract and full current-head callers could not be checked.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 502bdb2bb789.

Labels

Label changes:

  • add P2: This is a bounded agent skill-selection feature without evidence of an urgent user-facing regression.
  • add merge-risk: 🚨 compatibility: The changed turn input relies on an external Codex app-server protocol and selection behavior that must remain compatible.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Label justifications:

  • P2: This is a bounded agent skill-selection feature without evidence of an urgent user-facing regression.
  • merge-risk: 🚨 compatibility: The changed turn input relies on an external Codex app-server protocol and selection behavior that must remain compatible.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Evidence

What I checked:

  • Review inspection unavailable: The required read-only repository inspection could not start: the sandbox aborted every command before it read files, history, scoped policy, or the sibling Codex source.
  • Affirmative Codex dependency signal: The PR body and changed Codex adapter describe compatibility with Codex app-server v2 UserInput::Skill and skills/list behavior; repository policy requires direct sibling Codex source inspection before a verdict on that contract. (extensions/codex/src/app-server/turn-params.ts:89, 4986384600d8)
  • Canonical work remains open: The PR is explicitly Phase 2 for the open canonical skill-reference issue and should be reviewed as its candidate implementation, not closed before merge. (18163ba269c3)

Likely related people:

  • steipete: Authored the merged Phase 1 skill-reference work and this Phase 2 implementation, connecting them to the current skill-selection design. (role: recent feature contributor; confidence: medium; commits: 18163ba269c3, c821ade71d7b; files: src/auto-reply/reply/get-reply-inline-actions.ts, extensions/codex/src/app-server/turn-params.ts)

Rank-up moves

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

  • Re-run review with readable OpenClaw and sibling Codex checkouts, including the pinned protocol and skill-selection paths.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 7c5eaed into main Aug 14, 2026
163 of 165 checks passed
@steipete
steipete deleted the steipete/issue-123367-phase2-codex-skill-inputs branch August 14, 2026 03:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 14, 2026
…penclaw#123441)

* feat(codex): pass explicit skill selections as structured turn input

Thread OpenClaw-resolved explicit $skill selections through the reply
pipeline to the Codex app-server harness and emit them as structured
UserInput::Skill turn items when the Codex catalog (skills/list) knows the
same SKILL.md path. Codex then injects the skill natively and blocks its
text scanner from double-selecting the same name, while unmatched names
stay scannable for Codex-native-only skills and the prompt instruction
block keeps owning skills Codex cannot see. Catalog misses and RPC errors
fail open to the instruction path; the turn never fails on skill lookup.

Part of openclaw#123367

* fix(plugins): defer llama-cpp ssrf-runtime load out of the setup closure

The doctor-contract closure guard forbids the SSRF barrel in the
doctor/legacy-setup closure (cold-loads DNS, proxy state, logging); the
static import landed with the managed llama-server switch (openclaw#123105) and
first fails when a PR selects the guard lane. Defer to a dynamic import at
download time per the guard's stated remedy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex extensions: llama-cpp maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(skills): explicit $skill-name references invoke everywhere, including manual-only skills

1 participant