Skip to content

feat(remote): interrupt subagents from Aiden On The Go (contract revision 16) - #275

Merged
sambitcreate merged 5 commits into
mainfrom
feature/remote-subagent-interrupt
Sep 30, 2026
Merged

sambitcreate merged 5 commits into
mainfrom
feature/remote-subagent-interrupt

Conversation

@sambitcreate

Copy link
Copy Markdown
Owner

Summary

This PR lets a paired phone stop one running delegated agent (subagent) from Aiden On The Go. It goes through the same Mac stop path the desktop agent panel uses. It adds an authenticated Remote route (contract revision 16, feature chat-agent-interrupt-v1) and a confirmed Stop agent control in the iOS and Android agent sheets.

Source: Hermex P1, Hermes subpage 6 (subagent interrupt from mobile).

Revision note: other PRs in this wave may also claim contract revision 16. Whichever merges second has to renumber to the next revision. The conflicts are in both contract.json copies, the TS, iOS and Android fixture assertions, the iOS fixture CodingKeys and docs/aiden-remote-api-v1.md.

Changes

Desktop / Remote server

  • SubagentControlMainV2.stopForChat resolves the owning chat document privately and reuses the existing desktop stop path.
  • New route POST /chats/{chatId}/agents/{agentId}/interrupt in aiden-remote-router.ts, wired through aiden-remote-chat-progress.ts (interruptAgent) and aiden-remote-service-main.ts. /server.features advertises the route only when it is wired.
  • Authorization: chat:write plus the negotiated agents:read grant, and bot:write for retained Bot chats. Archived chats get mutation_blocked. There is no new capability and no Idempotency-Key.
  • Responses:
    • 200: the refreshed current-turn roster. A terminal agent is a no-op 200.
    • 404: the agent is unknown.
    • 409 operation_stale: the run is legacy or unbound.
  • Privacy: the public agent ID maps back to the private run on the Mac. No private identifiers are exposed.
  • Contract: OpenAPI (interruptChatAgent and the AgentId parameter), the shared fixture (agentInterrupt, revision 16), protocol parse validation for the fixture, and the Android fixture copy.

iOS

  • AidenRemoteClient.interruptAgent validates the agent ID and the response's chat.
  • AidenChatFeature.canInterruptAgents / canInterrupt(_:) / interruptAgent(_:) adopt the returned roster, play a haptic on stop, and show error copy for revoked or unconfirmed stops.
  • AidenAgentDetailView follows the live roster and shows a destructive Stop with a confirmation dialog.

Android

  • AidenRemoteClient.interruptAgent does not auto-retry on a dropped connection. AidenServer.supportsChatAgentInterrupt gates the control.
  • AidenChatViewModel.interruptAgent tracks interruptingAgentIds.
  • AidenAgentDetailSheet gains AidenAgentStopControl (hidden, available or stopping) and an AlertDialog confirmation.

Docs

  • docs/aiden-remote-api-v1.md: the route, the feature token and the child-control exception.
  • docs/plans/README.md: a status row for this work.
  • .memory/remote-subagent-interrupt.md
  • .papercuts/troubleshooting.md

Tests run

  • npm run test:aiden-remote: pass. This covers the router route and authorization, the chat-progress interrupt, the OpenAPI inventory, the revision-16 fixture validation, and the operation contract.
  • npm run test:subagents: pass. The first run had one failure while tsc ran at the same time; two reruns passed. This is recorded in papercuts.
  • npm run type-check and eslint on the touched files: clean.
  • iOS xcodebuild test on the iPhone 17 simulator: 525 passed, exit 0. New tests:
    • the client interrupt route
    • stop adopts the stopped roster and offers no further stop
    • stop is hidden without the feature
    • revision 16 fixture decoding
  • Android ./gradlew testDebugUnitTest: pass. It adds a MockWebServer interrupt route test and revision-16/agentInterrupt fixture assertions.

Follow-ups

  • Physical iPhone and Android acceptance of the Stop sheet.
  • Renumber the contract revision if another wave PR lands revision 16 first.
  • Possible scripts/subagent-run-store.test.mjs load-sensitive flake (see papercuts).

🤖 Generated with Claude Code

sambitcreate and others added 3 commits September 27, 2026 11:22
Add POST /chats/{chatId}/agents/{agentId}/interrupt, gated by chat:write,
the negotiated agents:read grant, and the chat-agent-interrupt-v1 feature.
The router maps the public agentId back to the private run and reuses the
desktop subagent stop path through a trusted chat-scoped stopForChat.
Claim contract revision 16 with an agentInterrupt fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iOS and Android offer a confirmed "Stop agent" control in the agent detail
sheet when the Mac advertises chat-agent-interrupt-v1 and the device holds
chat:write plus agents:read (and Bot read/write for Bot chats). The control
calls the revision-16 interrupt route, adopts the returned roster, and is
hidden for finished agents or older turns. Fixture tests cover revision 16
and the stopped-roster contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 This initial review covers the Remote subagent interrupt contract and server path, the iOS and Android confirmation and roster flows, and the associated fixtures, documentation, and tests.

  • Remote stop route. The new authenticated route checks write and agent-read authority, applies the retained Bot mutation gate, resolves only the public agent ID, and delegates to the main-owned chat/workspace-bound control path.
  • Mobile controls. Both clients gate the confirmed Stop action on the advertised feature, grants, and current nonterminal roster, avoid automatic retries, and adopt the returned roster.
  • Contract coverage. The OpenAPI route, shared and Android fixtures, protocol parsing, and focused server/client behavior are covered by the changes.

Local verification: npm run test:aiden-remote and focused Remote interrupt/control tests passed. The broader npm run test:subagents run could not complete on this Linux runner because native helper binaries are unavailable; iOS and Android suites were not run here.

Pullfrog  | View workflow run | Using GPT Luna | 𝕏

@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 This incremental pass rechecked the merge from current main and the papercut-only cleanup after the last review.

  • Merged Android updates. Verified the updated chat-screen selection flow and attachment send guards compose with the agent detail stop sheet; the stream-state gate remains intact.
  • Dropped the papercut note. Confirmed e584c56 only removes the transient .papercuts entry and changes no runtime or contract behavior.

Focused verification: ./gradlew :app:testDebugUnitTest --tests sbtbiswas.AidenOnTheGo.AidenChatTest --rerun-tasks passed.

Pullfrog  | View workflow run | Using GPT Luna | 𝕏

@very-hermes-bot

Copy link
Copy Markdown
Collaborator

Hermes Review Bot

Confidence: 5

Engine: agy/gemini-3.8-flash-high
Review mode: full
Head: e2167425778482643bd8ae807fa46f40501c735d
Generated: 2026-09-30T19:03:17+00:00
Reviews: 1

Summary

Paired mobile devices running Aiden On The Go can now interrupt individual running delegated agents without stopping the parent chat run or sibling subagents. The host exposes an authenticated Remote route POST /chats/{chatId}/agents/{agentId}/interrupt (chat-agent-interrupt-v1, contract revision 16) that maps public agent IDs back to private run IDs on the Mac and invokes the existing desktop stop path via SubagentControlMainV2. Both iOS and Android clients introduce confirmed destructive "Stop agent" controls in their agent detail sheets, gate the UI behind negotiated capabilities (chat:write, agents:read, and bot:write for Bot chats), handle in-flight progress states, and immediately adopt the returned roster snapshot. Maintainers should verify whether any concurrent PR merges first and claims contract revision 16, requiring renumbering across the shared fixtures, schema, and tests.

Confidence Score: 5/5

The complete diff was inspected across macOS desktop services, iOS, Android, and contract fixtures, tracing the full lifecycle from mobile UI confirmation to main-process process termination, authorization boundaries, and state adoption.

📁 Important Files Changed
  • main/services/subagents/subagent-control-main.ts: Adds stopForChat to SubagentControlMainV2, allowing trusted callers to stop a subagent scoped only by chat ID and workspace ID while keeping owner document IDs and revisions private.
  • main/services/aiden-remote-service-main.ts: Wires stopAgent into the remote progress service, resolving persisted workspace boundaries from the chat store before dispatching to subagent controls.
  • main/services/aiden-remote-chat-progress.ts: Implements interruptAgent, resolving public agent identifiers to internal runs, re-validating read permissions, ignoring already-terminal agents idempotently, and returning the refreshed turn roster.
  • main/services/aiden-remote-router.ts: Exposes and documents POST /chats/{chatId}/agents/{agentId}/interrupt, enforcing chat:write, negotiated agents:read, and retained bot write checks through runChatMutation.
  • protocol/aiden-remote/v1/openapi.json & protocol/aiden-remote/v1/fixtures/contract.json: Updates OpenAPI definitions, advertises chat-agent-interrupt-v1, and defines contract revision 16 fixtures.
  • ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift & ios/AidenOnTheGo/Models/AidenChatProgress.swift: Adds interruptAgent to the iOS view model with haptics and in-flight tracking, and exposes a confirmed destructive action in AidenAgentDetailView.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/chat/AidenChatViewModel.kt & android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/chat/AidenChatProgressControls.kt: Implements Android view model stop dispatch, tracks interruptingAgentIds, and adds AidenAgentStopControl with AlertDialog confirmation to AidenAgentDetailSheet.

Findings

No findings.

📊 Sequence Diagram
sequenceDiagram
  autonumber
  actor User as User (Mobile)
  participant Client as Mobile Client (iOS / Android)
  participant Router as Aiden Remote Router
  participant Progress as Chat Progress Service
  participant MainControl as SubagentControlMainV2
  participant Projector as Subagent Process

  User->>Client: Tap "Stop agent" & confirm
  Client->>Router: POST /chats/{chatId}/agents/{agentId}/interrupt (Bearer auth)
  Router->>Router: Authorize chat:write, agents:read & classify chat
  Router->>Progress: interruptAgent(deviceId, chatId, agentId)
  Progress->>Progress: Resolve agentId to private runId & verify live
  Progress->>MainControl: stopForChat({ chatId, workspaceId }, runId)
  MainControl->>Projector: Abort execution signal & revoke approvals
  MainControl->>MainControl: Persist stopped snapshot & settle
  MainControl-->>Progress: Confirm stop
  Progress->>Progress: Build updated ChatAgentRoster
  Progress-->>Router: Refreshed ChatAgentRoster
  Router-->>Client: 200 OK (ChatAgentRoster with stopped agent)
  Client->>Client: Adopt roster, play haptic, clear in-flight state
  Client-->>User: Update agent status to "Stopped"
Loading

Machine-Readable Findings

[]

Last reviewed commit: e21674257784
Reviews (1) · Comment /hermes review to trigger a new review · /hermes review full for full re-review

@sambitcreate
sambitcreate merged commit d631c49 into main Sep 30, 2026
23 checks passed
@sambitcreate
sambitcreate deleted the feature/remote-subagent-interrupt branch September 30, 2026 19:51
sambitcreate added a commit that referenced this pull request Oct 2, 2026
* docs(plans): refresh plan index and status for 0.51.0

Supersedes #274. Moves 22 completed plans into docs/plans/completed/,
refreshes active plan status against main after 0.51.0, records
unlinked shipped changes (#265, #275, #280), and updates .memory notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(plans): note #220/#223 superseded and Steer moved to #298

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(plans): record desktop and Telegram Steer shipped in #298

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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