Repository navigation
fix(skills): read a pending skill's document with its own cap - #18778
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that an existing candidate refused by the old 4 KiB read now opens in the dashboard. Only [DESIGN-REVIEWED] bb09144 Description read[DESCRIPTION-READ] 9b27ccd65f58cd0593af1c428de2eb5ec728ed4c3591ec9a7a33903f31a0fe86 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check before merge: a promoted candidate's live read still has no cap tighter than What this change shipsInventory (4 items) — 4 justifiedIntent: let a user open and approve a generated pending skill whose SKILL.md is over 4 KiB but inside the generator's procedure limit. This is a FIX for #18715, and the PR adds a test that fails on base.
[FIRST-PRINCIPLES-REVIEWED] bb09144 Description read[DESCRIPTION-READ] 117764e8035ab0db5df71a3797a932eb1dc19c7804e95f5e0315f3908dfe0fe3 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
CI note, head 59f96e2: Build Wheel, Build Desktop (ubuntu-22.04), Build Desktop (ubuntu-22.04-arm) and E2E (stub ACP backend, offline) fail in their Build frontend step on |
|
|
The pending-skill detail reader read the candidate's SKILL.md and .meta.json through the pin with max_bytes=MAX_SCRIPT_BYTES (4096), the per-file cap for bundled executable scripts. The generator may write a procedure of AUTO_SKILL_MAX_PROCEDURE_CHARS (10,240) characters, so every valid generated skill whose SKILL.md grew past 4 KiB came back as pending_skill_unreadable, the panel described it as not a plain directory, and Approve stayed disabled for a candidate approve would have promoted. The two document files now read under _PENDING_DOCUMENT_MAX_BYTES, derived from the procedure limit: four bytes per character for the body (UTF-8's maximum) plus one more limit's worth of headroom for the frontmatter, which also covers .meta.json. MAX_SCRIPT_BYTES is unchanged and still bounds every file under scripts/. A document over the new cap still refuses the candidate whole; the read stays bounded and never serves a partial view. The approval decision, the tree fence and the link checks are untouched. Tests: the reporter's 6,713-byte generated document opens and approves (red on main); the same size as a bundled script is still refused; a document exactly at the cap is served and one byte over is refused; .meta.json over the cap is refused. The composition contract's oversized-body test, which asserted the old behaviour, now asserts the document cap. The owning spec names the two caps and what each bounds. Fixes #18715
59f96e2 to
bb09144
Compare
|
|
iamwhatever
left a comment
There was a problem hiding this comment.
This fixes generated pending skills whose SKILL.md is over 4 KiB. The detail read refused them as pending_skill_unreadable with Approve disabled, because it read the two document files under MAX_SCRIPT_BYTES, the 4 KiB cap meant for bundled scripts. The root cause is fixed: SKILL.md and .meta.json now read under _PENDING_DOCUMENT_MAX_BYTES, which is derived from AUTO_SKILL_MAX_PROCEDURE_CHARS (4 bytes per char plus one limit of frontmatter headroom, 51,200 bytes). Scripts under scripts/ keep the 4 KiB cap. The read stays pinned and bounded, and an over-cap document still refuses the whole candidate. The approve path's own checks (layout, links, validate_scripts, redaction) are untouched, so this widens only what the review panel can display, not what can be promoted. The tests go through the generator with the reported 6,713-byte document and are red on main. They also pin the exact-cap and one-byte-over boundary, the script cap, and metadata over the cap. Checks are green on bb09144. GPT and Opus have no findings, Design and First Principles are PASS, and the author answered both lanes' items on this head. — crew-pr-reviewer
Problem / Motivation
Goal: A valid generated pending skill opens for review and can be approved when its SKILL.md is larger than 4 KiB but within the generated-procedure limit.
In Kiro Crew 0.8.0, a generated pending skill appears in the candidate list but cannot be opened when its
SKILL.mdis over 4,096 bytes. The detail request answerspending_skill_unreadable, the panel says the candidate's files are not a plain directory, and Approve stays disabled. The reporter hit it with a 6,713-byteSKILL.md, far under the 10,240-character procedure limit the generator itself enforces.Why it matters
Any user whose consolidation or crystallize run produces a skill with more than about 4 KiB of procedure text cannot review or approve it: the one action that applies is disabled, and the error points at a broken tree that does not exist. The queue fills with candidates that look wrong and cannot be cleared except by dismissing them.
Not a goal
MAX_SCRIPT_BYTESfor bundled scripts.SKILL.mdor.meta.jsonis over the document cap (51,200 bytes). Only a direct write such as the crystallize skill can produce one, and the detail read refuses it whole by design: the read stays bounded and never serves a partial view.pending_skill_unreadablewording in the dashboard.What changed (motivation → approach → change)
The pending-skill detail reader in
src/kiro_crew/skills.pyread the candidate'sSKILL.mdand.meta.jsonthrough the pin withmax_bytes=MAX_SCRIPT_BYTES, the 4 KiB per-file cap meant for bundled executable scripts. The generator may write a procedure ofAUTO_SKILL_MAX_PROCEDURE_CHARS(10,240) characters, so any valid document past 4 KiB failed the bounded read and was refused as if its tree were not plain.The two document files now read under their own cap,
_PENDING_DOCUMENT_MAX_BYTES, defined beside the procedure limit it derives from: four bytes per character for the body (the UTF-8 maximum) plus one more limit's worth of headroom for the frontmatter, which also covers.meta.json. The script cap is untouched and still bounds every file underscripts/. The pin semantics are unchanged: a document over the new cap still refuses the whole candidate, and the read is bounded and never partial. The owning spec,docs/system-specs/modules/memory-skills-hooks.md, names the two caps and what each bounds.src/kiro_crew/skills.py_PENDING_DOCUMENT_MAX_BYTESderived fromAUTO_SKILL_MAX_PROCEDURE_CHARS; theSKILL.mdand.meta.jsonreads use ittest/test_skill_pending.py,test/test_skills_composition_contract.pydocs/system-specs/modules/memory-skills-hooks.mdpending_skill_unreadablerowBackwards compatibility
Compatible: the change only widens what the detail read accepts for two document files; nothing that opens today stops opening, and scripts keep their cap.
Removes nothing: no path, key, record or function is removed or renamed.
Tests
test_detail_serves_a_generated_document_over_the_script_cap: a candidate staged through the generator with a 6,713-byteSKILL.mdopens, the whole body is served, andapprove_pending_skill_checkedpromotes it. Red on main:AssertionError: a valid generated document over the script cap was refused.test_a_bundled_script_over_the_script_cap_is_refused: the same 6,713 bytes as a script underscripts/still refuse the candidate.test_a_document_over_the_document_cap_is_refused_whole: aSKILL.mdexactly at the document cap is served; one byte over refuses the candidate, which stays staged.test_metadata_over_the_document_cap_refuses_the_candidate:.meta.jsonover the cap refuses the candidate rather than serving empty metadata.TestThePinnedPendingRead::test_an_oversized_body_refuses_the_candidate(composition contract): a body over the script cap is served; one over the document cap is refused.Local runs: the skills test modules serially (1,835 passed), the change-related backend set (24,706 passed; 50 failures are the same ids that fail on a pristine
origin/maincheckout, all host-environment tests outside this change), the change-related frontend set (11,176 passed), isort, flake8, mypy, black, the comment-history and brand gates, docs-lint, the flake-pattern ratchet and the repository's semgrep rules. Local pre-push review lanes ran on this diff: GPT found one real finding (the exact-byte test fixtures depended on text-mode newline translation, fixed), Opus returned no findings, and First Principles passed with every shipped mechanism justified; the final rebase changed no diff content.Manual verification
N/A: unit coverage sufficient. The failing read is exercised directly through
get_pending_skillon a candidate the generator staged, which is the path the dashboard detail endpoint calls.Screenshots / video
None: no user-visible frontend change. The dashboard's existing detail view simply loads for candidates it refused before.
Related Issues
Fixes #18715
Pattern harvest
Rule candidate: review-prompt
Pattern: a byte cap named for one kind of file (executable scripts) reused on a read of another kind (prose or metadata) whose producer has a different, larger limit.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.