Skip to content

Add capability-gated native Bot Queue and Steer controls - #223

Closed
sambitcreate wants to merge 11 commits into
mainfrom
feature/mobile-run-input
Closed

sambitcreate wants to merge 11 commits into
mainfrom
feature/mobile-run-input

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Adds Queue and Steer to iOS and Android Bot chats when the Mac advertises chat-run-input-v1. Actions bind the displayed stream, require current grants, accept bounded plain text, and validate exact admission receipts. Accepted means durably queued, not consumed by the model.

Drafts remain until confirmed admission. A device-local uncertainty marker blocks accidental resend after disconnect/restart and across open chat views; an explicit review action clears it. Newer edits survive receipts. Late accepted receipts refresh the transcript, with an explicit stale notice if that read fails. Native onboarding and the existing Bots tour explain the supported controls.

Dependencies: stacked on #218 (approval/Stop hardening). Requires the host contract/runtime in #220, which depends on #216. Merge alongside #217 while retaining both its recovery/active-owner guards and this PR’s uncertainty guards. No new clarification, secret collection, or child-interrupt contract is introduced.

Validation: combined code 948c4def4 includes #217 bf5ddba1, #218 0d0ca7716 (approval fallback fix 5fed6040 plus a separable capacity-test stability fix), #220 1c381bc5, and this PR b4fc1e1b0. All 204 Android JVM tests, lint and instrumentation compilation pass; 157 host/protocol/admission/onboarding checks and the focused capacity test pass. The combined iOS app and XCTest target compile via unsigned generic-device build-for-testing. Two independent Sol integration reviews are clear.

The previously published consumer f72d3eab passed all hosted checks. Those results do not cover the newer approval fallback fix: hosted checks for the current head are pending. Physical XCTest remains unexecuted because the coordinated iPhone was locked. No merge, release or deployment occurred.

@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

This PR has two integration correctness issues that should be addressed before merging: the stacked OpenAPI contract can drop required UTF-8/nonblank metadata, and Android can apply stale chat data after a pairing switch during receipt reconciliation.

Reviewed changes

  • Native Bot controls — Adds feature-gated Steer and Queue controls, current-stream checks, and composer/send-state changes to the Android and iOS Bot chat surfaces.
  • Admission contract — Adds request and receipt models, strict identity/shape validation, native POST /streams/{streamId}/inputs clients, shared fixtures, and protocol documentation.
  • Durable uncertainty handling — Persists unconfirmed submissions, preserves drafts across unknown outcomes and restarts, refreshes accepted receipts, and extends native/onboarding coverage.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

Comment thread protocol/aiden-remote/v1/openapi.json Resolved

@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 Android fence still leaves a title-refresh path that can publish stale data after a pairing switch; this should be addressed before merging.

Reviewed changes This incremental review covers the Android receipt-refresh fence and the synchronized run-input schema added since the prior Pullfrog review.

  • Fenced Android receipt reconciliation — Added a post-read check for the bound client and current paired instance/device, plus a held pairing-switch regression.
  • Synchronized host schema metadata — Restored the nonblank pattern and UTF-8-byte extension in ChatRunInputRequest and asserted them in the protocol tests.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | 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 review covered the Android pending-title reconciliation changes added after the prior Pullfrog review.

  • Fenced title refreshes — Added bound-client and paired instance/device checks before and after each pending-title retry read, preventing old-pairing transcript or cache publication.
  • Added pairing-switch regression — Held the retry response during a pairing switch and verified the admitted message remained in the chat and its original cache.

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.

Important

The approval fallback can still hide a current approval indefinitely when the read it coalesces fails or is canceled. On iOS, the marker can also remain set after the snapshot has already published an approval, so a failed response can skip the required refresh.

Reviewed changes This incremental review covers the approval-fallback changes merged from the stacked branch after f72d3eab; the later b4fc1e1b merge adds no consumer behavior.

  • Coalesced approval recovery — Reused a matching in-flight approval snapshot for ambiguous responses and added held-order Android/iOS regressions.

⚠️ Fallback coalescing can strand the current approval

The fallback returns as soon as it sees a matching in-flight snapshot, but that request can subsequently fail or be canceled and leave the state in RECONCILING with no later read. On iOS, the marker remains in flight while liveActivities.approvalRequired awaits after publishing the card, so a failed response during that await can also return without starting a fresh read.

Technical details
# Keep fallback coalescing tied to a live authoritative read

## Affected sites
- `android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/chat/AidenChatViewModel.kt:1092-1124, 1281-1288` — `isFallback` suppresses a second read for a matching marker, but a later read failure or cancellation only publishes `RECONCILING`.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:2093-2105, 2419-2427` — the same coalescing path has no retry when the matched read fails or is canceled.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:2450-2459` — the approval is published before `liveActivities.approvalRequired` completes, while the marker is still retained by the surrounding `defer`.

## Required outcome
- Skip the fallback only while the matching authoritative request is still active and able to publish; if it fails or is canceled, leave a later authoritative read able to recover the current approval.
- Clear or advance the iOS in-flight marker when the snapshot has been validated and published, before unrelated awaited side effects, and add held failure/cancellation and post-publication response regressions.

Pullfrog  | Fix it ➔ | View workflow run | Using GPT Luna | 𝕏

An ambiguous approval response that coalesced with a matching in-flight
snapshot read returned immediately, so a later failure or cancellation of
that read left the chat in RECONCILING with no card. The fallback now
awaits the read's outcome and issues its own read unless the matching read
actually published the Mac's snapshot. On iOS the in-flight marker is also
settled right after publication, before awaiting Live Activity updates.

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

pullfrog Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using GPT Luna | 𝕏

2 similar comments
@pullfrog

pullfrog Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using GPT Luna | 𝕏

@pullfrog

pullfrog Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using GPT Luna | 𝕏

@very-hermes-bot

very-hermes-bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Hermes Review Bot

Confidence: 5

Engine: agy/gemini-3.8-flash-high
Review mode: full
Head: 0e79ea1934e6eb4d093ca9ab06a30b99d9497ee2
Generated: 2026-09-30T23:02:59+00:00
Reviews: 1

Summary

Adds capability-gated native Bot Steer and Queue controls to iOS and Android when the paired host advertises chat-run-input-v1. Submissions bind strictly to the active stream, require chat:write along with bot:read/bot:write, enforce plain-text 16 KiB limits, and track exact admission receipts. Before network dispatch, both clients persist an unconfirmed .run-input marker to disk alongside the draft; unknown outcomes or transport drops lock subsequent Send attempts until an explicit chat review action clears uncertainty. Accepted admission clears only the captured draft (preserving edits typed in flight) and triggers an authoritative transcript refresh. Maintainers should double-check that downstream host PR #220 aligns with the exact receipt wire schema, specifically omitting reason on accepted receipts and admission/messageId on rejected receipts to satisfy both mobile clients' strict key-set validations.

Confidence Score: 5/5

Full trace of both Android and iOS implementations, persistence stores, network clients, OpenAPI/protocol specifications, and adversarial test scenarios verified without gaps.

📁 Important Files Changed
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/chat/AidenChatDetailScreen.kt: Surfaces Steer and Queue action buttons alongside the unconfirmed review banner in the Android composer.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/chat/AidenChatViewModel.kt: Manages run-input dispatch lifecycle, draft persistence, post-admission reconciliation, and pairing-fenced refresh; hardens approval fallback coalescing via CompletableDeferred.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/networking/AidenRemoteClient.kt: Dispatches POST /streams/{streamId}/inputs without automatic connection retries and strictly validates receipt keys and payload.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/persistence/AidenChatDraftStore.kt: Tracks per-chat .run-input uncertainty markers across sessions and restarts, blocking turns while unconfirmed submissions exist.
  • ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift: Implements SwiftUI Steer/Queue controls, unconfirmed review banner, input submission lifecycle, and AidenApprovalSnapshotOutcome coalescing.
  • ios/AidenOnTheGo/Networking/AidenRemoteClient.swift & ios/AidenOnTheGo/Models/AidenChat.swift: Implements typed run-input request/receipt models with strict CodingKey validation and network dispatch.
  • ios/AidenOnTheGo/Persistence/AidenChatDraftStore.swift: Manages persistent .run-input uncertainty markers on iOS with intermediate directory creation and file protection attributes.
  • protocol/aiden-remote/v1/openapi.json & docs/aiden-remote-api-v1.md: Specifies the chat-run-input-v1 feature, endpoint /streams/{streamId}/inputs, idempotency, and strict response schema.
  • renderer/shared/chat-run-input.ts: Defines shared TypeScript constants, types, and input parser for the admission contract.
  • Test suites (AidenChatTest.kt, AidenChatTests.swift, aiden-remote-protocol.test.ts, onboarding-flow.test.tsx): Exhaustive held-network, pairing-switch, duplicate-tap, and restart-recovery test coverage across both native platforms.

Findings

No findings.

Sequence Diagram

sequenceDiagram
    autonumber
    actor User
    participant Composer as Mobile Composer (View/VM)
    participant DraftStore as Local DraftStore
    participant Server as Mac Remote Server (PR #220)

    User->>Composer: Tap Steer or Queue (with draft text)
    Composer->>DraftStore: save(draft) & setUnconfirmedRunInput(true)
    Composer->>Server: POST /streams/{streamId}/inputs (Idempotency-Key)
    alt Admission Accepted
        Server-->>Composer: 200 ChatRunInputReceipt (accepted: true, admission: "queued", messageId)
        Composer->>DraftStore: save("") [if unedited] & setUnconfirmedRunInput(false)
        Composer->>Server: GET /chats/{chatId} (reconcile transcript)
        Server-->>Composer: 200 AidenChat (refreshed messages)
        Composer-->>User: Show notice ("Queued on your Mac...")
    else Admission Rejected
        Server-->>Composer: 200 ChatRunInputReceipt (accepted: false, reason: "not-active" | ...)
        Composer->>DraftStore: setUnconfirmedRunInput(false) [keep draft]
        Composer-->>User: Show notice ("Your Mac did not queue...")
    else Network Interrupted / Timeout
        Server--xComposer: Connection Lost / Timeout
        Note over Composer,DraftStore: Unconfirmed marker remains on disk
        Composer-->>User: Show review banner; block Send until acknowledged
    end
Loading
[]

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

@pullfrog

pullfrog Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using GPT Luna | 𝕏

1 similar comment
@pullfrog

pullfrog Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using GPT Luna | 𝕏

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

pullfrog Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using GPT Luna | 𝕏

@sambitcreate
sambitcreate changed the base branch from feature/mobile-bot-cockpit to main October 1, 2026 06:36
@sambitcreate

Copy link
Copy Markdown
Owner Author

Closing as superseded by #251, which already ships native Steer/Queue/Stop on iOS and Android using main's run-input contract. This PR was built on #220's contract, which was never merged. The branch is kept for reference.

sambitcreate added a commit that referenced this pull request Oct 2, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
@sambitcreate
sambitcreate deleted the feature/mobile-run-input branch November 21, 2026 22:36
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