You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SafetyOverride.renew() — the human-initiated renewal of a time-limited safety override (YOLO) grant — commits the extended deadline and then writes its SEL audit event non-critically. If the audit write fails, the failure is swallowed (_log_sel only re-raises when critical=True) and auto-approval stays extended with no record that it was.
Why
Every other path in this file that creates auto-approval authority already fails closed the other way round:
_commit_activation audits with critical=True before committing and returns an inactive result if the write fails. Its comment: "Audit BEFORE committing — fail-closed with no race window".
activate_scoped does the same: "Fail-closed audit before commit — no grant without a trace."
renew() extends the same authority those paths are careful about, so the asymmetry looks unintentional rather than reasoned — an auditor reconstructing "when was auto-approval live?" from the SEL log can be silently missing a renewal that happened.
This was surfaced while reviewing #2443, which added renew_lease() (the machine-issued counterpart). That method was flagged for exactly this weakness and now audits critically before committing, with the commit block re-verifying the guard because the audit runs with the lock released. renew() was deliberately left alone there to keep a focused change reviewable — hence this issue.
Note the lock discipline that matters here: the SEL write must not happen while holding _lock, so moving the audit before the commit opens a window in which a concurrent deactivate() could be undone. renew_lease() handles this by re-checking _expires_at <= 0 inside the commit lock; renew() would need the same.
Suggested test shape (mutation-verifiable): patch the SEL sink so log_api_access raises, call renew(), assert it reports not-renewed AND that the grant's deadline did not move. Injecting the failure at the SEL write rather than at _log_sel is what makes the critical=True flag load-bearing in the test — patching _log_sel itself raises regardless of the flag and passes vacuously.
What
SafetyOverride.renew()— the human-initiated renewal of a time-limited safety override (YOLO) grant — commits the extended deadline and then writes its SEL audit event non-critically. If the audit write fails, the failure is swallowed (_log_selonly re-raises whencritical=True) and auto-approval stays extended with no record that it was.Why
Every other path in this file that creates auto-approval authority already fails closed the other way round:
_commit_activationaudits withcritical=Truebefore committing and returns an inactive result if the write fails. Its comment: "Audit BEFORE committing — fail-closed with no race window".activate_scopeddoes the same: "Fail-closed audit before commit — no grant without a trace."renew()extends the same authority those paths are careful about, so the asymmetry looks unintentional rather than reasoned — an auditor reconstructing "when was auto-approval live?" from the SEL log can be silently missing a renewal that happened.This was surfaced while reviewing #2443, which added
renew_lease()(the machine-issued counterpart). That method was flagged for exactly this weakness and now audits critically before committing, with the commit block re-verifying the guard because the audit runs with the lock released.renew()was deliberately left alone there to keep a focused change reviewable — hence this issue.Additional Context
src/kiro_crew/safety_override.py—renew(); compare_commit_activationandactivate_scopedfor the established pattern, andrenew_lease()(post-fix(safety-override): lease the grant to armed loops instead of demoting mid-run #2443) for a worked example including the post-audit re-verify._lock, so moving the audit before the commit opens a window in which a concurrentdeactivate()could be undone.renew_lease()handles this by re-checking_expires_at <= 0inside the commit lock;renew()would need the same.log_api_accessraises, callrenew(), assert it reports not-renewed AND that the grant's deadline did not move. Injecting the failure at the SEL write rather than at_log_selis what makes thecritical=Trueflag load-bearing in the test — patching_log_selitself raises regardless of the flag and passes vacuously.