Recover a tool call after a lost response
Make a retried return submission commit exactly once.
Your task
Simulate sequential deliveries of write requests. Each input request contains session, key, order, and optional lost. The order string is the entire request payload. On the first occurrence of (session, key), record one write and remember its payload. On a repeat with the same payload return committed without writing again. The same key in another session is independent. Reuse of the same (session, key) with another payload returns conflict and does not write. For a committed response, lost: true changes the visible response to timeout, leaving the commit intact. A conflict always returns conflict. Return responses in request order and writes as [session, order] pairs in commit order.
Expected behavior
A client can retry after an ambiguous timeout using the same key. The original commit still counts and the retry adds no side effect.
Examples
{"requests":[{"key":"k","order":"A","session":"one","lost":true},{"key":"k","order":"A","session":"one"}]}{"responses":["timeout","committed"],"writes":[["one","A"]]}{"requests":[{"key":"k","order":"A","session":"one"},{"key":"k","order":"A","session":"two"}]}{"responses":["committed","committed"],"writes":[["one","A"],["two","A"]]}{"requests":[]}{"responses":[],"writes":[]}Before you begin
- Python functions, lists, and dictionaries
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.