Repository navigation
fix(mcp): let dashboard_write clear an object field with clear: true - #20241
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the Suggestions
[DESIGN-REVIEWED] 221ad46 Description read[DESCRIPTION-READ] f9cc8e426a202962c4668de34452bb4da66714a4b3b1a08e66d5c50e439e2ff9 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 to check. What this change shipsInventory (6 items) — 6 justifiedIntent: an agent can empty an object field on the dashboard (such as goal-board
[FIRST-PRINCIPLES-REVIEWED] 221ad46 Description read[DESCRIPTION-READ] 9b73b10bec9d61f7de451fbb6076d4e10ba3dade4d228a2656458d0adc55322c 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: |
iamwhatever
left a comment
There was a problem hiding this comment.
Request changes at 56a74f7.
The core fix is sound: clear: true on an object field now writes {} and the end-to-end test covers it. Two things need fixing before approval, and none of the Design, First Principles or Opus items have a reply yet.
- The owning spec contradicts the code. dashboard-instances.md#L24 says string/number/boolean fields "are refused before the POST", but
_empty_value_forreturns[]for them and lets the gateway refuse withwrong_type/field_not_agentic. The description's Not a goal and Tests sections say the same old thing (test_clear_on_a_string_field_is_refused_before_the_gatewayno longer exists). Smallest fix: change the spec sentence and the description to say non-object clears go to the write route, which refuses them; optionally drop the redundantif row is Nonebranch. - Array clears gained a new failure mode. mcp_panel.py#L1027 returns an error when the fields GET fails, so a clear that only needed the write route before now fails, while the description says no working call stops working. Smallest fix: on a GET failure fall back to
[](the old behaviour) and let the gateway type-check, or name the new dependency in Backwards compatibility.
Please post a disposition for each Design / First Principles item after the change. Checks on this head are green.
— crew-pr-reviewer (r100)
When clear: true is passed to dashboard_write, the panel server now
reads the field's declared type from the dashboard/fields route and
writes the matching empty value: [] for array fields and {} for object
fields. Previously only [] was written, which the gateway refused as
wrong_type for object fields (asks, drafts, steps). Calls that pass a
value are unchanged.
Closes #20089 (part 2; part 1 is #20144)
_empty_value_for returns {} for an object field and [] for every other
field, including string, number, boolean and fold-sourced fields,
instead of refusing early. The write route then refuses those with
wrong_type or field_not_agentic and records the refusal in the mistake
book; an early refusal duplicated the gateway's check and bypassed the
book.
A field list that cannot be read also gets [], the value clear: true
wrote before object fields were supported, so emptying an array field
does not depend on the fields route answering. The owning spec now
says the same instead of claiming scalar clears are refused before the
POST.
56a74f7 to
221ad46
Compare
|
self-added: yes
fixed in 221ad46
|
|
self-added: yes
fixed in 221ad46
|
|
self-added: yes
fixed in 221ad46
|
|
self-added: yes
fixed in 221ad46
|
rebutted
|
|
self-added: yes
fixed in 221ad46
|
|
Thanks for the review. Both items are addressed in 221ad46. The PR is still 2 commits, and both commit messages are reworded so the squash message matches the code.
Each Design, First Principles and Opus item has its own disposition comment on this PR. Could you take another look? |
rebutted
|
rebutted
|
mbriones98
left a comment
There was a problem hiding this comment.
Checks green and readiness passed at 221ad46; no behavior change.
iamwhatever
left a comment
There was a problem hiding this comment.
APPROVE at 221ad46.
Both items from my r100 change request are fixed. The spec now says string, number, boolean, fold-sourced and unknown fields reach the write route, which refuses them and records the refusal (dashboard-instances.md). A failed fields read falls back to [], so array clears no longer depend on the fields route (mcp_panel.py L1014-L1036). The fields route it reads is side-effect free, and _get returns an error dict rather than raising.
All current-head AI lanes are PASS or no findings. The Design punchline and its optional suggestion both have evidence-backed replies. The tests cover object, array, scalar and unknown fields, the four unreadable-list cases, and an end-to-end clear of asks to {}. CI on this head is green. I read the code and tests; I did not run them.
— crew-pr-reviewer (r102)
Problem / Motivation
Goal: Let
dashboard_writewithclear: trueempty an object field by writing{}instead of always writing[].When
clear: trueis passed todashboard_write, the handler always wrote[]. For object fields (asks,drafts,steps), the gateway refused that write withwrong_type, left the field unchanged, and added awrong_typeentry to the mistake book. The only way to clear an object field was to passvalue: {}directly, but an MCP client dropsvalue: {}before it reaches the server.This is part 2 of #20089; part 1 is #20144.
Why it matters
An agent tracking answered goal-board questions has no way to clear
asksonce it is empty -- everyclear: truecall fails with a gateway error and teaches the model the wrong spelling. The mistake book entry then re-appears on the next read, causing the agent to keep retrying a write that will never succeed.Not a goal
DASHBOARD_WRITE_SCHEMAarrayandobjectwithclear(string, number, boolean are now refused at the panel layer with a clear message)valueWhat changed
Root cause:
_call_tool_innerhardcodedto_write = []for everyclear: truecall, regardless of the field's declared type.Fix: added
_empty_value_for(field, sk), which reads the field list from/api/agent-panel/dashboard/fields(the same routedashboard_fieldsuses) and returns{}for an object field and[]for any other field. The panel server does not refuse a clear for the field's type or source: a string, number or boolean field, a fold-sourced field and an unknown field all go to the write route, which refuses them withwrong_type,field_not_agenticorunknown_fieldand records the refusal in the mistake book. If the field list cannot be read (the GET fails or returns no list), the server writes[]. The tool description andclearparameter description are updated to say "array or object field".validation.pynow acceptsvalue: {}besideclear: true(redundant but unambiguous), and its error text and theDASHBOARD_WRITE_TOOL_SCHEMAcomment are updated. The owning spec,docs/system-specs/modules/dashboard-instances.md, describes the same behaviour.Correction to "Not a goal": its second bullet says string, number and boolean fields "are now refused at the panel layer with a clear message". That described an earlier revision of this PR. In the code as it stands, those fields reach the write route and are refused there, as described above. The Goal, Why it matters and Not a goal sections stay as written when the PR opened, so the correction is recorded here.
Backwards compatibility
Compatible: no call that works today stops working. Calls with
valueare unchanged. Calls withoutvalueand withoutclearare unchanged. Calls withclear: trueon array fields still get[](the field list confirms the type). If the field type cannot be read,clear: truewrites[], as it did before this PR, so clearing an array field does not depend on the fields route; each clear makes one extra GET to that route before the write.clear: trueon an object field now succeeds instead of failing, andvalue: {}besideclear: trueis accepted likevalue: []. The refusal for any other value besideclear: truenow reads "clear: true writes the field's empty value, so pass it without a value" instead of "clear: true writes an empty list, so pass it without a value".Removes nothing: no existing capability is removed or renamed.
Tests
Unit (
TestDashboardWriteClear, 28 cases):test_clear_posts_an_empty_list_for_an_array_field-- array field gets[]test_clear_posts_an_empty_object_for_an_object_field-- object field gets{}test_clear_beside_an_empty_object_is_the_same_write--value: {}besideclearis treated as a cleartest_clear_on_a_scalar_field_falls_through_to_the_gateway-- string field gets[], and the write route'swrong_typerefusal comes back wholetest_clear_on_an_unknown_field_posts_an_empty_list_for_the_route_to_refuse-- unknown field gets[], so the write route gives its own refusaltest_clear_posts_an_empty_list_when_the_field_list_cannot_be_read-- the fields GET returns an error, a refused connection, nofieldskey, or afieldsvalue that is not a list; the write still posts[](4 cases)End-to-end (
test_clear_through_the_panel_server_empties_an_object_field): drives the full path frommcp_panel._call_toolover loopback HTTP to the real route, reads back, asserts value is{}with nowrong_typemistake entry.Existing
test_clear_through_the_panel_server_empties_an_array_fieldstill passes.Manual verification
N/A -- unit and end-to-end coverage sufficient. This is a pure backend change with no user-visible UI surface.
Screenshots / video
N/A -- backend tool change only, no frontend surface modified.
Related Issues
Closes #20089
Pattern harvest
Rule candidate: agents-md
Pattern: a
clearflag that maps to a single hardcoded empty value ([]) fails for fields whose type is not that value; read the field's declared type at the call site and dispatch to the matching empty value.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.