Repository navigation
fix(dashboard): let dashboard_write empty an array field with clear - #20068
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing in this diff runs real Kiro CLI against What this change shipsInventory (6 items) — 6 justifiedIntent: let a crewmate empty an answered Needs-you or For-you list on its dashboard, which Kiro CLI makes impossible today by dropping
[FIRST-PRINCIPLES-REVIEWED] b94d516 Description read[DESCRIPTION-READ] 448cc0fc95a2991a05ebc5c300f0f977d8e0f6df4d1d9988da4c009b45170736 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 to check. [DESIGN-REVIEWED] b94d516 Description read[DESCRIPTION-READ] 63df574c8f913e97f02edee0403719a4466b2aa42982fb41e0836188f63852a2 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: |
52236f9 to
5f13ed4
Compare
|
Rebased onto main |
|
|
An MCP client can drop an empty list, an empty object or a top-level null from a tool call's arguments before the server reads them, so a dashboard_write call with value: [] arrives with no value and is refused as "value: required". A crewmate can replace the last item of an array field but never empty the field. dashboard_write takes an optional boolean clear. clear: true with no value makes the panel server post value: [] to the write route, which type-checks it like any other write. A call that passes a value posts that value unchanged. A call with nothing to write keeps its "value: required" refusal and names clear: true as the way to empty an array field. Closes #20053
5f13ed4 to
b94d516
Compare
|
Rebased onto main |
|
bolichen97
left a comment
There was a problem hiding this comment.
Readiness sweep: full diff read, PR Readiness success on this head, no live change requests or blocking threads. No regression found.
Problem / Motivation
Goal: A crewmate can empty an array field on its dashboard, such as an answered Needs-you list, with
dashboard_write.dashboard_writewith{"field": "for_you", "value": []}answersError: value: required, the same answer as a call with novalueat all. Kiro CLI (measured on 2.31.0) drops an empty list, an empty object and a top-levelnullfrom a tool call's arguments before the MCP server reads them. Sovalue: []reaches thekirocrew-panelserver as no value, and the server refuses it as missing. A crewmate can replace the last card inneeds_youorfor_youwith another card, but it can never empty the list.Why it matters
Every crewmate on the Kiro CLI backend is hit. A Needs-you card the person already answered stays on the page, because the only way to remove the last one is a write that never arrives. The person keeps seeing a request that is already done.
Not a goal
dashboard_writeonly.objectfield (asks,drafts,steps) or astringfield.clear: truewrites[], and the write route refuses[]for a field that is not an array./api/agent-panel/dashboard/writeor its body schemaDASHBOARD_WRITE_SCHEMA.What changed (motivation → approach → change)
dashboard_writetakes an optional booleanclear, andclear: truewith novalueempties an array field. A boolean argument reaches the server intact, so the flag survives the client that dropsvalue: [].valueclear: true, novalueError: clear: unknown field ...value: []clear: truewithvalue: []clear: trueclear: truewith another valueError: clear: true writes an empty list, so pass it without a valuevalue(howvalue: []arrives)Error: value: requiredError: value: required -- ..., plus a sentence namingclear: truevalue: ""Error: value: required (empty after sanitization)The panel server (
mcp_panel.py) turnsclear: trueintovalue: []before it posts. The gateway route andDASHBOARD_WRITE_SCHEMAtherefore see an ordinary write and type-check it the same way: a field that is not an array refuses it with the type it wants, and that refusal goes into the mistake book like any other wrong-type write.The tool's own argument schema is a new
DASHBOARD_WRITE_TOOL_SCHEMAinvalidation.py.valueis optional there, and a custom check keeps it required unlessclearis true. The tool's description andinputSchemanameclear, andrequiredis["field"].dashboard-instances.mdrecords why the flag exists.Backwards compatibility
Compatible: a call that passes
valueposts that value exactly as before, and the write route, its body schema and every field's type check are untouched.clearis optional. A call with nothing to write is still refused, and its error still starts withvalue: required.Removes nothing: the diff adds an optional argument and a longer refusal; no field, route, key or accepted input goes away.
Tests
test_mcp_panel_runtime.pyTestDashboardWriteClear, 20 cases, each through the server's_call_toolso the argument schema runs:clear: trueposts[];clearbeside[]is the same write;clearbeside any other value is refused before the gateway; a missing value,nullandclear: falseare refused withvalue: requiredand nameclear: true;""keeps its exact refusal; a non-booleanclearis refused; six kinds of value are posted unchanged; the advertised schema carriesclearand requires onlyfield.test_agent_panel_routes.pytest_clear_through_the_panel_server_empties_an_array_field: end to end from the panel server's entry point, over loopback HTTP, into the real write route, template registry and instance store. It writes a non-emptyneeds_you, clears it, and reads[]back from the field list. It binds the panel server's_postto the real HTTP client itself, because conftest's autousegateway_postsrecorder would otherwise be what the server binds when the test is the first to import it; so it passes run alone as well as besidetest_mcp_panel_runtime.py.prove.py: PROVEN. With the production hunks reverted, an assertion in the new tests fails.-n0, the end-to-end test 20 runs alone at-n0, 10 runs at-n 2 --dist loadgroup --max-worker-restart=2besidetest_mcp_panel_registration.pyand their own files, and one shuffled run of both changed test files (seed 23346, 218 passed). The local runs used-n 2where testing-conventions asks for-n 4.Success: no issues found in 2310 source files), comment history, brand name, harness parity, feature map, docs lint, the flake-pattern ratchet, and semgrep on the diff (0 findings). The 24 test files that reference the changed symbols, plus the flake-pattern ratchet, on this head: 1536 passed at-n 2, run withKIROCREW_PORT=1so an unstubbed request cannot reach a running gateway.validation.pyis imported by several hundred test files, so the scoped backend selection is left to CI on the merge ref.Manual verification
Kiro CLI 2.31.0 driving an MCP server that only echoes its arguments, two runs:
value: [],value: {}andvalue: nullarrive withoutvalue, andclear: truearrives intact. The panel-server leg from there to the stored field is the end-to-end test above. No live crewmate session ran against this branch.Screenshots / video
N/A: a backend MCP tool change. No frontend file is touched and no page renders differently.
Related Issues
Closes #20053
Upstream: kirodotdev/Kiro#11928 (the Kiro CLI defect this works around)
Pattern harvest
Rule candidate: review-prompt
Pattern: an MCP tool argument whose meaning rests on an empty list, an empty object or null, which an MCP client can drop before the server reads it
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)