Repository navigation
perf(skills): skip warm prompt search when minimum cannot fit - #157343
Conversation
Punchcard-Session: ember-river-harbor-t4
|
🦞👀 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: needs maintainer review before merge. Reviewed September 24, 2026, 11:30 AM ET / 15:30 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch skips wider skill-description renders when the minimum-width catalog exceeds the context budget and adds prompt and skill-resource parity tests. Merge readiness✅ Ready for maintainer review Keep open. Current main still performs the extra work, the reviewed patch has no identified correctness defect, and the updated PR body resolves the prior test-cost finding. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw builds a skill catalog from eligible workspace skills and places it in an agent's prompt. Context-budget compaction shortens descriptions while the catalog's skill identities and readable resources remain available to the agent. flowchart LR
A[Eligible skills] --> B[Skill catalog]
B --> C[Context budget]
C --> D{Minimum fits?}
D -->|Yes| E[Choose widest fitting descriptions]
D -->|No| F[Keep minimum descriptions]
E --> G[Agent prompt]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +46. Total +48 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the guard in the existing skill prompt owner while preserving exact prompt and resource behavior and documenting its measured performance tradeoff. Do we have a high-confidence way to reproduce the issue? Yes, from source: a below-minimum budget on current main still enters the wider-render search. This read-only review did not execute that path. Is this the best way to solve the issue? Yes. The existing minimum-width render supplies the fit decision, so the guard avoids extra work without adding a second compaction policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d9f63649ff08. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Additional hosted test-cost evidence for head The metric below is the sum of displayed integer-millisecond testcase durations, counting each passing leaf testcase once.
A displayed For context, |
|
Merged via squash.
|
* commit '9a1a6f7db9783d0b8abaf918bfe12978ea745b57': (26 commits) fix(maintainer): restore cold PR worktree provisioning (#157394) feat(ios): establish native Cloudflare Access sign-in sessions (#146996) fix: restore the Gateway after interrupted Doctor maintenance (#156854) refactor(line): retire the Express webhook adapter (#157369) refactor(cron): consolidate unavailable delivery targets (#157393) ci: apply Go memory defaults to architecture checks fix(cli): preserve the first PowerShell completion test failure (#157267) refactor(agents): consolidate transcript-tail model selection (#157382) fix(release): honor frozen validation contracts (#157034) fix(perf): use settled Kova terminal CPU accounting (#157029) chore(windows): verify packaged repair worker lifecycle (#157047) refactor(logging): share memory pressure threshold selection (#157164) fix(release): verify bundled fs-safe native bindings (#157027) perf(skills): skip warm prompt search when minimum cannot fit (#157343) fix(ui): avoid retaining detached tooltip anchors (#157226) perf(ci): reuse compiler state and shorten guard and UI tests (#157265) perf(ui): preserve model caches on unrelated metadata updates (#157254) chore: remove the tracked PR-body artifact and ignore .artifacts (#157296) refactor: consolidate duplicate MCP lifecycle tests (#157360) test(qa): consolidate CLI runtime fixtures (#118496) ...
…aw#157343) Punchcard-Session: ember-river-harbor-t4
What Problem This Solves
Warm skill prompt compaction rendered the catalog eight times even when descriptions at the minimum width could not fit the available budget.
User Impact
Skip the remaining search in that case and return the same compacted prompt. Fitting budgets still select the widest fitting descriptions, and the original prompt remains preferred whenever it is no longer than the compacted result.
Why This Change Was Made
The existing minimum-width render already establishes whether any candidate can fit. Reuse that result to guard the search. Tests cover budgets below, equal to, and above the minimum; escaped text, Unicode boundaries, and whitespace; the original-shorter fallback; and resource identity and captured contents through
resolveSkillsPrompt.Accepted as a conditional rendering optimization because the minimum-budget case avoids seven futile renders; the fitting/no-budget and RSS costs below remain part of the tradeoff.
Evidence
skill-contract.test.tsandworkspace-skill-prompt-resolution.test.ts.Single-worker validation costs from the retained native run (baseline → candidate; 18 passing tests per file):
src/skills/loading/skill-contract.test.tssrc/skills/loading/workspace-skill-prompt-resolution.test.tsThe first column of timings uses the JSON reporter's file start/end timestamps; the framework total includes transform/import work. The driver interval also includes command settlement and the subsequent resource census. Each file ran separately with
--maxWorkers=1 --fileParallelism=false. These are one-run validation costs, not performance samples. Hosted CI passed for this exact head in 1,173 seconds of workflow wall time (15:01:44–15:21:17 UTC). That includes scheduling, setup, and parallel jobs; it is not summed runner time or per-file CPU time. Per-file hosted costs are not separately attributed.Formatting passed with oxfmt 0.68.0 on all three changed files. Hosted type checks, lint, and the required CI gate passed for the published head.