Skip to content

fix(sentinel): distinguish confirmed_with_err from not_confirmed (closes #300)#301

Merged
rz1989s merged 1 commit into
mainfrom
fix/issue-300-verify-signature-confirmed-with-err
May 23, 2026
Merged

fix(sentinel): distinguish confirmed_with_err from not_confirmed (closes #300)#301
rz1989s merged 1 commit into
mainfrom
fix/issue-300-verify-signature-confirmed-with-err

Conversation

@rz1989s
Copy link
Copy Markdown
Member

@rz1989s rz1989s commented May 23, 2026

Summary

  • verify-signature.ts: add confirmed_with_err variant to VerifyResult.reason and label the err-branch with it instead of not_confirmed
  • tool-signing.ts: in strict mode, surface confirmed_with_err as a 400 envelope transaction was confirmed on-chain but the program returned an error: <detail> and reject the pending entry with program_error: <detail> so the agent layer relays the real error instead of cancelled_by_user
  • Tests: rename + update the existing verify-signature err test, add a new tool-signing-routes test asserting the new envelope and reject reason

Closes #300. Filed alongside #299 (CF 504 follow-up, post-Frontier).

Why this matters

Discovered during frontier_sip_18 autonomous prod smoke test of PR #298. A real signed tx that confirmed on-chain with AnchorError 3012 was reported to the user as "tx cancelled / verify_failed: not_confirmed" — wrong on both counts. Two layers of misleading copy in front of Frontier judges scoring 2026-05-27.

Before:

chat: "Your transaction was cancelled (verification_failed: not_confirmed)"

After:

chat: "transaction was confirmed on-chain but the program returned an error:
       {\"InstructionError\":[0,{\"Custom\":3012}]}"

Blast radius

  • New confirmed_with_err reason is additive — no existing consumer switches exhaustively on VerifyResult.reason, verified via grep for assertNever usage in this codebase
  • Existing not_confirmed consumers (tool-signing.ts:74 Retry-After path, the FE error rendering) compile unchanged
  • The fallback branch in tool-signing.ts still handles not_confirmed and wallet_mismatch identically to before

Test plan

  • pnpm typecheck clean (root + sdk + app + agent)
  • pnpm test -- --run (agent: 1648, app: 577, sdk: 96, root: 555 — total 2876 green)
  • Manual repro plan post-merge: ask sipher chat to claim/withdraw against S1Phr5rmDfkZTyLXzH5qUHeiqZS3Uf517SQzRbU4kHB from a wallet without prior deposit. Expected behaviour: agent says the program rejected the tx and surfaces the AnchorError, NOT "tx cancelled".

When verifySignature sees a confirmed tx whose program returned an
error, it previously labelled it not_confirmed. tool-signing.ts then
rejected the pending entry with verification_failed: not_confirmed,
agent.ts wrapped that as cancelled_by_user, and the LLM told the user
"tx cancelled". The tx had actually landed on-chain — the program just
rejected it.

Adds a confirmed_with_err variant to VerifyResult and a strict-mode
branch in tool-signing.ts that rejects with program_error: <detail>
and returns a 400 envelope explaining the program rejected the tx.
The LLM now relays the actual on-chain error to the user instead of
implying they cancelled.

Closes #300
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sipher Ready Ready Preview, Comment May 23, 2026 2:12pm

@rz1989s rz1989s merged commit f37e0b5 into main May 23, 2026
8 checks passed
@rz1989s rz1989s deleted the fix/issue-300-verify-signature-confirmed-with-err branch May 23, 2026 14:13
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.

fix(sentinel): distinguish confirmed_with_err from not_confirmed so chat stops saying "tx cancelled" when the program rejected the tx

1 participant