Originally created by: 5dive-bot
cmd_task_answer signs the DIVE-756 closure in-process only at EUID 0. Every other caller shells
out to sudo -n 5dive gate-proof sign, and a cli-scoped seat holds no grant for it — the else
arm's own _sig_why names that seat class verbatim. Signing is best-effort by design, so the
answer LANDS and the closure stores unsigned; require_sig=1 on the push and deploy root
executors then refuses it later, on the maker's next round-trip, with a message about
tampering and no override flag on that path. Standing to clear and capability to sign were decided
in two different places and nothing lined them up. Measured A/B on two seats, same command, same
hour (DIVE-2159 vs DIVE-3088).
5dive _task_answer — a hidden root primitive in the _push_do / _gh_do family, granted to
every standard agent by render_standard_sudoers (exact command path, parameters over stdin, no
wildcard, sudo-rs safe). 5dive task answer reaches for it automatically on a seat that cannot
sign directly, so nothing changes at the keystroke. A seat that can sign keeps today's path
byte for byte, and any refusal falls through to existing behaviour — this can make a closure
signed and can never make an answer fail.
That reading looks far safer than signing stdin, and is not. /var/lib/5dive/tasks/tasks.db is
rw-rw---- root:claude and every agent seat is in group claude (measured on both a
cli-scoped seat and a root-all one), so a caller writes need_answered_by='human:lodar' with plain
sqlite3 first and then asks for the seal. tasks_db.sh's own note — "a raw-sqlite write that
never ran cmd_task_answer leaves an unsigned/invalid row that gate-proof verify flags" — is the
reason this HMAC exists at all. Narrowing the ARGUMENT (stdin → ident) changes the transport and
never the trust: the payload is caller-authored either way.
So the primitive signs at ANSWER time, from facts it establishes itself:
SUDO_UID under sudo's env_reset, never argv; _gate_uid_to_agent fails closedagent-* passwd row, and root is refused as a non-agent.routed_reviewer or the sealed constitution'shuman:* — every human-evidence form is refused by name, and human=0 iscmd_task_answer at the one point where every raise-site has already runhuman to decide provenance, so a flag added later cannot reopen thecmd_task_answer then runs its own authorization unchanged and signs in-process. EverySelf-clear: a maker may not have its own gate signed — keyed on maker_agent, never
assignee. On DIVE-2159, the acceptance row, assignee=main2, verifier=main2,
maker_agent=dev: assignee holds the VERIFIER on any handed-off row, so an assignee-keyed check
would have refused the one legitimate clear this ticket exists to make signable. Where a row names
no maker the check stays silent rather than guessing.
Answer-once is preserved: an already-answered gate is refused with "no re-sign path — re-file a
fresh gate". An existing unsigned closure cannot be retro-signed by this executor, deliberately.
Existing agents do not get the grant by upgrading. The sudoers drop-in is written at
create/provision time, so main2 — the seat this was built for — is unchanged until it is
re-provisioned. Any seat without the grant keeps today's behaviour exactly: the clear lands
unsigned with the DIVE-2760 notice, and nothing regresses. Merging this does not close the class;
re-provisioning does.
tests/gate_delegated_answer_unit.sh: 28 assertions, 0 failed. It states what it$EUID is a bash builtin and cannot be assigned, so an unprivileged harness cannotsudo shim recorded raw argv, making the capabilityPROBE and INVOKE separately.classify_sudo_grant keeps arender_standard_sudoers emits, so a new grant line lands ashas_other and flags every correctly-provisioned agent as carrying an unrecognized grantextra=1). Baselined on a pristine origin/main worktree, same seat: both PASS there. Fixed,5dive-api, per CLAUDE.md's honest-exit): 12 passed, 1 FAILED —T9 anchor, on UNTOUCHED pristine origin/main of a repo this diff does not touch. RecordedShips on smoke-override — approved by Marcus/agent-main as ship approver, who declared it
before the merge rather than at it. What the override does not cover, recorded as his condition:
the executor's root arms have never executed (everything past the EUID-0 guard is read, not run),
the grant has never been visudo-installed or provisioned onto a seat, no closure has actually
been signed by this path, and existing agents do not get the grant by upgrading.
DIVE-2159 unblocked independently in the meantime (re-filed and routed to a signing lead — PR
[#567]), so this is the durable fix rather than the only one: routing to a signing lead is a
workaround that depends on someone noticing.
Wiki: community/wiki/a-signer-that-reads-an-agent-writable-row-is-a-forge-primitive.md.
Ticket changed by: 5dive-bot