Commit Graph

10 Commits

Author SHA1 Message Date
roboomp da2e630fb0 fix(irc): scope mid-park send gate to the owning lifecycle
The new isParking/has checks consulted the global lifecycle for every send, so a custom-registry IrcBus (which falls back to the global manager) could gate a live recipient on unrelated global park state for the same id. Add AgentLifecycleManager.manages(registry) and apply the mid-park/adopted gate only when the lifecycle owns this bus's registry; the parked-status path (read from the bus's own registry) is unchanged.

Fixes #5633
2026-07-16 01:40:17 +00:00
roboomp 54f4a1894f fix(registry): coordinate park/dispose with ensureLive and IRC delivery
park() detached the live session only after session.dispose() resolved,
so during the dispose window the registry still exposed ref.session at
idle status. Concurrent ensureLive()/hub-send handed out or injected into
the dying session, reporting success while the message was dropped once
detach committed.

- Replace the #parking Set guard with a #parks map of in-flight park state
  that is cancelable until the session is detached.
- park() now yields a cancel window, then detaches + flips status to
  parked BEFORE dispose(), and coalesces concurrent park calls.
- ensureLive() cancels a pre-detach park (keeps the live session) or waits
  for detach+dispose then performs one coalesced revive; never returns a
  disposing session.
- release()/dispose() drain any in-flight park; the idle re-arm skips while
  a park owns the transition.
- IrcBus.send() gates parkable recipients through ensureLive and derives
  the revived receipt from session identity, so receipts/unread counts
  reflect actual delivery.

Fixes #5633
2026-07-16 01:21:08 +00:00
can1357 33b6774aa1 feat(coding-agent): implemented resumable subagent yielding for tasks
- Replaced silent budget-based termination with a graceful stop and forced-yield mechanism.
- Implemented resumable subagent states to preserve agent context upon budget exhaustion.
- Increased default soft request budget to 200 and updated IRC bus signaling to distinguish between active, resumable, and hard-aborted statuses.
- Added comprehensive status-aware prompts and unit tests to verify non-terminal abort behavior.
2026-07-11 17:27:35 +02:00
can1357 0828c53cab feat(coding-agent): integrated liveness monitoring into irc wait operations
- Update `IrcBus.wait` to accept a `liveness` configuration, automatically aborting waits if the specified sender or relevant peers transition to an idle state.
- Enhance `IrcTool` to utilize liveness monitoring during `wait` operations, ensuring the agent does not hang if target peers become unreachable.
- Refactor `IrcBus.wait` to unify internal settlement logic and improve cleanup robustness.
2026-07-11 17:14:03 +02:00
can1357 eeeab97db0 fix(session): auto-reply awaited IRC sends to an idle plan-mode session
Plan mode records idle IRC deliveries into context without waking a turn,
so an 'irc send await:true' sender was stranded until its wait timeout:
delivery reported injected but no reply could ever be generated. Extend the
existing ephemeral side-channel auto-reply (previously only for mid-turn
recipients with async execution disabled) to the idle plan-mode case — the
second situation where a real reply turn cannot happen in time. No primary
turn is woken; plan-mode convergence stays user-driven.

The deliverIrcMessage eligibility change itself rode in the previous commit
(same-file hunks); this commit carries the bus doc and the regression test:
an awaited idle IRC message in plan mode resolves the sender's bus waiter
via the side-channel reply while the primary loop stays asleep.
2026-07-02 10:30:51 +02:00
can1357 132f28dd11 fix(coding-agent): prevented duplicate IRC broadcast messages in transcript
- Suppressed main-UI relay for sibling broadcast legs when the main agent is a direct target.
- Added `suppressRelay` option to `IrcBus.send` to allow selective disabling of relay rendering.
- Ensured broadcast fan-outs avoid rendering the same message twice in the main transcript.
2026-06-26 22:25:38 +02:00
can1357 29d250fae2 feat(coding-agent): supported advisor transcript persistence
- Implemented `AdvisorTranscriptRecorder` to persist advisor sessions to append-only `__advisor.jsonl` files.
- Integrated transcript recording into agent sessions with managed flushing, atomic file switching, and synthetic turn attribution.
- Restricted advisor-kind agents by excluding them from rosters, history protocols, messaging, and interactive agent commands.
- Reserved the `__advisor` filename stem across the output manager and task registry to prevent task ID collisions.
2026-06-19 03:50:00 +02:00
can1357 926dfdea39 fix(coding-agent): restored side-channel IRC auto-reply for busy recipients when async execution is disabled
A subagent's send await:true to Main during a blocking task spawn was a structural deadlock: deliverIrcMessage queues mid-turn messages as step-boundary asides, but Main's next boundary requires the sender's own batch to finish, so the sender always burned the full irc.timeoutMs. Awaited sends now pass expectsReply through IrcBus.send; a mid-turn recipient with async.enabled off generates an ephemeral no-tools reply via runEphemeralTurn, records an irc:autoreply aside in its own history, and delivers it back over the bus with replyTo threading so the sender's waiter resolves.
2026-06-11 18:12:22 +02:00
can1357 98c6564db6 fix(coding-agent): fixed IRC handoff await behavior to prevent stale mailbox relays
- Fixed `IrcBus.send` to avoid queueing successful outbound messages and buffer only failures.
- Fixed IRC `send` await handling to use cancellable waiters with `drainPending: false` and abort-on-empty recipients.
- Fixed relay behavior to skip main-agent-originated messages and prevent duplicate outbound IRC relay cards.
- Added tests covering subagent-only relay routing, await-time fresh replies, and failure mailbox counts.
2026-06-10 23:56:38 +02:00
can1357 fcb8663de8 feat(coding-agent): reworked irc to a send/wait/inbox/list mailbox bus
Replaces the blocking auto-reply IRC turn with a process-global IrcBus and a four-op tool (send/wait/inbox/list). send is fire-and-forget with per-recipient delivery receipts (injected/woken/revived/failed); replies become real turns by the recipient, observed via wait (or the send await:true sugar). Bounded per-agent mailboxes (cap 100) drop oldest on overflow; AgentSession.deliverIrcMessage folds an in-flight delivery in as a non-interrupting aside at the next step boundary, or starts a real wake turn when idle. AgentRegistry/lifecycle handle the idle→woken / parked→revived transitions, so messaging a non-running peer brings it back. Adds a dedicated TUI renderer (directional headers, delivery-outcome coloring, quoted bodies, per-recipient receipt trees, status-badged peer lists with unread counts). irc.timeoutMs is now the default timeout for wait / send await:true. AgentSession sheds the agentRegistry config field, the dedupeIrcReply → dedupeEphemeralReply rename (now used by /btw and /omfg), and the background-channel exchange queue / forwardIrcRelayToMain plumbing the auto-reply model needed.
2026-06-10 17:47:47 +02:00