Skip to content

aiden serve sends its Bots' Needs you, Failed and last reply like a Mac - #913

Open
sambitcreate wants to merge 30 commits into
claude/project-thread-awyxuf-pr4from
claude/project-thread-awyxuf-pr5
Open

sambitcreate wants to merge 30 commits into
claude/project-thread-awyxuf-pr4from
claude/project-thread-awyxuf-pr5

Conversation

@sambitcreate

Copy link
Copy Markdown
Owner

Requested by sbt · project thread

Stacked on #912 (→ #910 → #909 → #907 → #895). PR 5, the last one in the "Fix Bots shown across Macs" plan. Release once the whole stack merges.

Problem

The headless server (aiden serve) runs durable Bots, but its host-feed Bot rows carried no needsYou, failed, lastReplyAt or preview. A paired desktop therefore showed its Bots with an empty line, no unread dot and no Needs you, and listed them in the Inbox only while open. It also couldn't offer PR 4's bot:needs-you to phones.

Change

  • createCliBotSignals (packages/cli/src/remote-bots.ts) builds the same BotLiveProjection the desktop uses from the durable runtime (conversation, state, quietInputs) and the CLI approvals bridge (approvalPending). CLI Bots ask no questions and take no hand-offs, so an approval is the only wait.
  • The server host feed passes botSignals (through the desktop's hostFeedBotSignals), and the Remote routes get botNeedsYou, so the router offers bot:needs-you (revision 68).
  • The feed is invalidated when a Bot's turn starts or ends, on a pause or unpause, and when an approval opens or settles. The projection is closed with the Remote API.
  • Without durable Bot sessions nothing changes.

Screenshots

No UI change in this PR: the server sends fields that PR 2's desktop rows and PR 4's phone rows already draw (screenshots in #907).

Scope

packages/cli wiring, CLI and API docs. No protocol change beyond what #907 and #912 define.

Verification

  • packages/cli: npm run build, tsc --noEmit.
  • Extended tests/parity.test.mjs:
    • "durable CLI Bot migration…": after a real Bot reply, the row has preview: "Durable answer" and a lastReplyAt. A waiting approval makes needsYou true and botNeedsYou list the Bot. A pause reaches the feed listener.
    • "durable CLI Bots can message each other": over HTTPS, the server offers bot:needs-you, a device that negotiated it sees needsYou on the waiting Bot, and an older device never sees the key.
  • tests/inbox-host.test.mjs and tests/bundle.test.mjs pass (12).
  • Root tsc, eslint on the touched files, and npm run test:ci-policy (123) all pass.

AI disclosure

Written by Claude Code from the approved fix plan; verified by the tests above.

Checklist

  • Docs updated: packages/cli/README.md, docs/aiden-remote-api-v1.md (CLI host section, revision 68), docs/aiden-on-the-go-remote-access.md, .memory/bot-chat-activity.md
  • Tests extended for the new behavior

Generated by Claude Code

…erve

With durable Bot sessions on, the headless server builds the same live
Bot summary the desktop uses (conversation, state, queued inputs and
whether an approval waits on the person). It feeds the host feed's Bot
rows (needsYou, failed, lastReplyAt, preview), so a paired desktop's Bots
list and Inbox show this server's Bots as they show a Mac's, and the
router's botNeedsYou, so the server offers bot:needs-you to phones. The
feed refreshes when a Bot's turn starts or ends, on a pause, and when an
approval opens or settles. Without durable sessions nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ
…d and the last reply

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ
@sambitcreate sambitcreate self-assigned this Nov 24, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Normal Bot completions do not invalidate the host feed, so the last-reply and final-state signals this PR adds remain stale until an unrelated refresh.

Reviewed changes I reviewed the complete CLI projection, Remote lifecycle wiring, audience-gated Bot contract, documentation, and focused parity coverage.

  • CLI Bot projection — Adds createCliBotSignals over the durable runtime to derive row signals and revision-68 needsYou sets.
  • Remote integration — Supplies those signals to the host feed and router, adds state/approval invalidation, and closes the projection during API teardown.
  • Contracts and verification — Updates CLI/Remote documentation and extends parity tests for direct projection, capability negotiation, audience gating, and pause notifications.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

Comment thread packages/cli/src/remote-bots.ts Resolved
Follow a running Bot in the live projection, as the desktop does, so the end
of every turn (reply or failure) invalidates the feed with its final row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A Bot turn that settles while its background projection is opening can still miss the final host-feed refresh and leave the row stale.

Reviewed changes I reviewed the settlement fix added since the prior Pullfrog review, including its runtime-state propagation, projection lifecycle, listener teardown, and focused parity coverage.

  • Tracked running turns — Passed full durable session states into BotLiveProjection.notifyState so an active turn keeps a background transcript feed open.
  • Invalidated on settlement — Routed BotLiveProjection.onRunSettled through the CLI signal listener set and detached the new subscriptions during teardown.
  • Exercised reply delivery — Added a gated durable turn that observes a newer lastReplyAt and preview through signals.onChange after completion.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

Comment thread packages/cli/src/remote-bots.ts Resolved
A running notice whose feed opened after the run ended set the feed back to
running and never reported the end, so the host feed missed the reply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A newer paused or interrupted state can still be replaced by the stale running notice while the live feed opens.

Reviewed changes I reviewed the projection-startup fix added since the prior Pullfrog review and its deterministic race coverage.

  • Guarded delayed feed opening — Detected an already-settled feed after asynchronous startup, reported settlement, and avoided applying the captured running state.
  • Covered idle completion — Delayed the projection's conversation read until a real Bot turn completed, then verified the settled callback, idle snapshot, and final reply.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

…with

The feed reads the state as it opens, after the notice, so a pause or
interruption in between kept reading running; report it settled instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A state transition can still be lost during the later part of feed opening, leaving a Bot row stale after this fix.

Reviewed changes I reviewed the projection-opening follow-up added since the prior Pullfrog review and its paused-state race coverage.

  • Preserved an opened non-running state — Removed the stale captured-state application and reports settlement when a delayed feed opens paused, interrupted, failed, or idle.
  • Covered pause before state projection — Added a deterministic test that holds the conversation read, pauses a live Bot, and verifies the opened snapshot remains paused.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

A notice that arrives while the feed opens may be older or newer than
the state it read, so the state is read again inside the feed queue. A
feed whose conversation closed while it opened (a pause can do that) is
no longer kept with its stale state, and a run that ended meanwhile is
still reported settled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new reconciliation can settle one Bot run twice when a terminal frame was pending during feed opening.

Reviewed changes I reviewed the feed-opening reconciliation added since the prior Pullfrog review, including successful and failed watch startup, settlement ordering, deterministic race coverage, and the shared desktop consumer.

  • Reconciled opening state — Re-read the runtime state inside the opened feed queue so notifications arriving after the initial state read are reflected.
  • Cleaned failed watch startup — Removed and cancelled a feed when a pause closes its conversation before the watch starts, then recovered settlement from a fresh state read.
  • Covered post-read pause — Added a deterministic test that pauses after the opening state read and verifies the resulting paused snapshot and callback.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

The opening reconciliation and a run's last frame could both report the
same run as settled. A feed now remembers that its run's end was
reported and clears that when a new run starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The settlement latch still permits duplicate callbacks when a shared opening attempt fails during pause or interruption.

Reviewed changes I reviewed the settlement-deduplication follow-up and its lifecycle behavior since the prior Pullfrog review.

  • Guarded successful settlement — Added a per-feed latch so opening reconciliation and a pending terminal frame report a completed run only once.
  • Reset per new run — Cleared the latch when state or transcript frames establish a new active run.
  • Covered the terminal-frame race — Added a deterministic test that completes a run after the opening state read and asserts one idle settlement callback.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

Notices that join the same opening see the same error; the failure is
now reported, and the run settled, once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes I reviewed the failed-opening settlement fix added since the prior Pullfrog review.

  • Deduplicated failed opening settlement — Recorded each shared opening rejection once so multiple running notices cannot report the same paused or interrupted run more than once.
  • Covered the rejected-opening race — Extended the post-state-read pause test with a second running notice and asserted exactly one settlement callback.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

Copy link
Copy Markdown
Owner Author

Linux E2E (2/3) on 79ba58e failed before any test ran. npm ci got 403 Forbidden downloading electron-v43.8.4-linux-x64.zip from GitHub releases, so this is a download problem, not this PR. Job log. I'll rerun the failed jobs once when the run finishes.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Desktop tests (renderer-other) on a887515 failed 1 CLI test: packages/cli/tests/server-visuals.test.mjs, "an installed browser draws a chart offline…". A cold Chrome launch on the hosted Linux runner went past the test's 15 s limit. Every branch in this stack fails the same way, and this PR doesn't touch server visuals. #914 fixes it on main, and I'll merge main into the stack once it lands. Job log.


Generated by Claude Code

sambitcreate and others added 4 commits November 24, 2026 11:26
…hind one that wasn't running, and close the parity test's Bot sessions

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes I reviewed the failed-opening ordering follow-up and CLI parity teardown added since the prior Pullfrog review.

  • Retained settlement authority: Replaced the handled-error set with per-opening state so a running notice that joins behind a non-running notice still performs the single settlement reread.
  • Covered notice ordering: Added a deterministic rejected-opening test that verifies one error report and one settlement when idle and running notices share the attempt.
  • Closed parity resources: Closed the Bot-session services created by both CLI parity signal probes during teardown.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes I reviewed the host-feed contract assertion added after the previous Pullfrog review.

  • Verified summary signaling: Asserted that an aiden serve Bot row carries summarized: true, independently covering the revision-66 signal paired Macs use before establishing unread baselines.
  • Synchronized the stacked base: Incorporated the latest base merge without changing this PR's production behavior.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants