Skip to content

Fix remote agent workflows and runtime performance - #7976

Closed
SiteupAgencia wants to merge 21 commits into
stablyai:mainfrom
SiteupAgencia:siteup/fix-agents-ui
Closed

SiteupAgencia wants to merge 21 commits into
stablyai:mainfrom
SiteupAgencia:siteup/fix-agents-ui

Conversation

@SiteupAgencia

@SiteupAgencia SiteupAgencia commented Jul 9, 2026 •

Copy link
Copy Markdown

Summary

  • fix remote Agents activity lifecycle, unread/dismiss persistence, project/worktree identity, and Hermes status projection
  • keep native chat selected for local and paired-runtime launches, improve transcript loading, image paste/upload, model and reasoning controls
  • make provider account ownership and active-session switching follow the selected runtime
  • expose Hermes cron jobs from paired Orca runtimes, including history and management actions
  • reduce Linux runtime load by replacing global process scans and /proc/*/fd port sweeps with targeted process-tree reads and ss
  • merge the current v1.4.135-rc.3 terminal batching, hidden-tab parking, restore, and backpressure work

Validation

  • pnpm typecheck
  • 820 focused Vitest tests across runtime tabs, Hermes hooks, native chat, remote PTY transport, and agent launch
  • macOS arm64 package built, verified, installed, and opened successfully
  • Linux x64 AppImage/DEB built and deployed to the paired runtime
  • paired runtime status and graph are ready
  • all 10 configured Hermes jobs are visible through automation.externalManagers
  • disposable terminal in the Masif worktree: create 1.15s; send/read roundtrip 1.45s

Fixes #7973

Latest revision (f19aecc)

  • derive the active model and reasoning effort from each Codex session transcript instead of seeding the UI from the first catalog entry
  • keep model state scoped to the selected terminal while Codex retains the last choice as the default for newly launched terminals
  • align keyboard selection with the real Codex 0.144.1 model picker and exclude discovery-only auto recipes
  • show both model and reasoning level in the native chat control

Validation: 29 focused tests, full typecheck, disposable remote switch from gpt-5.5 to gpt-5.6-sol medium, matching installed app.asar hashes on macOS and Linux, both runtimes ready, remote HTTP 200.

Upstream sync (c3db912)

  • Synced with upstream main at c3db912 and resolved the foreground-process conflict by preserving targeted Linux /proc reads together with upstream fresh/available confirmation semantics.
  • Validation after sync: 118 focused tests, full typecheck, and git diff --check.
  • GitHub now reports the PR as mergeable.

ELI5

Several remote-agent and paired-runtime issues are fixed together: activity lifecycle, unread state, identity, Hermes status, native chat selection, account switching per runtime, Hermes cron management, and lower Linux runtime load. Remote workflows should feel consistent and less broken under load.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes add runtime-aware provider account clients for local and remote environments, update account settings and status-bar switchers to consume remote snapshots, and add remote-specific UI text and controls. Activity construction now derives live agents from terminal metadata and applies deterministic ordering, status grouping, and read-state handling. Compact agent rendering and mirrored agent synchronization preserve stable identity and timestamps. Native chat working suppression, Hermes catalog rendering, mobile PTY status retention, IPC authorization handling, remote session cleanup, and account listing behavior are also updated.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also includes unrelated activity, chat, icon, and localization changes beyond the remote account UI issue. Split the unrelated activity/chat/icon work into separate PRs and keep this change focused on remote account routing.
Docstring Coverage ⚠️ Warning Docstring coverage is 4.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description is detailed but does not follow the required template and omits Screenshots, Testing checkboxes, AI Review Report, Security Audit, and Notes. Reformat the PR description to match the template and add the missing Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR routes account list/select/remove through the active runtime, prefers remote snapshots, and disables desktop add/re-auth on remote runtimes.
Title check ✅ Passed The title is concise and generally matches the PR’s remote-agent and runtime-related changes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/renderer/src/components/settings/AccountsPane.tsx (1)

505-539: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Narrow the loadAccounts effect dependency instead of the whole settings object.

Depending on the full settings object means any unrelated global setting change (theme, terminal font, etc.) re-runs loadAccounts, which for remote scope re-establishes a subscribe/unsubscribe cycle (up to a 15s timeout) against the remote server even though only activeRuntimeEnvironmentId actually matters here.

♻️ Suggested narrower dependency
-  }, [settings, setRateLimitsFromPush])
+  }, [settings.activeRuntimeEnvironmentId, setRateLimitsFromPush])

Note: if other fields consumed inside listProviderAccounts (via settings) can also change independently and matter, extend the dependency list accordingly, but avoid depending on the whole object if it isn't referentially stable across unrelated updates.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 33d1cbed-2787-44bb-968a-700f03a039ca

📥 Commits

Reviewing files that changed from the base of the PR and between 1b0febc and 2fd6bc719ded6d2517d06fffc5723f6092d3d469.

📒 Files selected for processing (20)
  • src/main/ipc/notification-authorization-status.ts
  • src/main/runtime/rpc/methods/accounts.ts
  • src/renderer/src/components/activity/ActivityPrototypePage.test.ts
  • src/renderer/src/components/activity/ActivityPrototypePage.tsx
  • src/renderer/src/components/settings/AccountsPane.test.tsx
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx
  • src/renderer/src/components/sidebar/WorktreeCardAgents.tsx
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/status-bar-runtime-groups.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/runtime-provider-accounts-client.test.ts
  • src/renderer/src/runtime/runtime-provider-accounts-client.ts
  • src/renderer/src/runtime/web-session-tabs-sync.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts

Comment on lines +73 to +90

it('shows remote-owned accounts with local sign-in actions disabled', () => {
useAppStore.setState({
runtimeEnvironments: [{ id: 'env-1', name: 'LXC1 Siteup' }] as never
})
const markup = renderPane({
...getDefaultSettings('/tmp'),
activeRuntimeEnvironmentId: 'env-1'
})

expect(markup).toContain('Showing accounts managed by Remote server.')
const addAccountIndex = markup.indexOf('Add Account')
expect(addAccountIndex).toBeGreaterThan(0)
expect(markup.slice(markup.lastIndexOf('<button', addAccountIndex), addAccountIndex)).toContain(
'disabled=""'
)
expect(markup).not.toContain('Account location')
})

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm RuntimeEnvironment's display-name field and cross-check usage
rg -n "interface RuntimeEnvironment|type RuntimeEnvironment" -A 10 -g '*.ts' src/shared src/renderer
rg -n "runtimeEnvironments\.find" -g '*.tsx' src/renderer/src/components

Repository: stablyai/orca

Length of output: 1978


Adjust the remote-account assertions in this test
This case should render Showing accounts managed by LXC1 Siteup. with the provided runtimeEnvironments entry, so the current Remote server expectation misses the scoped-label path. If you want to cover the new !isRemoteAccountScope gate, pass wslSupportedPlatform: true too; otherwise Account location is already hidden by the existing WSL check.

@SiteupAgencia

Copy link
Copy Markdown
Author

Follow-up validation on a real headless Remote Orca Server:

  • The desktop correctly listed and switched the server-owned managed Codex accounts after this PR.
  • The active server-owned OAuth refresh token was revoked. The account page exposed the remote ownership correctly, but Add/Re-authenticate remained disabled by design, so recovery still required running codex login --device-auth against the managed CODEX_HOME on the server.
  • After the refreshed managed auth was synchronized into the active runtime home, both a non-interactive codex exec smoke test and a fresh Orca-launched Codex TUI completed successfully with codex_apps initialized and no HTTP 401.

This confirms the list/select/remove routing in this PR and also demonstrates the remaining follow-up described in #7973: a supported interactive add/re-auth flow for headless remote runtimes. This PR intentionally does not claim to solve that login flow.

@SiteupAgencia

Copy link
Copy Markdown
Author

Additional validation/fix in 0cc63427a:

  • Remote OSC 9999 agent hooks now republish session snapshots and supersede stale saved tab state. This covers working, waiting, and done for Hermes and other agents.
  • Native Chat stops its working indicator once the matching transcript user turn and final assistant reply have landed, even if a remote hook snapshot briefly remains stale.
  • Hermes now uses the bundled official Hermes Desktop icon instead of a network favicon/fallback glyph.

Validation: 600 focused Vitest tests passed, node/web typechecks passed, focused oxlint passed, and git diff --check passed. Live reproduction confirmed the remote runtime executed a Chat View-equivalent send and returned OK/done; rollout to an already-running remote runtime still requires updating/restarting that runtime.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
src/renderer/src/components/native-chat/native-chat-working-suppression.ts (1)

3-11: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the asymmetric five-second timestamp tolerance.

Explain why user messages may precede workingStartedAt by five seconds while assistant messages may not, including why that threshold is safe. This temporal correlation rule is otherwise easy to change incorrectly.

As per coding guidelines, “When writing or modifying code driven by a design doc or another non-obvious constraint, add a brief comment explaining why the code behaves that way.” <coding_guidelines>

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 88ac5b96-2dc3-4432-a70c-3334df0ee5e5

📥 Commits

Reviewing files that changed from the base of the PR and between 2fd6bc719ded6d2517d06fffc5723f6092d3d469 and 0cc63427a7f9acd29111c6ab7eace676e3784309.

⛔ Files ignored due to path filters (1)
  • resources/hermes.png is excluded by !**/*.png
📒 Files selected for processing (7)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/renderer/src/components/native-chat/NativeChatView.tsx
  • src/renderer/src/components/native-chat/native-chat-working-suppression.test.ts
  • src/renderer/src/components/native-chat/native-chat-working-suppression.ts
  • src/renderer/src/lib/agent-catalog.test.tsx
  • src/renderer/src/lib/agent-catalog.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/renderer/src/lib/agent-catalog.test.tsx

@SiteupAgencia

Copy link
Copy Markdown
Author

Follow-up pushed in a31225139 for the Activity/Agents read-state toggle.

The selected visible thread was being unacknowledged by the button and then immediately acknowledged again by the visible-thread auto-ack effect. Explicit Mark thread unread now wins until the thread is reopened (clicking the row again, switching away and back, jumping to its workspace, or marking all read).

Validation: 4 focused test files / 627 tests passed, web + node typechecks passed, focused oxlint passed, and git diff --check passed.

@SiteupAgencia

Copy link
Copy Markdown
Author

Additional follow-up pushed in ad291b562 after live testing the installed macOS build.

Closing a terminal through a remote runtime removed the host tab but left its retained completed-agent row behind on the client. Remote workspace snapshots now identify target-owned terminal tabs removed by the authoritative host and drop their live/retained agent status locally. This keeps Done available while its terminal exists, but removes the row when the terminal is explicitly closed.

Live validation on the rebuilt app: the two test terminals were closed and their stale Done rows disappeared after snapshot sync. The normal Chat View also completed a clean round trip (Responda apenas CHAT_OK -> CHAT_OK -> TUI idle). The earlier spinner report was a message queued behind an already-working Codex session, not a dropped write.

@Jinwoo-H

Copy link
Copy Markdown
Contributor

Thanks for this — you found the real root cause, picked the right seam (getActiveRuntimeTarget + the runtime accounts.* RPC, mirroring mobile's contract), and your observation that accounts.list can wedge behind provider usage refreshes reproduced exactly in our live harness (a paired headless server with broken-auth accounts hangs accounts.list >15s while accounts.subscribe's ready snapshot returns instantly). Genuinely good diagnosis.

We validated against a live paired-server reproduction and reviewed the diff in depth; we can't take this PR as-is, for two categories of reasons:

Scope. Only part of the diff addresses #7973. The PR also changes remote agent-status retention in orca-runtime.ts (a high-invariant area for mobile/web session snapshots), reverts the deliberate two-agent compact-summary behavior in WorktreeCardAgents (that collapse was an intentional, commented product decision), touches native-chat suppression and title-derived agent rows, and adds resources/hermes.png. Those need to be separate PRs with their own review; bundling them makes the account fix unmergeable on its own merits.

Defects in the account slice:

  1. getRemoteProviderAccountsSnapshot resolves on the first ready/snapshot message and immediately unsubscribes. The ready snapshot is the pre-refresh state, and the refreshed usage that accounts.subscribe broadcasts afterwards is thrown away — remote usage shown in the pane is stale/null and never updates while it's open.
  2. The server-side accounts.list change (return stale snapshot, fire refresh in background) alters a documented mobile-facing contract — the existing comment explains mobile renders "stale nulls / zeroes" without the blocking refresh — and it isn't even needed for the desktop path, which never calls accounts.list remotely in this PR.
  3. setRateLimitsFromPush(snapshot.rateLimits) injects the server's rate limits into the same store slot the desktop's own rateLimits.onUpdate push channel continuously overwrites (useIpcEvents.ts). The two writers fight; usage numbers flicker between remote and local values nondeterministically.
  4. The AccountsPane load effect depends on the settings object identity, so every unrelated settings mutation re-runs the remote subscribe round-trip.

We've opened #7999, which keeps your direction and semantics for list/select/remove routing (with credit), but uses a persistent accounts.subscribe watch for live updates, leaves accounts.list and the local rate-limit store untouched, keys reloads on activeRuntimeEnvironmentId, and stays scoped to the account surfaces. It also picks up your one-line switch-exhaustiveness lint fix. The agent-activity/Hermes changes here would be welcome as their own focused PRs — the stateStartedAt reordering observation in particular looks worth pursuing separately.

@AmethystLiang
AmethystLiang requested review from AmethystLiang and Jinwoo-H and removed request for AmethystLiang July 10, 2026 05:13
@SiteupAgencia

Copy link
Copy Markdown
Author

Added 9bd22bca2 to preserve inbox semantics for completed agents: when a selected thread receives a newer done/blocked/waiting transition, it stays unread until the user explicitly reopens or marks it read. This covers the case where the user is already viewing Agents when the agent requests input.

Validation: 33 focused Activity tests, web typecheck, oxlint/React Doctor hooks, formatting, and a full macOS ARM64 build. The build is installed locally. End-to-end remote validation is pending a safe restart window because two real agents are still active on the VPS runtime.

@SiteupAgencia
SiteupAgencia force-pushed the siteup/fix-agents-ui branch from ec5416f to 6630f4b Compare July 10, 2026 16:11
Lucas Oliveira and others added 3 commits July 10, 2026 15:47
# Conflicts:
#	src/main/native-chat/transcript-reader.ts
#	src/main/runtime/orca-runtime.ts
#	src/renderer/src/components/native-chat/native-chat-attachment-upload.ts
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/lib/launch-agent-in-new-tab.ts
@SiteupAgencia SiteupAgencia changed the title Fix remote agent activity and provider account ownership Fix remote agent workflows and runtime performance Jul 11, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for Jinwoo-H July 20, 2026 18:40
@AmethystLiang AmethystLiang added the orca-remote-server Remote Orca Server / orca serve / paired remote runtime label Jul 22, 2026
@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
@nwparker

nwparker commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — the linked issue(s) for this PR were fixed by another change that has already been merged.

Superseding merge: #7999

Thank you for the contribution! If anything remains unaddressed, please open a new issue or PR against current main.

@nwparker nwparker closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working orca-remote-server Remote Orca Server / orca serve / paired remote runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote provider account UI silently reads and mutates local accounts

6 participants