fix(cloud): accept canonical answer receipts

Merged
KH
8h ago
+238-43

Outcome

  • Accept the canonical Cloud answer route response: runId, humanWait, humanAnswer, and next.
  • Require exact run, wait, decision, and normalized note agreement before reporting answerRecorded: true.
  • Read canonical humanAnswer on retries and skip a duplicate answer POST only for the same recorded decision.
  • Refuse missing, competing, cross-run, cross-wait, or otherwise mismatched acknowledgements.

This changes only the SDK client and its composed route-shape tests. It does not answer or resume a live run, publish a package, or deploy Cloud.

Verification

Literal commands and captured output follow in PR comments, including revert/fail/byte-restore/pass mutation evidence.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Updates the Cloud SDK answer flow to accept the canonical answer route response shape (humanAnswer with runId, humanWait, and next receipts) and to strictly confirm acknowledgements before reporting answerRecorded: true.

  • Normalizes and compares notes so a retry with the same trimmed note is treated as identical.
  • Preserves explicit refusals: an error field or ok: false on the answer route now surfaces as an invalid response instead of being treated as a non-confirmation.
  • Refuses mismatched, competing, cross-run, or cross-wait acknowledgements; the legacy answer and ok: true fields are no longer accepted as confirmation.
  • Re-admits the persisted repository grant on resume, forwarding normalized owner/repo values and refusing to infer or widen malformed grants.