Repository navigation
refactor(context_assembly): unchain the mate-tools ternary, fix comments - #24646
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this is a refactor with no behaviour change, the new test covers the one branch that had none, and the two comments now match the code. [DESIGN-REVIEWED] f7ea112 Description read[DESCRIPTION-READ] 456dc8184badfb4ea629084cff4d105fe43e1c1d6a2a345fc36da903e7d36905 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 Nothing blocks. Every item is a behaviour-preserving spelling change, a comment brought in line with the code, or a pin on a branch that had none. What this change shipsInventory (4 items) — 4 justifiedIntent: make the crewmate tool-identity choice readable and pinned, and correct two comments that contradict the code. This is a FIX (to comments and test coverage) with no runtime change.
[FIRST-PRINCIPLES-REVIEWED] f7ea112 Description read[DESCRIPTION-READ] 018aef3810d6f9d1b0656010bbf70eb6842e908ce7722c49962c09308ee23f08 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: |
|
All six failures are This PR will not be re-run for that shard. Once #24613 lands, it gets rebased onto main and CI re-runs. |
3d77cad to
5223465
Compare
|
Rebased: main moved in src/kiro_crew/context_assembly/member.py, context_assembly/replay.py, context_assembly/turn_message.py, src/kiro_crew/context.py and two importing tests since this head went green (96c4fef -> aeb5c02); CI re-running. The new base also carries #24609, the fix for the |
|
Both shards fail the same single test, This PR will not be re-run or overridden for that red. Once #24774 lands, it gets rebased onto main and CI re-runs. |
build_member_section picks the crewmate's tool-identity sentence with a nested conditional expression; spell it as if/elif/else in the same order, so each of the three sentences sits on its own branch. No test checked that a crewmate without the kirocrew-mate tools hears the page sentence, so a parametrized test now pins all four tool/preview cases; it passes against the previous expression too. Two comments beside the prompt constants were false. The no-file-tools item's note said no kirocrew-mate tool writes the briefing, but save_notes does, and a crewmate with those tools never gets that item. The dashboard item's note narrated an earlier wording and counted six panel verbs; _MEMBER_PANEL_GRANTS holds eleven, every tool the item names among them.
5223465 to
f7ea112
Compare
|
Rebased onto |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: replaces a chained ternary with an if/elif and corrects comments in context_assembly/member.py, no behaviour change; with a test.
Problem / Motivation
Goal: Spell the crewmate's tool-identity choice in
build_member_sectionasif/elif/elseinstead of a nested conditional expression, pin that choice with a test, and correct two comments incontext_assembly/member.pythat contradict the code, without changing what the member section says.build_member_sectionbuilds a crewmate's member section,[MEMBER IDENTITY]first. Its tool-identity choice is hard to read, one of its branches has no test, and two comments beside the prompt constants it uses contradict the code:(_MATE_TOOLS_IDENTITY_MANUAL if manual else _MATE_TOOLS_IDENTITY) if has_mate_tools else _NO_MATE_TOOLS_IDENTITY. The reader has to match parentheses to see thathas_mate_toolsis tested first.kirocrew-matetools is told to callupdate_self, and none of the 17 related test files notices._MEMBER_BRIEFING_ITEM_NO_FILE_TOOLSsays nokirocrew-matetool writes the briefing.save_notesdoes:mcp_mateposts it to/api/member/self/notes, whose handler writesmembers/<slug>/briefing.md. A crewmate with those tools never gets this item, becausebriefing_writableholds for it wherever the layer is read._MEMBER_DASHBOARD_ITEMopens by narrating an earlier prompt wording, and says_MEMBER_PANEL_GRANTSgrants "all six verbs". The tuple holds eleven, every tool the item names among them.Why it matters
Nothing is broken today. Without the test, a change that tells a crewmate to call tools it does not have would pass CI. The first comment tells the next person editing the no-file-tools item that the mate server has no briefing writer, which is the opposite of the code they are about to change. The second states a count that is wrong and history that is not about the code below it.
Not a goal
from kiro_crew import crewmate_dynamic_capabilitiesand the repeatedrestricted_for(member)call later in the same function. Folding them would delete an in-function import, which this sweep never does.context_assembly/, which many open PRs change.crewmate_prompts.json).test_dashboard_manager_agent.pydocstring, and a stale count in the doc above_MEMBER_PANEL_GRANTSinagent_parts/spec_grants.py. This PR edits comments only in the module it changes.What changed (motivation → approach → change)
The identity choice reads top to bottom, a test pins which sentence each crewmate hears, and the two comments say what the code does.
build_member_section, the tool-identity sentenceidentity.append(...)if not has_mate_tools/elif manual/elseassigningmate_tools_identity, then the sameappend_MEMBER_BRIEFING_ITEM_NO_FILE_TOOLSkirocrew-matetool writes the briefing"save_notes, so it never gets this item (briefing_writable)_MEMBER_DASHBOARD_ITEM_MEMBER_PANEL_GRANTSgrants every tool the item names; the rest of the note is re-wrapped, not rewordedtest/test_member_mate_tools.pyThe rewrite tests
has_mate_toolsfirst andmanualonly whenhas_mate_toolsis truthy, exactly as the expression did, and both names are locals, so no call moves.Backwards compatibility
Compatible: the member section's text is the same for every input; only the spelling of one choice and two comments change, and a test is added.
Removes nothing: no name, field, file or behaviour is taken away; the three constants and their prompt keys are unchanged.
Tests
test_the_desk_hears_the_identity_sentence_its_tools_and_preview_pickintest/test_member_mate_tools.py, four cases: thekirocrew-matetools on or off, times the Dynamic capabilities preview on or off. Each builds the member section and checks that exactly the expected one of the three sentences is in it. It passes against main'smember.py, so it pins existing behaviour; with the no-tools branch made dead, its two no-tools cases fail. It scopes its_overridepatch withmonkeypatch.context(), because an autouse fixture holds that global.test_crewmate_dynamic_capabilities.pytests and the fourth red none of the 17 related files before this test.-n0. The file: 10 runs at-n 4 --dist loadgroup --max-worker-restart=2, and its 20 ids shuffled (seed 26102) at-n0. All green. A probe plugin shows_overrideback at its starting value after every test in the file.build_member_section, the identity constants orcontext_assembly.member, plustest_interrupted_turn_steers.py, which imports the package: 654 passed, 2 skipped.build_member_sectionover 147,456 stubbed inputs per tree: identical outputs and call logs. The security lens found no control changed shape._overridewithout a scope, so its undo re-installed the autouse fixture's value for every later test on the worker. Both adjudicators upheld it.scripts/scrub-lint.shis absent from the checkout, and semgrep is not installed here; CI's SAST job runs it. The frontend did not run, as nothing underwebsite/,.github/orscripts/changed.Manual verification
N/A: the change has no runtime effect, and the related tests build the member section on each of the three identity branches.
Screenshots / video
Why no screenshot: backend-only change to one function's control flow and two comments; no page, card or prompt string changes.
Related Issues
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)