Repository navigation
fix: stop listing a linked panel template that cannot render - #36732
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The list and the reader now share one containment rule, so the cause is fixed and no second rule remains. What this change shipsInventory (4 items) — 4 justifiedIntent: a crew named after a template that is symlinked into the override folder from outside should publish with the default template instead of failing. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 53abdb9 Description read[DESCRIPTION-READ] 7ff907b6d58a1ae82d97965057b9c7b04b3a6d5623da2efb6b0f0f8889c77eb0 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the template list now uses the same containment rule as [DESIGN-REVIEWED] 53abdb9 Description read[DESCRIPTION-READ] c4bde0838d4a3f2c951aa4ebbd1976550362ab7e981b9c2f3b322dd478baee22 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 |
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: |
Code change approver recommendation: ApproveWhy: the decider estimates a 7% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. available_templates() now applies the same containment rule resolve_template() already enforced, through a shared _contained helper, so an override linked from outside its folder is no longer listed and the crew named after it falls back to the default template. resolve_template's behaviour is unchanged (same resolve and is_relative_to check, same exception handling). The listing filter covers both the shipped and override folders, matching the serving path. The only ids removed are ones that could never render, so no regression for the template route, template_for_crew or the MCP relay. The new test fails without the fix, includes an inside-link control, and is registered in requires-real-symlinks.txt. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
buluoray
left a comment
There was a problem hiding this comment.
Approve on eca8a75. The template list now uses the same containment rule as the template reader, through one shared helper. A template linked in from outside the override folder is no longer offered, so the crew named after it publishes with the default template instead of failing. Every id that rendered before still lists and renders, and a saved panel that names a hidden id behaves exactly as before, because the reader already refused it. The new test fails without the fix. One follow-up: no test pins the reader's own refusal of an outside link. Decisive lines: src/kiro_crew/agent_panel.py:397-401, src/kiro_crew/agent_panel.py:444-451, src/kiro_crew/agent_panel.py:473-476, test/test_agent_panel_store.py:379-401
|
[operator: bolichen97] The one red on this head is not this change. This diff touches Recorded on the ledger, then rerunning the failed jobs once. Every review lane is green on this head (Design PASS, First Principles PASS, GPT and Opus with no findings), there are no unresolved threads, and auto-merge is already armed. |
|
[operator: bolichen97] The one red on this head is still not this change, and it is a different red from the one in my earlier comment.
This diff touches This occurrence is recorded on #36261. That flake has far more than two ledger reports in the last 14 days, so it does not get another rerun here: this pull request waits for #36653 to land and then rebases onto it. Auto-merge stays armed, and every other check and every review lane is green on |
|
[operator: bolichen97] This PR still needs one rebase, and it waits for #37254 before taking it. The red on this head is Current main has a red of its own, though. |
available_templates() kept every *.html entry whose is_file() was true, which follows a symlink, while resolve_template() refuses an override whose link leaves the override directory. A template linked in from outside (a stow or chezmoi dotfiles layout) was therefore listed, template_for_crew() picked it for the crew of the same name, and every default publish failed with unknown_template. Both functions now share one containment helper, so a listed id is always one resolve_template serves. The refusal itself is unchanged; a link to a file inside the override directory stays listed. Closes #36120 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rebased: main moved in src/kiro_crew/agent_panel.py, test/requires-real-symlinks.txt, test/test_agent_panel_store.py since this head went green (c22557c -> 6dd5dac); CI re-running. This is the rebase my earlier comment said was waiting: the new base carries main's shard-7 memory fix (#36648) and the conductor-test fix (#37254). The change itself is the same set of changed lines as before. The push clears the earlier approval, so this head needs a fresh one. [operator: bolichen97] |
eca8a75 to
53abdb9
Compare
Problem / Motivation
Goal: A panel template linked into the override folder from outside it is no longer offered, so the crew named after it publishes with the default template instead of failing.
available_templates()lists every*.htmlentry whosePath.is_file()is true, andis_file()follows a symlink.resolve_template()refuses an override whose link leaves the override directory. So a template linked in from outside is listed,template_for_crew()hands it to the crew of the same name, and publishing it raisesPanelError("unknown_template").Why it matters
Linking a template into the override folder from a dotfiles repo is a common stow or chezmoi layout.
resolve_templaterefuses such a link, yet the template list still offers it, so the crew named after that template fails every defaultpanel_publishwithunknown_template, and the templates route advertises an id that cannot render. The only way out is to know to passtemplate="default".Not a goal
resolve_templatestays as it is.panel_dir_is_a_symlink).What changed (motivation → approach → change)
A crew named after a template linked in from outside the override folder failed every panel publish with
unknown_template. That template is no longer listed, so the crew gets thedefaulttemplate and its panel publishes.The template list and the template reader used two different rules. The list kept any
*.htmlentry for whichis_file()is true, andis_file()follows a link. The reader (resolve_template) checks one more thing: the link's target must stay inside the folder. So the list offered ids the reader refused.src/kiro_crew/agent_panel.pyputs that one containment rule in a small helper,_contained(root, candidate), and both functions call it.resolve_templatebehaves exactly as before.available_templateslists an entry only when it is a.htmlfile and the helper accepts it; an entry the helper cannot resolve is skipped, like an unreadable folder already is. A link to a file inside the folder is still listed and served.Backwards compatibility
Compatible: the only id that leaves the list is one
resolve_templatenever served, so every id that publishes today still publishes.Reader: src/kiro_crew/agent_panel.py:template_for_crew -- crew page -- a crew named after an outside-linked template gets
defaultinstead of an id that refuses to publish;test_a_template_linked_from_outside_its_directory_is_not_offeredReader: src/kiro_crew/dashboard/handlers/agent_panel_publish.py:api_agent_panel_templates -- crew page --
GET /api/agent-panel/templatesstops advertising an id that cannot render, and itsdefaultcomes fromtemplate_for_crewabove;test/test_agent_panel_routes.pypasses unchangedReader: src/kiro_crew/mcp_panel.py:_call_tool_inner -- chat -- the
kirocrew-panelMCP templates tool reads that route over HTTP and lists what it returns, so it no longer suggests the unrenderable idTests
test/test_agent_panel_store.py::test_a_template_linked_from_outside_its_directory_is_not_offered(new): an overridebespoke-crew.htmllinked to a file undertmp_pathis not inavailable_templates(),template_for_crew("bespoke-crew") == "default", and publishing with that choice succeeds. Control in the same test: an override linked to a real file inside the override directory stays listed, andresolve_templatereturns its body. With the fix reverted it fails onassert 'bespoke-crew' not in [...]. Its contract is a real file symlink, sotest/requires-real-symlinks.txtnames it, and the suite skips it only on a host that cannot create one.Proof: PROVEN test/test_agent_panel_store.py::test_a_template_linked_from_outside_its_directory_is_not_offered (head a0d53646a53f)
Manual verification
Run on Ubuntu 24.04 (Linux, Python 3.12.3), against the store that the publish and templates routes call, each time with a fresh isolated data home (
KIROCREW_HOME=$(mktemp -d)). Reaching it over HTTP would take a gateway plus an internal-secret caller, and that caller ends up making this same function call.Before (base
529da1ee2), the issue's script:After (
a0d53646a53f, this patch on that base), the same script:Happy path on the same commit: a plain override
my-board.html, and an override symlinkinner-link.htmlpointing toinner-target.htmlin the same directory:Related Issues
Closes #36120
Sibling sweep
Swept: git grep -nE "is_file()|is_relative_to|.resolve()" -- src/kiro_crew/agent_panel.py src/kiro_crew/dashboard/handlers/agent_panel_publish.py src/kiro_crew/mcp_panel.py (
available_templatesandresolve_templateare the only listing/serving pair; both call_contained)Sibling: src/kiro_crew/agent_panel.py -- changed here
Sibling: src/kiro_crew/dashboard/handlers/agent_panel_publish.py -- not affected -- it only relays
available_templates()andtemplate_for_crew()and runs no file check of its ownSibling: src/kiro_crew/mcp_panel.py -- not affected -- it reads the templates route over HTTP and never opens the directory
Pattern harvest
Not generalizable: two hand-written copies of one containment rule inside a single module; the fix makes both call one helper, and no lint can tell a listing from the serving path it should match.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.