Repository navigation
Description
Summary
Dashboard clarification answers are currently marked done before the requesting agent has durably received or acknowledged them.
At 95e95e4a2fecace23078aac40e33158ce9040f21, answer-clarification!:
- writes the response directly to
clarifications/done/withstatus: done; - deletes the pending request;
- injects the full answer into the role's tmux pane.
However, inject-role! catches and logs every exception without returning failure, so the POST still returns { "ok": true } when the tmux target is missing or injection fails. There is no requesting-role claim/acknowledgement step. The durable file proves that the operator answered, not that the agent consumed the answer.
Relevant code:
User-visible failure
If the role pane is absent, busy, or loses the injected keystrokes:
- Attention removes the question because it is already in
done/; - the API reports success;
- the agent remains blocked;
- restarting tmux does not replay the answer;
- no state distinguishes “operator answered” from “requesting agent acknowledged.”
This is the Q&A form of the durable-payload / best-effort-wake split described in #34.
First bounded slice
Introduce a durable clarification lifecycle with an explicit agent acknowledgement:
pending -> answer_ready -> acknowledged
pending: awaiting the operator;answer_ready: the answer is durable and can be fetched by the requesting role;acknowledged: the requesting role explicitly confirms it has consumed the answer.
Tmux injection remains useful, but only as a wake hint. It must not be the answer transport or the acknowledgement mechanism.
The exact filenames and command names are implementation choices. A project-local helper must let the requesting role retrieve an answer by clarification ID after process/tmux restart and acknowledge it explicitly.
Acceptance criteria
- AC-01 — Durable-before-wake: The answer is atomically persisted as
answer_readybefore any tmux wake attempt. - AC-02 — Honest state: A missing/failing tmux target leaves the clarification
answer_ready; it is never reported as agent-acknowledged. - AC-03 — Restart recovery: After dashboard, daemon, or tmux restart, the original requesting role can retrieve the exact answer by clarification ID without relying on pane history.
- AC-04 — Explicit acknowledgement: Only the requesting role's acknowledgement transition changes
answer_readytoacknowledged. - AC-05 — Same-answer idempotency: Repeating the answer POST with identical normalized text returns the existing result and creates no duplicate state or delivery.
- AC-06 — Conflict detection: Repeating the answer POST with different text returns HTTP 409 and preserves the first durable answer.
- AC-07 — Concurrent answers: When two different answers race, exactly one becomes durable and the loser receives HTTP 409; no partial/mixed response is observable.
- AC-08 — Input validation: A blank/whitespace-only answer returns HTTP 400 and leaves the clarification
pending. - AC-09 — Atomic lifecycle: At every observable point, one clarification ID exists in exactly one lifecycle state; crashes cannot leave it missing or present in multiple states.
- AC-10 — Correlation: The durable record preserves at least clarification ID, project, requesting role, question, answer, creation time, answer time, and acknowledgement time.
Required regression scenarios
Start with failing tests for:
- tmux socket/target absent when the operator answers;
- crash after answer persistence but before wake;
- dashboard restart followed by role retrieval and ACK;
- duplicate POST with the same answer;
- duplicate POST with a different answer;
- two concurrent answer POSTs;
- blank answer;
- crash during each filesystem transition.
Tests should assert API status/body, durable filesystem state, role ownership, replay behavior, and final acknowledgement—not only that injected text was constructed.
Non-goals for this issue
- Redesigning lieutenant chat or free-form inter-agent messaging.
- Adding timeouts, escalation policy, or stale task-revision rejection; those can follow once ACK semantics exist.
- Replacing tmux as the wake mechanism.
- Adding task/revision causality beyond the minimum correlation record above.
Activity