fix(codex): send skill mentions as typed skill input - #9494
Open
ylcn91 wants to merge 3 commits into
Open
Conversation
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused Codex bug fix that enables existing skill mentions through a small typed-input adapter, with ordinary prompts unchanged and catalog failures falling back safely to text-only input. Tests cover token resolution and the turn payload, while the documented in-progress-turn limitation is explicit. You can add or adjust custom eligibility rules. Learn more. |
ylcn91
force-pushed
the
fix/codex-typed-skill-input
branch
from
September 3, 2026 23:00
85c38ce to
78743c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
apps/server/src/provider/Drivers/CodexSkillDispatch.ts(new): resolves the$nametokens in a prompt against the skills Codex reports for the session's cwd. Same token shape as the composer chip and the Claude dispatch, so a rendered chip and a dispatched skill are always the same set. Unknown or disabled names stay literal.apps/server/src/provider/Layers/CodexSessionRuntime.ts:sendTurnreadsskills/listonly when the prompt carries a token, thenbuildTurnStartParamssends each resolved skill as a{ type: "skill", name, path }input item beside the text. The vendored app-server schema predates that item, so the turn/start params schema is extended locally next to the existingcollaborationModeextension. A failed catalog read logs a warning and sends the mention as text, which is what every turn did before.docs/user/composer.md: notes that Codex loads a skill only on a turn it starts fresh.Tests: the dispatch helper (order, de-duplication, unknown and disabled names, whitespace-delimited tokens) and the typed item in the turn params.
Why
Refs #9317.
T3 Code sends
$ask-mattto Codex as prose. A skill withpolicy.allow_implicit_invocation: falseis absent from the catalog the model sees, so the prompt names a skill the model cannot reach, and the reply is that the skill is not installed.I verified what the app server does with each input shape by pointing Codex 0.152.1 at a local endpoint that records every model request and answers a canned response (no model, no quota), with a skill whose
SKILL.mdcarries a marker string:turn/start{ type: "text", text: "$ask-test hello" }{ type: "mention", name, path }{ type: "skill", name, path }<skill>block after the textSo the typed
skillitem is the one that works, and this change sends it. The text stays as written, which is how the Codex TUI sends the same mention.The same harness shows the limit the issue title is about. When the second message arrives while a turn is running, whether through a second
turn/start(what T3 Code does today; the app server steers it into the active turn) or throughturn/steer, the app server drops the skill item and forwards only the text, even when the item is the whole input. That is Codex's own behaviour, so this PR does not claim to fix the active-turn case; it makes explicit invocation work on the turn Codex starts fresh and documents the limit for users. Holding a skill-bearing message until the current turn ends would be a product decision and is left out.Model and harness: Claude Fable 5.1 in Claude Code.
Note
Medium Risk
Changes Codex turn input wiring and adds a pre-turn RPC; failures degrade to prior text-only behavior, but incorrect resolution could invoke the wrong skill path.
Overview
Composer
$skilltokens were reaching Codex as plain text, so skills that only the user may invoke (not in the model catalog) never loaded. This change parses those tokens, optionally callsskills/listwhen the prompt contains a mention, and sends matching enabled skills as{ type: "skill", name, path }items alongside the unchanged prompt text onturn/start.CodexSkillDispatchhandles detection, de-duplication in first-mention order, and ignores unknown, disabled, or non–whitespace-delimited tokens (aligned with composer chips and Claude dispatch).CodexSessionRuntimeextends the vendored turn-start input schema for the skill item; catalog failures log a warning and fall back to text-only input. User docs note that Codex only applies typed skills on a fresh turn, not while steering an in-flight turn.Reviewed by Cursor Bugbot for commit fb4403c. Configure here.
Note
Fix
CodexSkillDispatchto send skill mentions as typed skill inputMacroscope summarized 78743c1.