Repository navigation
π fix(adminmcp): budget.reset, backup.create and the circuit breaker ops preview again - #16885
Conversation
β¦ops preview again
write_preview refused the four write ops whose preview carries no details
(budget.reset, backup.create, circuit_breaker.engage and
circuit_breaker.release) with "contains a confirmation value that cannot
be stored". The pending-confirmation scrub turned their nil details into
{} and the unpersistable check compares a value with its scrubbed copy as
JSON, so null against {} read as a masked value.
scrubPendingValue now leaves nil maps and lists as nil. Credential-bearing
values are refused as before.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Evidence bundle `#16885c165011` sha256:cf9c76fe23071c6ddcee18f830aba5bafb479def85c497e427a9587a809e97e3 β download from the dashboard or `hivectl review evidence #16885`.Review findings from Looks correct to me, and the mechanism is as described.
The new test previews and confirms all four affected operations through |
There was a problem hiding this comment.
Traced the mechanism in the v6 tree and it holds. pendingValueNeedsFreshConfirm (src/pkg/adminmcp/adminmcp.go:564-569) marshals a value and its scrubPendingValue copy and refuses on any byte difference; PreviewWrite calls it on preview.Details (adminmcp.go:558). For a typed-nil map[string]any, the old map case did make(map[string]any, 0) unconditionally, so null became {} and the comparison failed for every op that sets no Details β not a scrub concern at all, just a nil/empty encoding mismatch. Returning the nil map, nil []any and nil []string unchanged is the minimal correct fix; a non-nil empty map still round-trips to {} as before, and scrubPendingPreview's own != nil guards at :584/:589 are unaffected.
The three new tests cover the four detail-less ops end to end, assert every argument-less registered op previews with no args (so the next one cannot regress), and pin the nil-preservation directly. Looks correct to me.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Summary
Four registered admin MCP write operations could not be used at all.
write_previewrefusedbudget.reset,backup.create,circuit_breaker.engageandcircuit_breaker.releaseevery time, on both transports, so an operator could not engage the fleet circuit breaker, reset the budget window or take a backup through MCP. This PR makes them preview and confirm like every other operation. Nothing changes for the other operations.What went wrong
The refusal was:
That message is meant for a preview that carries a credential. These four operations carry none. They take no arguments and their preview has no
details.Before a preview is stored, the handler scrubs it and compares the scrubbed copy with the original. The scrub turned the empty (nil)
detailsinto{}. The comparison is done on JSON, sonulldid not equal{}, and the preview was treated as if a value had been masked.The four operations were added on 2026-09-24. The check that refuses them was added three days later, and no test ran these operations through
write_preview.What changes
The scrub leaves a nil map or list as nil. A value that really holds a credential is refused exactly as before.
Files
src/pkg/adminmcp/adminmcp.go:scrubPendingValuekeeps nil maps and lists.src/pkg/adminmcp/write_contract_test.go: three new tests.changelog.d/fixed-admin-mcp-detail-less-write-ops.mdTests
TestDetailLessWriteOpsPreviewAndConfirm: each of the four operations previews, confirms, and executes the right request.TestArgumentLessWriteOpsPreviewWithNoArgs: every registered operation with no arguments previews with none, so a new one cannot ship refused the same way.TestPendingScrubKeepsNilValues: nil values pass the check, and a credential-bearing key is still caught.v6without the fix and pass with it.go test ./pkg/adminmcp/ ./cmd/hive-admin-mcp/and theAdminMCPtests in./pkg/dashboard/pass.π€ Generated with Claude Code