Repository navigation
Proactive Aiden: chats that check back, keep going, run on events and run other chats - #879
sambitcreate wants to merge 125 commits into
Conversation
check_back tool for workspace chats (set/list/cancel, 1-1440 minutes or HH:MM, 3 per chat, 20 total), CheckBacks service in follow-through state with one timer, claimed-before-post, 2-hour late window and Missed cards; shared time rules in wake-up-time.ts; goalRound on ChatTurnAudience and a reusable args-aware turn refusal (TURN_ARGS_REFUSAL_RULES) run through firstTurnToolRefusal; check_back notice source, composer chip with Cancel, activity row; Settings > Scheduled tasks > While you're away > Let chats check back later (chatCheckBacks, on by default, off cancels pending, kept off the Remote wire); docs and memory.
# Conflicts: # PRODUCT.md # README.md # main/services/aiden-remote-schedules.test.ts # main/services/host-platform-capabilities.test.ts # main/services/host-platform-capabilities.ts # main/services/portable-config-core.ts # main/services/scheduled-settings-core.ts # main/services/scheduled-task-application-service.test.ts # main/services/types.ts # package.json # renderer/components/scheduled-task-mcp-access.test.tsx # renderer/components/settings/scheduled-tasks-settings.tsx # renderer/lib/types.ts # renderer/shared/settings-section.ts
Run snapshots, the bounded wait, owned-run tracking and request dedupe move from AidenMcpToolRunner into chat-orchestration/run-core.ts, keyed by owner. The core has no limits: the turn rate, runs-at-once and pending-request caps stay in the runner. No behaviour change for outside apps.
A pending chat check-back or Bot wake-up due within 60 minutes is a keep-awake input, only on AC power (powerMonitor.isOnBatteryPower()). One more than an hour overdue stops holding; while anything is due the input rechecks every 5 minutes so Linux, which sends no plug events, notices. Bot wake-ups are cached from the schedule store and refreshed on bots:changed, schedule:updated and resume. New reason kinds check-back and wake-up show in the Settings live line.
Pure goal state machine (set, pause, resume, restore after a restart, settle pre-checks, verdicts, stalls, the 50-round cap, compare-and-set), a check-command variant with its own 5-check limit, the goal prompts with the objective escaped inside <untrusted_objective>, and the reviewer verdict parser. New test:goal lane. Nothing is wired into chats yet.
# Conflicts: # PRODUCT.md # README.md # main/services/aiden-remote-schedules.test.ts # renderer/components/agent-notice-card.tsx # renderer/shared/agent-notices.ts
The goal review asks the chat's own model whether the goal is done, as a side call continuing the chat's last request (short retention, 400 output tokens, 60 seconds, no retries), falling back to the isolated tool-free projection when the prefix is stale or the continuation fails. A reply that calls a tool is no verdict. Each request is checked against the chat's spending limit first, counted toward it, and recorded as the new goal-review usage source. Not wired into chats yet.
# Conflicts: # package.json
…t result and a check-back
…eiling Hidden plumbing for chats that start other chats: - ChatMeta.startedBy (strict parser; a damaged value is dropped at read). - chat-orchestration/links.ts: chat-orchestration.json (mode 0600) with per-child links, the permission ceiling, the took-over marker, owed results and delivery dedupe. - The internal chat:<lead> audience: started chats record their lead, send no analytics, keep approvals and questions open 30 minutes, and the audience is refused over HTTP. - The ceiling (stricter mode, intersected Mac grants, narrower folder access) applies where a turn's policy is set and on every later re-read; a chat whose link is lost runs as Ask with no grants. Also commits the C2 memory note that .gitignore hid.
The main loop reviews a chat after each settled run and starts the next round as an attended goalRound turn, with CAS writes so the person's pause or clear wins. Goals persist in follow-through state, IPC chats:goal:get|set|pause|resume|clear plus chats:goal-changed, a goal notice source, a post-compaction reminder, and goal_started / goal_settled analytics. Off behind goalLoopEnabled() until the goal bar. The reviewer's output cap leaves room for the chat's thinking budget.
…orkspace Lead chats get a child_chats tool (start, send, wait, read, list, stop) over the Remote chat and stream services under the internal chat:<lead> audience. Depth 1, no count caps, start keyed by the tool call id and declared never-replay, start Consequential and refused in turns Aiden started, every result a taint source, replies fenced as data, send refused once the person writes in a started chat. Settings → Approvals → Advanced gains Chats can start other chats (on by default).
…switch cancels claimed ones
…eplay them with backoff
There was a problem hiding this comment.
Important
The prior five findings are addressed, but the new webhook refund and trigger retry paths introduce two concurrency/durability issues that should be fixed before merging.
Reviewed changes since the prior Pullfrog review at af842f64, covering the six new commits and their integration with the full PR diff.
- Refunded malformed webhook admissions. Added 413/415 refund paths and flood coverage so malformed calls do not consume a valid sender's nominal allowance.
- Closed child-chat takeover authority. Refused direct lead stops after the person takes over a started chat and extended the behavioral test.
- Recovered dropped check-backs. Added claimed-state cancellation, delivery-outcome handling, bounded retries, restart recovery, and final failure cards.
- Retried trigger execution failures. Added typed terminal ineligibility and bounded same-event replay for operational
runEventfailures. - Stabilized asynchronous tests. Waited for Telegram outbox completion and prevented duplicate
/goalsends while the first attempt is unsettled.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…n happens once per event
…n the window shows a Bot
There was a problem hiding this comment.
Important
The prior two blockers are addressed, but the requeue fix still needs current-process recovery after an uncertain publication.
Reviewed changes since the prior Pullfrog review at 43d592d8, covering the two new commits and their integration with the full PR diff.
- Isolated webhook refunds. Bound every malformed-call refund to its own opaque admission ID and added overlapping rolling-window coverage.
- Made event requeue duplicate-safe. Prevented a published-but-rejected hold-again mutation from combining the same payload twice and added restart recovery coverage.
- Stabilized the window-round E2E. Held the deterministic model completion while switching to a Bot so the test exercises a genuinely running round.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…rries on without a restart
There was a problem hiding this comment.
Important
The new in-process recovery closes the simple uncertain-publication path, but two durable interleavings can still leave accepted obligations incomplete.
Reviewed changes since the prior Pullfrog review at 08011a7b, covering the new reconciliation commit and its integration with the full PR diff.
- Reconciled rejected requeues. Added serialized read-back, held-event rearming, retained-receipt replay, bounded read retry, and dispatcher-lifecycle cancellation.
- Covered current-process recovery. Extended the trigger test timer harness and verified one delivery without restart when the rejected write landed, did not land, or landed before a failed read-back.
- Documented the recovery contract. Updated the trigger implementation memory and user guide to describe current-process continuation after an uncertain write.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…ld event, and retry drops show their card from a saved notice
There was a problem hiding this comment.
Important
The retained-receipt fix is sound, but retry-drop delivery still has one durability gap that should be fixed before merging.
Reviewed changes since the prior Pullfrog review at 7e5c28c, covering the new commit and its integration with the full PR diff.
- Replayed retained receipts beside held work. Reconciliation now independently arms unrelated held events and schedules the rejected run's still-durable receipt.
- Persisted terminal retry-drop notices. Added bounded task-store notices that survive uncertain publication and are processed during reconciliation, rearm, and successful requeue paths.
- Extended recovery coverage and documentation. Added behavioral interleaving tests for both prior findings and documented the new durability contract.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…are shown, each part once
There was a problem hiding this comment.
Important
The new per-part retry still treats one failed production delivery as complete and can repeat another after an uncertain publication.
Reviewed changes since the prior Pullfrog review at 79579279, covering the new drop-notice recovery commit and its integration with the full PR diff.
- Retried partial drop notices. Split terminal-drop delivery into
cardandlogparts, retained failed notices, and retried them with bounded backoff. - Persisted delivery progress. Added saved
doneparts and failure counts, plus in-process progress when the follow-up bookkeeping write rejects. - Extended recovery coverage. Added card-failure and link-log-failure cases and updated the trigger implementation memory.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…log line is written once under the notice's key
There was a problem hiding this comment.
Important
The new idempotency key still permits a duplicate terminal-drop log after a webhook burst evicts the marker before retry.
Reviewed changes since the prior Pullfrog review at 8e82cf9d, covering the new commit and its integration with the full PR diff.
- Observed card outcomes. Made terminal-drop cards require a saved notice, retry non-gone delivery drops, and treat a deleted chat as terminal.
- Keyed terminal-drop logs. Added an internal per-notice key so a published-but-rejected log append can be recognized on retry, and stripped that key from link-state responses.
- Extended production-seam coverage. Added tests for resolved notice drops and for a real log update that publishes before rejecting.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…ve with their notice
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at c8d341e0, covering the new durability fix and its interaction with the full PR diff.
- Separated idempotency authority. Moved terminal-drop log keys out of the bounded visible link log so ordinary webhook calls cannot evict them before a delayed retry.
- Bounded pending keys. Kept keys tied to their durable drop notices, removed them in the notice-clear mutation, and refused new keyed writes rather than forgetting authority when the cap is full.
- Covered the eviction interleaving. Added behavioral coverage for a published-but-rejected log write followed by enough accepted calls to roll over the visible log, plus key cleanup and capacity coverage.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at faccddf9, covering the merge of current main and its integration with the full PR diff.
- Reconciled follow-through documentation. Preserved both the new pull-request babysitting behavior from
mainand this PR's/untilgoals, check-backs, and proactive feature descriptions. - Preserved shared follow-through contracts. Kept
MAX_COMMENT_ONLY_FOLLOW_UPDATESfor the merged pull-request behavior while retaining the goal migration and check-back contract used by this PR. - Combined overlapping renderer updates. Retained goal-view reporting in Bot chats alongside the new Bot approval repeat threshold, and verified the merged follow-through chip behavior.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…n-plan-f98bae # Conflicts: # docs/plans/README.md
… a fixed 20 ms testConcurrentStalePagesRefreshRootOnceAndRespectOwnershipFence slept 20 ms before releasing held pages and before removing the installation. On a busy CI simulator the stale recovery had not parked its root refresh yet, so the removal landed before the recovery and the final XCTAssertNil(model.index) failed (seen on main at 1afb737 and on this branch). It now waits until the responder has logged the expected file-tree requests, which it does in the same step that parks them.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at 330cc2ca, covering the two new commits and their integration with the full PR diff.
- Preserved the plan inventory during the
mainmerge. Kept both this PR's Proactive Aiden status row andmain's iPhone Duo row indocs/plans/README.md. - Stabilized the iOS stale-page ownership test. Replaced fixed sleeps with bounded request-count fences that observe the responder only after each held directory or root request is parked.
- Kept production behavior unchanged. The increment modifies merge-resolved documentation and test synchronization only; all prior Pullfrog findings remain resolved.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…n-plan-f98bae # Conflicts: # docs/analytics.md # main/services/analytics/analytics-events.ts # main/services/chat-store-core.ts # main/services/llm-client.ts # renderer/components/onboarding-art/feature-art.tsx # renderer/components/onboarding-feature-gallery.test.tsx # renderer/components/onboarding-feature-gallery.tsx # renderer/main/chat-pane.tsx
There was a problem hiding this comment.
Important
Temporary Floating Quick Chats can now create proactive state that their own surface cannot show or follow, so this cross-feature integration needs an explicit eligibility or UI/lifecycle policy before merge.
Reviewed changes since the prior Pullfrog review at dc5b2add, covering the Floating Quick Chat merge and its integration with the full PR diff.
- Merged Floating Quick Chat. Added Temporary chats, in-place workspace attachment, the floating mini-modal, and cross-window generation handoff from current
main. - Reconciled shared contracts. Preserved both proactive and floating-chat analytics, chat metadata, product documentation, onboarding art, and renderer imports across the eight conflict resolutions.
- Preserved live generation ownership. Routed prompts, approvals, questions, terminal events, and owed-turn ownership through the current renderer after a floating chat expands into the main window.
⚠️ Temporary chats can create proactive state their surface cannot reach
propose_goal, check-backs, chat-bound scheduled tasks, and child_chats all treat a Temporary chat as an ordinary workspace chat. Floating Quick Chat has none of their cards, chips, or background chat-update subscriptions, while startup sweeping later deletes the lead chat; this can leave a claimed-visible goal proposal invisible, hide a check-back response, or detach durable task/child work from its Temporary origin.
Technical details
# Temporary-chat proactive eligibility is incomplete
## Affected sites
- `main/services/llm-client.ts:2086-2090` — binds scheduled tasks to any ordinary chat without excluding `chat.ephemeral`.
- `main/services/llm-client.ts:2383-2475` — offers check-backs, `propose_goal`, and `child_chats` without an ephemeral-surface gate.
- `renderer/quick-chat/floating-chat-app.tsx:253-300` — subscribes to Quick Chat lifecycle and metadata events, but not goal, follow-through, started-chat, schedule, or transcript updates.
- `renderer/quick-chat/floating-chat-app.tsx:322-443` — renders only the active generation stream, so later headless proactive delivery does not update the floating transcript.
- `main/services/chat-application-service.ts:686-699` — startup deletes every unpromoted ephemeral chat.
- `main/services/chat-orchestration/links.ts:310-322` — deleting a lead removes links but deliberately leaves its started chats alive.
## Required outcome
- Define and enforce one coherent contract for proactive features in Temporary chats.
- Either refuse these durable/proposal features until the chat is saved or attached, or provide their complete controls, update delivery, and deletion/startup-sweep semantics in Floating Quick Chat.
- Ensure a successful tool result never tells the model that a person-visible control exists when that surface cannot render it.@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
…te until saved or attached Floating Quick Chat's Temporary chats show only the live reply and are deleted at the next launch unless saved or attached, so a goal, check-back, started chat or chat-bound task made there would be invisible or orphaned. Until the chat is saved or attached: - goalChatRefusal refuses it, covering /goal, /until, phone sets and the agent's suggestions; - the turn isn't offered check_back, propose_goal or child_chats (offersChildChats takes temporary); - a task scheduled there gets its own chat instead of posting into it. Saving or attaching drops the Temporary mark and the next turn has them.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at 437dca91, covering the Temporary Quick Chat eligibility fix and its integration with the full PR diff.
- Prevented Temporary chats from owning proactive state. Removed check-backs, goal proposals, and child-chat starts from Temporary chat tool assembly, and rejected
/goaland/untilthrough the shared main-process eligibility gate. - Detached scheduled tasks from ephemeral origins. Kept scheduling available while omitting
originChatId, so tasks created in a Temporary chat run in their own durable chat rather than binding to a lead that startup may sweep. - Restored capabilities after promotion. Preserved the existing save and workspace-attachment transitions that clear
ephemeral, allowing the next turn to regain proactive tools under the documented contract.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…n-plan-f98bae # Conflicts: # README.md
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at 9ecb5531, covering the current-main documentation merge and its conflict resolutions against the complete PR context.
-
Adopted the streamlined project overview. Merged the compact root README and retained the proactive capabilities in its consolidated workspace and follow-through summary.
-
Preserved proactive documentation discovery. Added check-backs, keep-going goals, chats that run chats, and event-triggered tasks to the streamlined docs index with valid guide links.
-
Kept detailed contracts intact. Retained the full proactive behavior in
PRODUCT.mdand the shared run-core reference in the overlapping Aiden MCP guide without changing runtime behavior.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…n-plan-f98bae # Conflicts: # docs/plans/README.md # renderer/main/root-view.tsx
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at 3d7e78f4, covering the current-main merge and its cross-feature integration with the complete PR diff.
-
Integrated current
main. Adopted the worktree-creation performance and iOS pairing follow-up changes while retaining the Proactive Aiden status and contracts in the plan inventory. -
Combined transcript behavior. Routed first-message worktree progress through
MessageListwithout dropping child-chat lineage labels, live reasoning, goal controls, or the zero-remount draft-to-persisted handoff. -
Preserved cache coherence. Kept created-workspace cache seeding alongside goal and child-chat subscriptions; child chats moved into new worktrees still emit the chat invalidation needed by sidebar and workspace views.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

Summary
This PR builds phases 1, 2, 4 and 5 of Proactive Aiden. Aiden can now come back to a chat later, keep working toward a goal, run tasks when something happens, and start other chats to share the work. All four phases are in one PR to save CI runs.
Phase 1 — while you're away
Keep awake. Aiden holds an Electron
prevent-app-suspensionblocker while it works. That covers a chat answering, a background job with no listening port, a/untilcheck, a goal being checked, and a usage-limit wait that ends within 10 minutes. On AC power it also holds for a check-back or Bot wake-up due within 60 minutes. Releases:It is in Settings → Scheduled tasks → While you're away, with a live line such as "Keeping awake: 1 chat working". Linux support is best-effort.
Check-backs (
check_back). Only a turn the person started can set one. The chip above the composer lists pending check-backs. At the due time a notice card wakes the chat. A check-back cut off at quit leaves a "Check-back interrupted" card.Tasks post into the chat they were made in. Aiden binds the task to its chat when the task is created; the renderer and phones can't set this. Limits:
The task editor shows a "Posts in" row, and chat task chips appear above the composer.
Args-aware refusals. A turn Aiden started can't create promises that outlive it: it can't set a check-back, suggest a goal or start chats. This covers woken, scheduled, trigger, goal-round and lead-chat turns.
Phase 2 — keep-going goals
/goal <objective>sets one goal per chat. After each answer, the chat's own model judges progress through a side call that reuses the cached prompt (usage sourcegoal-review, checked against the spending limit)./goal pause|resume|cleardoes the same.propose_goallets Aiden suggest a goal as a one-line Start / Not now card./untilbecomes a command goal.Phase 4 — tasks that run when something happens
POST /hooks/tasks/<token>on the Aiden On The Go listener.sha256=HMAC.aiden serverefuses triggers.Phase 5 — chats that run chats
child_chats(start, send, wait, read, list, stop) starts chats in the same workspace or in new worktrees, at depth 1.submit_result. It is limited to 16 KB, local non-looping refs, no regular expressions, and a static worst-case cost cap.The onboarding feature tour gets new tiles for these features. Docs added:
docs/keep-going-goals.md,docs/scheduled-task-triggers.mdanddocs/chats-that-run-chats.md.docs/coding-follow-through.md, README, PRODUCT,docs/analytics.mdand the plan index are updated.Review
Screenshots
Captured in a Cua Space (Linux, xvfb), never on the host display. The Find sources choices come from a test stub, and the link URL shows the Space's hostname.
Before and after (surfaces that exist on main)
Settings → Scheduled tasks
Task editor: When
Task editor: access
Composer
Onboarding tour
Phase 1: while you're away
Phase 2: keep-going goals
Phase 4: triggers
Phase 5: chats that run chats
Onboarding tiles
Testing
npm test(full parallel runner): all lanes pass except:packages/cli: type-check, build and test pass.xvfb), not on the host display:keep-going-goals.spec.ts6/6;chats-that-run-chats.spec.ts;tests/e2e/keep-going-goals-computer-use.spec.tsneeds the macOS host (Computer Use). It was written but not run locally; CI's macOS E2E job covers it.Known limits
chat:cancellifecycle behaviour). With a very fast model the round can settle before the view report arrives, so the goal is reviewed instead of pausing with "The chat was closed". The E2E spec holds the mock's answers to test the intended path; the product race is recorded in.memory/goal-loop.mdfor a follow-up.Flaky CI tests seen on this PR
packages/cli/tests/server-visuals.test.mjs:172"an installed browser draws a chart offline into a picture and leaves no profile behind" (renderer-other, CLI package step).SERVER_VISUAL_TIMEOUT_MSand returned "Not shown: … drawing it failed or took too long".mainthe same test already takes 6.5–10 s on CI's Google Chrome (x64). It takes 1.6–1.9 s with Chromium in a 4-CPU Linux Space, both alone and during the parallel CLI suite, and 1.8 s on macOS.ios/AidenOnTheGoTests/AidenWorkspaceEnvironmentTests.swift:564testConcurrentStalePagesRefreshRootOnceAndRespectOwnershipFence(iOS simulator job; Xcode 26.6 and Xcode 27).XCTAssertNil(model.index)fails, because theroot-2index survives the installation being removed.ios/. The same test fails the same way onmainat the merge base 1afb737 (run https://github.com/sambitcreate/aiden-agent/actions/runs/45019275411, job 137198427263).removeInstallation. On a busy simulator the toggle hasn't parked by then. On one rerun of the failed jobs, the required iOS job passed. It failed again at b061473 (run https://github.com/sambitcreate/aiden-agent/actions/runs/45110446789), so dc5b2ad fixes the test: it now waits until the responder has logged the held requests, instead of sleeping 20 ms. It passed 25 of 25 runs locally on Xcode 26.6.AidenSandboxedHTMLTests.testAPreviewPageMakesNoNetworkConnections(only the non-blocking Xcode 27 job, on that rerun: job 137320347199).ios/. The same test also fails on other branches' runs built onmain(runs 45012146127 and 45005967463).AidenOnTheGoUITests-Runner) crashed while preparing to run ("Early unexpected exit, operation never finished bootstrapping"), after 45 minutes.AidenWorkspaceEnvironmentTests.swift, so this is a runner fault. It was not rerun, because the job is non-blocking.tests/e2e/keep-going-goals.spec.ts:158: fixed in 08011a7 (root cause in that commit and in.memory/goal-loop.md). It was not a retry.