Skip to content

fix(dashboard): let dashboard_write empty an array field with clear - #20068

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/dashboard-write-clear-20053
Oct 14, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/dashboard-write-clear-20053

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A crewmate can empty an array field on its dashboard, such as an answered Needs-you list, with dashboard_write.

dashboard_write with {"field": "for_you", "value": []} answers Error: value: required, the same answer as a call with no value at all. Kiro CLI (measured on 2.31.0) drops an empty list, an empty object and a top-level null from a tool call's arguments before the MCP server reads them. So value: [] reaches the kirocrew-panel server as no value, and the server refuses it as missing. A crewmate can replace the last card in needs_you or for_you with 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

  • Fixing the drop in Kiro CLI itself. It is a client defect; this PR works around it for dashboard_write only.
  • Emptying an object field (asks, drafts, steps) or a string field. clear: true writes [], and the write route refuses [] for a field that is not an array.
  • Other MCP tools that take an empty list as an argument.
  • Changing the gateway write route /api/agent-panel/dashboard/write or its body schema DASHBOARD_WRITE_SCHEMA.

What changed (motivation → approach → change)

dashboard_write takes an optional boolean clear, and clear: true with no value empties an array field. A boolean argument reaches the server intact, so the flag survives the client that drops value: [].

Call Before After
any call with a value posted as is posted as is
clear: true, no value Error: clear: unknown field ... posts value: []
clear: true with value: [] refused the same write as clear: true
clear: true with another value refused Error: clear: true writes an empty list, so pass it without a value
no value (how value: [] arrives) Error: value: required Error: value: required -- ..., plus a sentence naming clear: true
value: "" Error: value: required (empty after sanitization) the same text

The panel server (mcp_panel.py) turns clear: true into value: [] before it posts. The gateway route and DASHBOARD_WRITE_SCHEMA therefore 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_SCHEMA in validation.py. value is optional there, and a custom check keeps it required unless clear is true. The tool's description and inputSchema name clear, and required is ["field"]. dashboard-instances.md records why the flag exists.

Backwards compatibility

Compatible: a call that passes value posts that value exactly as before, and the write route, its body schema and every field's type check are untouched. clear is optional. A call with nothing to write is still refused, and its error still starts with value: 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.py TestDashboardWriteClear, 20 cases, each through the server's _call_tool so the argument schema runs: clear: true posts []; clear beside [] is the same write; clear beside any other value is refused before the gateway; a missing value, null and clear: false are refused with value: required and name clear: true; "" keeps its exact refusal; a non-boolean clear is refused; six kinds of value are posted unchanged; the advertised schema carries clear and requires only field.
  • test_agent_panel_routes.py test_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-empty needs_you, clears it, and reads [] back from the field list. It binds the panel server's _post to the real HTTP client itself, because conftest's autouse gateway_posts recorder would otherwise be what the server binds when the test is the first to import it; so it passes run alone as well as beside test_mcp_panel_runtime.py.
  • prove.py: PROVEN. With the production hunks reverted, an assertion in the new tests fails.
  • Determinism: the new tests passed 20 runs together at -n0, the end-to-end test 20 runs alone at -n0, 10 runs at -n 2 --dist loadgroup --max-worker-restart=2 beside test_mcp_panel_registration.py and their own files, and one shuffled run of both changed test files (seed 23346, 218 passed). The local runs used -n 2 where testing-conventions asks for -n 4.
  • Local gates: black, isort, flake8, mypy over the whole package (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 with KIROCREW_PORT=1 so an unstubbed request cannot reach a running gateway. validation.py is 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: {} and value: null arrive without value, and clear: true arrives 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 14, 2026 02:32
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision b94d516f14dfac683f57b10694ebafe7287be63d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of b94d516f14dfac683f57b10694ebafe7287be63d — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Nothing in this diff runs real Kiro CLI against kirocrew-panel itself. The PR's claim that the client drops value: [] but keeps clear: true rests only on its echo-server measurement.

What this change ships

Inventory (6 items) — 6 justified

Intent: let a crewmate empty an answered Needs-you or For-you list on its dashboard, which Kiro CLI makes impossible today by dropping value: [] from the call. This is a FIX for #20053, and the upstream defect is out of scope by the stated Goal. The optional boolean follows the existing clear boolean in mcp_tools/control.py:944, so it is not a new idiom.

  1. dashboard_write takes clear: true with no value, which empties an array field — justified
  2. The tool's advertised required drops value, leaving only field — justified
  3. A call with nothing to write gets a longer refusal that points to clear: true — justified
  4. clear: true together with a non-empty value is refused before the gateway — justified
  5. The panel server checks arguments against a new DASHBOARD_WRITE_TOOL_SCHEMA; the gateway route keeps DASHBOARD_WRITE_SCHEMA — justified
  6. A paragraph in the dashboard-instances.md spec — justified

[FIRST-PRINCIPLES-REVIEWED] b94d516

Description read

[DESCRIPTION-READ] 448cc0fc95a2991a05ebc5c300f0f977d8e0f6df4d1d9988da4c009b45170736

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of b94d516f14dfac683f57b10694ebafe7287be63d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed b94d516f14dfac683f57b10694ebafe7287be63d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] b94d516

Verdict parsed from the review's SHA-scoped output markers for commit b94d516f14dfac683f57b10694ebafe7287be63d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable b94d516f14dfac683f57b10694ebafe7287be63d: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of b94d516f14dfac683f57b10694ebafe7287be63d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b94d516

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b94d516f14dfac683f57b10694ebafe7287be63d: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 14, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/dashboard-write-clear-20053 branch from 52236f9 to 5f13ed4 Compare October 14, 2026 03:39
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Rebased onto main 70d2fa6a (main moved in files this PR's tests import, 328f749e -> 70d2fa6a), and the end-to-end test test_clear_through_the_panel_server_empties_an_array_field binds the panel server's _post to the real HTTP client itself, so it passes run alone and not only beside test_mcp_panel_runtime.py. New head 5f13ed45; CI re-running.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Checked live on Kiro CLI 2.31.0, from a Kiro Crew session calling a Kiro Crew MCP tool through the same deferred tool_call path a crewmate uses. work_brief refuses any argument, so a key that arrives is named in the refusal: {"clear": true} and {"clear": false} were each refused as clear: unknown field for tool 'work_brief', so the boolean arrived intact, while {"value": []} returned a normal brief, so the empty list was dropped before the server.
Past the client, the gateway's MCP backend rewrites only params._meta and never touches params.arguments, and the panel server's own leg into the write route and the store is test_clear_through_the_panel_server_empties_an_array_field.
What no test covers is a crewmate model choosing clear: true; the tool description and the value: required refusal both name it. No crewmate session ran against this branch.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Re-measured today on Kiro CLI 2.31.0, the version installed here, in a live Kiro Crew session through the deferred tool_call path: work_brief, which refuses any argument, returned a normal brief for {"value": []} and {"probe": []} (the keys never arrived) and refused {"probe": [1]}, {"clear": true} and {"clear": false} as unknown fields (they arrived).
The drop is also on record outside the echo-server runs: two real dashboard_write calls on a running gateway, made with value: [] and value: null, were each answered Error: value: required and left a validation_failed audit row and no write-route access row of its own, while every write that landed logs one just before its completed row.
The flag does not depend on the drop lasting: once Kiro CLI delivers value: [], that call posts unchanged, and clear: true beside value: [] is the same write. Upstream report: kirodotdev/Kiro#11928.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@chenmingwei23
chenmingwei23 enabled auto-merge (squash) October 14, 2026 05:21
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 14, 2026
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
@chenmingwei23
chenmingwei23 force-pushed the fix/dashboard-write-clear-20053 branch from 5f13ed4 to b94d516 Compare October 14, 2026 06:23
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Rebased onto main ae9e29e3 to clear the conflict with #18851 in validation.py: MCP_PANEL_SCHEMAS keeps dashboard_write on its tool schema, with dashboard_save beside it. Gates re-run on this tree. New head b94d516f; CI re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 14, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Kiro CLI against kirocrew-panel itself is on record for the drop: two real dashboard_write calls on a running gateway, through Kiro CLI 2.31.0 and the deferred tool_call path a crewmate uses, where the model sent value: [] and value: null. Each was answered Error: value: required and left a validation_failed audit row and no write-route access row.
The boolean leg was measured live on the same Kiro CLI and path against a Kiro Crew MCP server whose schema refuses any argument (work_brief): {"clear": true} and {"clear": false} were refused as unknown fields, so they arrived, while {"value": []} got a normal reply, so it was dropped.
On that path the client rebuilds arguments from the model's streamed JSON under one record(any) schema for every target tool, so kirocrew-panel's own inputSchema does not change what arrives.
No live clear: true call was made against a person's real dashboard; the leg from the panel server to the stored field is test_clear_through_the_panel_server_empties_an_array_field.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readiness sweep: full diff read, PR Readiness success on this head, no live change requests or blocking threads. No regression found.

@chenmingwei23
chenmingwei23 merged commit c965303 into main Oct 14, 2026
102 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/dashboard-write-clear-20053 branch October 14, 2026 09:24
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dashboard_write cannot empty an array field: an empty list never reaches the server

2 participants