fix(skills): list omitted skill names when prompt is truncated#42637
fix(skills): list omitted skill names when prompt is truncated#42637imwyvern wants to merge 4 commits into
Conversation
Greptile SummaryThis PR enriches the skills truncation notice in Key changes:
Confidence Score: 5/5
Last reviewed commit: 4ca82d0 |
f39b8ad to
081fffe
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 081fffe8da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
081fffe to
92fedef
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92fedef2c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
92fedef to
5a272f2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a272f20ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5a272f2 to
341f520
Compare
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🔵 Prompt/markup injection via unsanitized remote node labels in skills prompt (remoteNote)
Description
Vulnerable code (prompt concatenation): const remoteNote = opts?.eligibility?.remote?.note?.trim();
...
prompt: joinPromptSections(params.remoteNote, note, skillsBody),Upstream source (remote node metadata used to construct the note): const labels = macNodes.map((node) => node.displayName ?? node.nodeId).filter(Boolean);
... `Remote macOS node available (${labels.join(", ")}). ...`RecommendationTreat Recommended approach: sanitize/escape and/or wrap it in a dedicated XML element with escaping. Example: function sanitizePromptNote(str: string): string {
return str.replace(/[\x00-\x1f\x7f]/g, ""); // drop control chars/newlines/tabs
}
const remoteNote = sanitizePromptNote(opts?.eligibility?.remote?.note ?? "").trim();
// If the prompt is XML-ish, escape:
const safeRemoteNote = remoteNote ? `<remote_note>${escapeXml(remoteNote)}</remote_note>` : "";Also sanitize Analyzed PR: #42637 at commit Last updated on: 2026-04-28T16:27:41Z |
b11d86e to
19fe7de
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19fe7de8b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
19fe7de to
3464eb4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3464eb4b62
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3464eb4 to
b49ca41
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b49ca41477
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b49ca41 to
acd52c0
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 5:05 PM ET / 21:05 UTC. Summary PR surface: Source +192, Tests +186. Total +378 across 2 files. Reproducibility: yes. Source inspection shows current main still emits only a count-based truncation note, and the PR head still has a tight-budget path where fixed-reserve candidate selection can over-truncate before the final notice is rendered. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Refresh the branch against current main, preserve compact-description prompt formatting, budget retained candidates against the exact final rendered notice, and add exact-head proof for the cap and lookup-key path. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main still emits only a count-based truncation note, and the PR head still has a tight-budget path where fixed-reserve candidate selection can over-truncate before the final notice is rendered. Is this the best way to solve the issue? No. The JSON omitted-key recovery shape is reasonable, but this branch is not the best fix until it budgets against the final rendered notice and is refreshed against current main's compact-description prompt format. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 129e2795ae11. Label changesLabel justifications:
Evidence reviewedPR surface: Source +192, Tests +186. Total +378 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (21 earlier review cycles; latest 8 shown)
|
42d1f55 to
ced2f3c
Compare
ced2f3c to
3646d37
Compare
|
Rebased onto upstream/main (HEAD 3646d37). Addressed Codex review:
Verification:
Ready for another look. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3646d375b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3646d37 to
db92650
Compare
|
Rebased onto
Local validation:
|
|
Rebased onto
Local validation:
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
Heads up: this PR needs to be updated against current |
When the skills prompt exceeds the configured budget and skills are dropped, the truncation warning now lists the sanitized names of omitted skills and guides the model to use `openclaw skills info <name>` to load them on demand. Skill names are sanitized (control chars, backticks, angle brackets stripped) before inclusion in model-facing prompt text to prevent prompt injection.
|
Clownfish 🐠 reef update Thanks for the work here. Clownfish patched this branch directly so the contributor trail stays right where it started. Source PR: #42637 fish notes: model gpt-5.5, reasoning medium; reviewed against 0ff24c7. |
|
@imwyvern thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
Problem
When many skills are installed (e.g. 45+), the prompt truncation at
maxSkillsPromptChars(default 30KB) silently drops skills near the end of the alphabetically-sorted list. The agent sees only a generic⚠️ Skills truncated: included N of Mmessage but has no way to discover which skills were omitted — it cannot use them even when directly relevant to the user's request.Real-world example: a user sends a
mp.weixin.qq.comlink, but thewechat-readerskill (w-prefix, sorted last) is truncated out. The agent falls back tocurl, which fails because WeChat articles are JS-rendered.Solution
When skills are truncated, the note now includes the names of omitted skills (capped at 1KB to stay compact) and suggests
openclaw skills info <name>oropenclaw skills listso the agent can still discover and read them on demand.Before:
After:
Changes
applySkillsPromptLimits()now returnsomittedSkillsalongside the existing fieldsformatTruncatedSkillNames()builds a compact name list (hard-capped at 1KB)buildSkillsTruncationNote()assembles the enriched truncation messageTests
All 34 existing + new tests pass (
npx vitest run src/agents/skills).Real behavior proof
Behavior or issue addressed: Skills prompt truncation should keep the emitted prompt within
maxSkillsPromptCharsand advertise omitted skill identifiers thatopenclaw skills info <name>can resolve exactly, including raw keys with characters such as<and backticks.Real environment tested: Local OpenClaw checkout on Darwin arm64, Node v22.22.2, pnpm 10.33.2, branch
fix/skills-truncation-visibility, current HEADdb926508c4.Exact steps or command run after this patch: Rendered 80 synthetic workspace skills through the real
buildWorkspaceSkillsPrompt()code path withmaxSkillsPromptChars: 520and raw keyskill-00<zeroraw; then parsed the emitted<omitted_skill_keys>payload and resolved the first advertised key throughformatSkillInfo()exact lookup. For comparison, the same rendering script was also run against local worktree commit79acf32` before the budgeted lookup-key note.Evidence after fix: Terminal output copied from the local command run.
Observed result after fix: The current prompt is 512 chars, below the 520 char cap, includes
<omitted_skill_keys>, preserves the raw advertised key as JSON data, andformatSkillInfo()resolves the first advertised key exactly asskill-00<zeroraw`.What was not tested: Live model submission was not needed for this prompt-rendering fix; the local proof covers the real prompt builder and CLI exact lookup formatter path.
Local script generated 80 workspace skills with
maxSkillsPromptChars: 520, injected the raw omitted lookup keyskill-00<zeroraw, and rendered the same prompt path throughbuildWorkspaceSkillsPrompt(). The after case also passes the first advertised key throughformatSkillInfo()` exact lookup.Before (
79acf3289d, pre budgeted lookup-key note):After (
db926508c4):