Skip to content

fix(remediation): read lease replies through the controller's envelope - #71

Merged
mattmattox merged 1 commit into
mainfrom
fix/lease-response-envelope
Oct 26, 2026
Merged

mattmattox merged 1 commit into
mainfrom
fix/lease-response-envelope

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

With remediation.coordination.enabled, every lease read as denied: the controller replies {success, data: LeaseResponse, timestamp} (writeSuccess), the agent decoded the body as a bare LeaseResponse, so approved was the zero value. Remediation never ran under coordination, and the granted lease stayed held until expiry, blocking other nodes too.

The mock in lease_client_test.go returned an unwrapped body, so the tests agreed with the bug. Mocks now use controller.APIResponse, and lease_client_controller_test.go runs the client against the real controller handler (grant, and deny over maxConcurrentRemediations). Both new tests fail on main and pass here; pkg/remediators, pkg/controller, cmd/... pass with -race.

Only affects clusters running the controller with coordination on (no controller image is published today).

🤖 Generated with Claude Code

The controller wraps every reply in {success, data, timestamp}, but the
agent's lease client decoded the body straight into LeaseResponse, so
approved was always false. With coordination on, every remediation was
refused even when the controller granted the lease, and the granted
lease stayed held until it expired.

The unit tests mocked an unwrapped reply, so they agreed with the bug.
They now send the real APIResponse shape, and two new tests run the
lease client against the real controller handler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit bfd23b4 into main Oct 26, 2026
9 checks passed
@mattmattox
mattmattox deleted the fix/lease-response-envelope branch October 26, 2026 16:45
mattmattox added a commit that referenced this pull request Oct 26, 2026
…and #72 (#73)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant