Commit Graph

5 Commits

Author SHA1 Message Date
kshitijk4poor 5d4231997c fix(cli): quiet -Q drain must use the async_delegation delivery ledger
Durable async_delegation rows carry a delivery ledger that every other
drain consumer honors (cli_process_notifications, tui session_notifications,
gateway run_notifications). Without the claim/complete handshake the row
stays delivery_state='pending' and restore_undelivered_completions re-queues
it on the next process start, so the next chat -Q on the resumed session
injects the same delegation result twice.
2026-09-14 21:18:47 +05:30
kshitijk4poor 30b02bba12 refactor(cli): quiet -Q session binding as a context manager
bind_quiet_session_key returned a (token, reset_fn) pair guarded by a
try/except around ContextVar.set (which cannot raise for a token produced
in the same frame) and an except-pass in the finally — the banned
dead-defense shape. It is now a @contextlib.contextmanager and
_run_quiet_single_query wraps the turn in a plain `with`, flattening the
double try nesting; the sys.exit(130) interrupt path still passes through
the reset.
2026-09-14 21:18:47 +05:30
kshitijk4poor d503526b80 fix(cli): quiet -Q notify loop must not drop owned async_delegation events
drain_notifications pops every owned event off the shared queue; the
salvaged loop kept only type=completion texts, so an owned
async_delegation result was consumed and silently dropped — neither
injected as a follow-up turn nor requeued for another consumer.

Every drained event type renders formatted text, so the loop now injects
all of them. Regression: test_quiet_notify_loop_injects_owned_async_delegation_events.
2026-09-14 21:18:47 +05:30
kshitijk4poor c429081bcd fix(cli): one shared linger budget for the quiet -Q notify-resume loop
The salvaged loop called wait_for_pending_completions(None) with a fresh
default 600s deadline on every round, and _finalize_single_query then
re-waited the full timeout on the same stuck notify_on_complete child:
a hung child blocked a quiet one-shot 2x-9x longer than before.

One deadline now covers the whole run — the loop passes the remaining
budget each round, stops after draining once a wait times out (a timed-out
process never fires this run), and the finalize pass skips its re-wait
when the loop already consumed the budget.

Regression: test_quiet_notify_loop_shares_one_linger_budget (one wait
call, full budget, on a stuck child).
2026-09-14 21:18:47 +05:30
kshitijk4poor 5c26cf64b2 chore: author map for xxxigm (PR #110866 bot-mode nested one-shot DM resume) 2026-09-14 21:18:47 +05:30