Skip to content

feat(delegation): add cancel-ack + force-abort frames and cancel lifecycle states#51

Merged
hishamkaram merged 1 commit into
mainfrom
feat/delegation-cancel-teardown
Jun 25, 2026
Merged

feat(delegation): add cancel-ack + force-abort frames and cancel lifecycle states#51
hishamkaram merged 1 commit into
mainfrom
feat/delegation-cancel-teardown

Conversation

@hishamkaram

Copy link
Copy Markdown
Owner

What

Wire protocol surface for reliable delegation cancel/teardown (producer of a 3-repo feature).

  • MsgDelegationCancelAck + DelegationCancelAckPayload — receipt confirmation for a delegation_cancel (ack→terminal split, modeled on the in-repo GitSyncCancelResponse precedent): Accepted=true means teardown started (terminal delegation_result follows), Accepted=false + redacted Error means it could not start.
  • MsgDelegationForceAbort + DelegationForceAbortPayload — escalation of a stalled cancel.
  • Intermediate states DelegationStateCancelling / CancelStalled / ForceKilled carried in DelegationStatusPayload.State for transient UI. The canonical terminal frame stays delegation_result{status:"cancelled"} so an old PWA self-heals on the result frame.
  • Optional request_id idempotency key on DelegationCancelPayload.

Safety

All new fields omitempty / byte-additive (a pre-feature producer marshals byte-identical JSON). The ack/force-abort frames are pure control-plane signals: a no-content-on-wire test pins their key set to session IDs + request_id + accepted + redacted error only — never delegate output, inherited context, or diffs.

Tests

Round-trip + omitempty + lifecycle-state-constant + message-type-constant + no-content-on-wire tests. go vet, go build, go test -race -count=1 -p 4 (coverage 88.6% ≥ 83%), golangci-lint 0 issues — all green.

Producer-first

This is the producer in a cross-repo feature; it merges + tags FIRST, then agentd re-pins its go.mod and agentd + agentd-web follow.

…cycle states

Wire surface for reliable delegation cancel/teardown:
- MsgDelegationCancelAck + DelegationCancelAckPayload: receipt confirmation for a
  delegation_cancel (ack to terminal split, modeled on GitSyncCancelResponse).
- MsgDelegationForceAbort + DelegationForceAbortPayload: escalation of a stalled
  cancel.
- Intermediate states DelegationStateCancelling / CancelStalled / ForceKilled on
  DelegationStatusPayload.State. The canonical terminal frame stays
  delegation_result{status:"cancelled"} so old clients self-heal.
- Optional request_id idempotency key on DelegationCancelPayload.

All new fields omitempty / byte-additive. Round-trip, omitempty, lifecycle-state,
and no-content-on-wire security tests included.
@hishamkaram hishamkaram merged commit 978924e into main Jun 25, 2026
1 check passed
@hishamkaram hishamkaram deleted the feat/delegation-cancel-teardown branch June 26, 2026 09:06
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