Repository navigation
Code Mode approvals: if the host crashes between executing and applied, can an approved action run twice?
#3117
Replies: 3 comments 1 reply
|
Auditing 1. Crash between
|
|
@LucasValeQueiroz, thank you. That's a precise answer, with the code paths, and it settles both questions. So, today: an approval-gated call left in Two small things would make that case visible afterwards, without changing the at-least-once behaviour:
That's the exact shape AMEP checks from the evidence side: an approval used by a call whose outcome is unknown is held, and if the first run is later shown to have taken effect, the second is a double use ( If either change is welcome, I'm happy to describe it in an issue in whatever form you prefer, since external PRs aren't accepted here. |
|
@LucasValeQueiroz following up: I turned your trace into a reproduction and a small patch, filed as #3134. The patch adds an attempt count on |
Uh oh!
There was an error while loading. Please reload this page.
I wrote AMEP, an open protocol (IETF individual draft) for checking afterwards whether an agent's actions stayed within what was approved. I've been reading Code Mode's runtime docs with that in mind, and have one question.
docs/codemode/runtime.mdsays a call is loggedexecutingwhen the runtime decides to run it, and flips toappliedonce its result is recorded, so "a crash between those two points replays as a fresh execution". For a read that's the right trade-off. For a call withrequiresApproval: true, it seems to mean that one human approval can lead to the action running twice, if the first run took effect before the crash.executingdifferently, for example by pausing again for a new approval?I ask because this is the case where someone reading the log later can't tell whether the approved action ran once or twice. It's also a weak spot in AMEP: it can only hold the approval if the log records that the first call's outcome is unknown, and a runtime that replays silently leaves no such record. AMEP holds the approval in that state: while the first call's outcome is unknown, a second use of the approval is
unresolved, and if the first call turns out to have run, the second is a violation (vectorapproval-held-for-an-earlier-call-with-an-unknown-outcome, https://github.com/stafordtituss/amep/tree/main/vectors).If Code Mode's log already distinguishes this case, I'd like to write it up as an example in AMEP's docs, with a link to your runtime docs. If it doesn't, the vector is free to use as a regression case.
All reactions