Skip to content

fix: scope suspend cancellation classification - #273

Merged
Anish Ramasekar (aramase) merged 1 commit into
agent-primitives:mainfrom
Tatsinnit:fix/271-scope-suspend-cancellation
Nov 14, 2026
Merged

Anish Ramasekar (aramase) merged 1 commit into
agent-primitives:mainfrom
Tatsinnit:fix/271-scope-suspend-cancellation

Conversation

@Tatsinnit

Copy link
Copy Markdown
Contributor

Summary

  • limit the cancellation classification added in fix: preserve suspend journal failures after cancellation #271 to public Suspend calls
  • keep Exec/Resume approval-handoff snapshot failures on their existing operational-error path
  • add a deterministic approval-handoff regression and clarify the compatibility contract

Context

Follow-up to the non-blocking review note on #271: p.suspend also serves handoffPark, where a non-nil cursor commits the automatic approval-gate SUSPEND under the turn fence. Classifying that snapshot from the caller context would change Exec/Resume behavior outside #260.

Both public Suspend entry points pass a nil cursor; approval handoff is the only non-nil caller. The patch therefore applies callerContextError only to the nil-cursor path.

The regression cancels the exact Exec context synchronously as the approval-handoff snapshot begins, injects a snapshot failure, and verifies that the operational cause remains while ErrAdmissionInterrupted is absent.

Verification

  • go test ./placement -run '^TestPlacementApprovalHandoffPhases$' -count=10
  • go test -race -shuffle=on ./placement ./session
  • go vet ./placement ./session
  • go build ./...
  • go run ./hack/doccheck
  • git diff --check
  • gofmt -l .

Follow-up to #271.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues requiring resolution for the snapshot cancellation classification change.

No open issues 🎉

What changed in this PR

This follow-up to #271 limits snapshot cancellation classification to public Suspend calls, preserving the existing operational-error behavior of Exec/Resume approval handoffs.

Changes:

  • Apply caller-context classification only when the shared suspend helper receives a nil cursor.
  • Add a deterministic regression that cancels Exec during an approval-handoff snapshot failure.
  • Clarify the compatibility contract in the specification and existing changelog fragment.
File Description
spec.md Distinguishes public Suspend cancellation from approval-handoff failures.
placement/​placement.go Restricts snapshot cancellation classification to public Suspend.
placement/​approval_test.go Verifies canceled handoff snapshots preserve the operational cause without an interruption marker.
changelog/​unreleased/​error-reasons-compat.md Documents preserved approval-handoff error classification.

Review effort: Balanced

@aramase Anish Ramasekar (aramase) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks for the quick follow-up. Scoping the wrap to the nil-cursor path keeps the approval handoff on its pre-#271 behavior, and the new row fails without the fix.

One optional nit outside the diff: the ErrAdmissionInterrupted godoc (placement/placement.go:66-71) and admissionInterruptedCode (session/service.go:1281-1283) still say any "runtime operation". Scoping that to public Suspend/Fork, as spec.md now does, would keep them in sync.

}
desc, _ := har.Describe(t.Context())
b := &approvalBackend{Backend: substrate.New(ctl, "space", substrate.ObjectRef{Name: "gate"}, desc)}
ctx := t.Context()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit (optional): Resume reaches the same handoffPark path, so a Resume variant of this row would pin the spec's "Exec/Resume" wording if the two paths ever split.

@aramase
Anish Ramasekar (aramase) merged commit 78a368b into agent-primitives:main Nov 14, 2026
20 checks passed
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.

3 participants