Skip to content

Add shared active-run input admission and true steering - #220

Closed
sambitcreate wants to merge 7 commits into
mainfrom
feature/bot-run-input-admission
Closed

sambitcreate wants to merge 7 commits into
mainfrom
feature/bot-run-input-admission

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

A running response can accept a plain-text instruction through one host-owned admission path. Desktop Steer and Telegram /steer preserve the active run; Interrupt keeps its stop-and-send behavior. The additive chat-run-input-v1 Remote endpoint binds input to an authenticated owner, exact stream, request UUID and immutable payload.

Admission reserves bounded Pi capacity and persists the user message before injection. An atomic journal marker prevents replay in a later ordinary turn. Accepted means persisted and queued; Stop or revocation can prevent consumption without erasing history. Desktop uncertain delivery retains its request identity and cannot become a new send automatically.

Remote authorization failures before admission leave the UUID retryable. Exceptions after entering the host callback retain an indefinite unknown outcome, including across expiry and restart. Evicted event streams use read-only receipt lookup, then recheck current chat/Bot access. OpenAPI requires nonblank text and the x-aiden-max-utf8-bytes: 16384 client validation extension.

Telegram /steer captures its target and waits for a durable polling offset. Pending Telegram ingress is memory-only: a crash or bridge stop before admission can discard an unacknowledged command. An accepted acknowledgment follows host persistence.

Stacked on #216, including its acknowledgment and command-edit fixes. Native consumers are published in #223 (stacked on #218), with independent reviews of marker and late-receipt fixes complete. The latest combined validation with this runtime head and the other native dependencies remains pending. No merge or release requested.

Validation:

  • Telegram 240 passed; full compaction 334 passed; onboarding 55 passed.
  • Full desktop queue Electron E2E: 12 passed, including navigation, draft preservation, journal deduplication, oversized input, and lost receipt/stale retry without duplicate send.
  • Final ledger/stream/protocol/router regressions: 135 passed. Broader Remote suites previously passed 459 with 1 skipped.
  • Existing native compatibility: Android Remote/progress 56 passed; iOS generic build-for-testing passed (compilation only).
  • Native owner reports combined consumer integration on the preceding runtime head passed 199 Android JVM tests plus lint, iOS test compilation, and focused host tests; newest runtime integration is pending. Native nonblank and UTF-8 byte validation is confirmed, including an oversized emoji regression.
  • Type-check, production build, scoped ESLint and diff checks pass on the final correction. React Doctor reported 84/100 with existing/intentional warnings.
  • Both independent GPT-5.6-Sol medium reviews completed and rechecked all corrections. Both actionable Pullfrog threads have verified replies and are resolved.

Hosted verification, deterministic Electron E2E, and Pullfrog pass on 1c381bc; both actionable review threads are resolved. Greptile is unavailable due to its account trial-credit limit. Live Telegram/device acceptance has not been performed.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sambitcreate has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sambitcreate has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

…nput-admission

# Conflicts:
#	.memory/hermes-bot-run-controls.md
#	main/services/telegram/telegram-service-core.test.ts

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sambitcreate has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

…nput-admission

# Conflicts:
#	main/services/telegram/telegram-service-core.ts

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sambitcreate has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@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

Please address the pre-admission retry poisoning and synchronize the cross-platform Remote contract artifacts before merging.

Reviewed changes

The full 36-file, two-commit change was reviewed across shared active-run admission, Pi durability, Remote routing and idempotency, Telegram/Desktop controls, and protocol/UI coverage.

  • Host admission and Pi durability — Persists plain-text input before Pi injection, couples queued messages to visible-history markers, and handles terminal/cancellation races.
  • Remote run-input endpoint — Adds feature-gated stream input admission, exact request identity, durable receipt replay, and current chat authorization checks.
  • Desktop and Telegram consumers — Adds true desktop steering with uncertain-delivery retention and Telegram /steer without stopping the active response.
  • Protocol and test coverage — Adds the OpenAPI/Remote route, shared parser, renderer queue state, and focused runtime, Remote, Telegram, and E2E regressions.

⚠️ Cross-platform contract artifacts remain stale

The documented contract process requires additive changes to update the shared fixtures and increment contractRevision. This PR adds a new advertised feature and route but leaves revision 11 and the canonical TypeScript/Swift/Android fixture coverage unchanged, so the new endpoint vocabulary is not covered by the cross-platform contract; update the coordinated mobile acceptance before enabling this as a releasable feature.

Technical details
# Contract synchronization

## Affected sites
- `protocol/aiden-remote/v1/openapi.json:1878-1923` and `main/services/aiden-remote-router.ts:1218` add and advertise `chat-run-input-v1`.
- `protocol/aiden-remote/v1/fixtures/contract.json:2` and `android/app/src/test/resources/contract.json:2` remain at `contractRevision` 11; the iOS and TypeScript fixture tests still assert the old revision.
- The native clients have no run-input DTO, request path, or uncertain-delivery draft flow yet; the PR plan itself marks that coordination as a merge gate.

## Required outcome
- Increment the additive contract revision and update the shared fixture, Android copy, Swift/TypeScript fixture tests, and coordinated native acceptance before treating the advertised route as shipped.

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

Comment thread main/services/aiden-remote-streams.ts Resolved
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.

✅ No new issues found.

Reviewed changes

The incremental delta was reviewed for Remote retry safety, evicted-stream receipt replay, unknown host outcomes, and the run-input validation contract.

  • Separated authorization from admission — Kept pre-admission authorization failures retryable while retaining indefinite protection after the host callback begins.
  • Added read-only receipt replay — Replayed exact receipts after stream eviction without reserving or executing a new operation, with current chat authorization rechecked.
  • Aligned validation contracts — Declared nonblank text and the required UTF-8 byte limit in OpenAPI and added Unicode boundary regressions.

Pullfrog  | View workflow run | Using GPT Luna | 𝕏

@very-hermes-bot very-hermes-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Inline review — 3 finding(s) anchored to the diff. See the pinned summary comment for the overview.

@@ -622,7 +630,7 @@ export function createTelegramServiceCore(deps: TelegramServiceDeps) {
}).catch(() => undefined);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2 · logic] Telegram /steer command edits bypass deduplication and emit false delivery failure errors
Confidence: 0.92

Omission of /steer from the update.edited_message command list causes edited steer messages to fall through to handleCommand with identical request UUIDs and modified text, triggering fingerprint conflict exceptions that report false delivery failure errors.

Repair: Include /steer in the command edit check array at line 625.

</ol>
<p className="px-1 pt-1 text-small text-tertiary">
Unsent messages stay in this window until it closes. Open this chat to continue its queue.
{state.uncertainIds?.length ? "Delivery is uncertain. Check delivery before resuming; your message is preserved." : "Unsent messages stay in this window until it closes. Open this chat to continue its queue."}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2 · logic] Deleting an uncertain queued message leaves a persistent delivery warning banner
Confidence: 0.9

ChatMessageQueue.remove does not remove deleted message IDs from snapshot.uncertainIds, causing the warning banner condition state.uncertainIds?.length to remain true across any remaining queued messages.

Repair: Check whether any uncertain ID matches an active message in state.messages when rendering the banner, and prune uncertainIds in ChatMessageQueue.remove.

Suggested change
{state.uncertainIds?.length ? "Delivery is uncertain. Check delivery before resuming; your message is preserved." : "Unsent messages stay in this window until it closes. Open this chat to continue its queue."}
{state.uncertainIds?.some((id) => state.messages.some((message) => message.id === id)) ? "Delivery is uncertain. Check delivery before resuming; your message is preserved." : "Unsent messages stay in this window until it closes. Open this chat to continue its queue."}

Comment on lines 111 to +115
aria-label={`Steer with queued message ${index + 1}`}
title="Stop the current response, wait for it to save, then send this message next"
title="Add this text at the active response's next steering boundary"
>
<CornerDownRight aria-hidden="true" />
Steer
{uncertainIds.has(message.id) ? "Check delivery" : "Steer"}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2 · logic] Accessible label for queued message "Check delivery" button remains hardcoded to "Steer"
Confidence: 0.88

When an item enters the uncertain state, the visible label updates to 'Check delivery' but aria-label remains 'Steer with queued message X' and title remains the steering description, violating WCAG 2.5.3.

Repair: Make aria-label and title conditional on whether uncertainIds.has(message.id) is true.

@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: 7393d59af6b83e4bfb4dc95524aa94559000f3bd
Generated: 2026-09-30T02:13:11+00:00
Reviews: 1

Summary

This change implements host-owned active-run input admission and true steering across desktop, Telegram, and Aiden Remote. User input is validated, assigned an idempotent request identity, persisted to the host chat store, and recorded with an atomic journal marker before being injected into Pi's steering queue at the next execution boundary. Stop and cancellation prevent continued inference without discarding committed history, while uncertain delivery locks re-sending until confirmed by the user. Maintainers should double-check that deleting an uncertain queued item properly clears its ID from the queue snapshot so subsequent items do not display a lingering delivery warning banner.

Confidence Score: 5/5

Fully traced and verified across the host admission lifecycle, Pi queue draining, Remote idempotency ledger, Telegram polling offset barriers, and Electron queue state.

📁 Important Files Changed
  • main/services/chat-run-input.ts: Host admission boundary managing per-run request identity, capacity limits (128 requests), and coordinating persistence before queue injection.
  • main/services/llm-client.ts: Integrates run input admission into active generations, registers strictly monotonic input timestamps, and provides the submitRunInput IPC entrypoint.
  • main/services/pi-agent-runtime-harness.ts: Implements queuePersistedInput to gate Pi queue injection behind host persistence, drains in-flight writes on agent_end, and converts accepted messages to steering on continuation.
  • main/services/pi-compaction-session-store.ts: Updates appendPiMessages to commit the AIDEN_CHAT_MESSAGE_MARKER atomically with queued user messages to prevent replay on subsequent turns.
  • main/services/telegram/telegram-service-core.ts: Adds the /steer command with deterministic request UUIDs, executing side effects via afterPersist only after offset durability.
  • main/services/aiden-remote-streams.ts & main/services/aiden-remote-router.ts: Exposes POST /streams/{streamId}/inputs (chat-run-input-v1), supporting exact replay on evicted streams while enforcing current chat/bot authorization.
  • renderer/components/queued-messages.tsx & renderer/lib/chat-message-queue.ts: Introduces true Steer and Interrupt actions, tracks uncertain delivery states, and disables auto-send while uncertain inputs exist.
  • protocol/aiden-remote/v1/openapi.json: Formalizes ChatRunInputRequest and ChatRunInputReceipt schemas, specifying x-aiden-max-utf8-bytes: 16384 and nonblank pattern validation.

Findings

  • [P2 · logic] renderer/components/queued-messages.tsx:156 — Deleting an uncertain queued message leaves a stale warning banner in the queue list → commented inline

Sequence Diagram

sequenceDiagram
    autonumber
    participant Client as Client (Desktop / Telegram / Remote)
    participant Admission as Host Admission (createChatRunInputAdmission)
    participant Store as Chat Store (chatStore.appendMessage)
    participant Harness as Pi Harness (PiAgentRuntimeHarness)
    participant Agent as Pi Agent (@earendil-works/pi-agent-core)

    Client->>Admission: submitRunInput(streamId, input)
    Admission->>Harness: queuePersistedInput(message, mode, persist)
    Harness->>Store: persist(messageId, text)
    Store-->>Harness: message appended & chats:changed
    Harness->>Agent: steer(message)
    Harness-->>Admission: { accepted: true, queue: "steer" }
    Admission-->>Client: ChatRunInputReceipt (accepted: true, queued, messageId)
    Agent->>Harness: message_start (user)
    Harness->>Store: appendPiMessages (message + AIDEN_CHAT_MESSAGE_MARKER)
Loading
[
  {
    "file": "renderer/components/queued-messages.tsx",
    "start_line": 156,
    "end_line": 156,
    "severity": "P2",
    "comment_type": "logic",
    "confidence": 0.95,
    "title": "Deleting an uncertain queued message leaves a stale warning banner in the queue list",
    "mechanism": "ChatMessageQueue.remove(id) does not filter uncertainIds when deleting a message, and line 156 checks state.uncertainIds?.length unconditionally, permanently showing the delivery uncertainty notice after an uncertain item is removed while other messages remain.",
    "repair": "Check whether any current message in state.messages is present in uncertainIds before rendering the delivery warning banner, and prune uncertainIds on queue.remove(id).",
    "suggestion": "        {state.messages.some((m) => uncertainIds.has(m.id)) ? \"Delivery is uncertain. Check delivery before resuming; your message is preserved.\" : \"Unsent messages stay in this window until it closes. Open this chat to continue its queue.\"}",
    "id": "9f9fd3fec93a5174"
  }
]

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

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 | 𝕏

@very-hermes-bot very-hermes-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Inline review — 1 finding(s) anchored to the diff. See the pinned summary comment for the overview.

</ol>
<p className="px-1 pt-1 text-small text-tertiary">
Unsent messages stay in this window until it closes. Open this chat to continue its queue.
{state.uncertainIds?.length ? "Delivery is uncertain. Check delivery before resuming; your message is preserved." : "Unsent messages stay in this window until it closes. Open this chat to continue its queue."}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2 · logic] Deleting an uncertain queued message leaves a stale warning banner in the queue list
Confidence: 0.95

ChatMessageQueue.remove(id) does not filter uncertainIds when deleting a message, and line 156 checks state.uncertainIds?.length unconditionally, permanently showing the delivery uncertainty notice after an uncertain item is removed while other messages remain.

Repair: Check whether any current message in state.messages is present in uncertainIds before rendering the delivery warning banner, and prune uncertainIds on queue.remove(id).

Suggested change
{state.uncertainIds?.length ? "Delivery is uncertain. Check delivery before resuming; your message is preserved." : "Unsent messages stay in this window until it closes. Open this chat to continue its queue."}
{state.messages.some((m) => uncertainIds.has(m.id)) ? "Delivery is uncertain. Check delivery before resuming; your message is preserved." : "Unsent messages stay in this window until it closes. Open this chat to continue its queue."}

@sambitcreate
sambitcreate changed the base branch from feature/hermes-bot-run-controls to main October 1, 2026 06:35
@sambitcreate

Copy link
Copy Markdown
Owner Author

Closing as superseded by #251, which shipped steer/queue on main with its own receipt format under the same chat-run-input-v1 feature name and the same POST /streams/{streamId}/inputs route; the iOS and Android apps already use that version. A new, smaller PR will add the parts only this PR had (desktop Steer, Telegram /steer) on top of main's existing steer/queue code. 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/bot-run-input-admission 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