Skip to content

Add a per-host running terminal limit setting - #31396

Merged
brennanb2025 merged 19 commits into
mainfrom
brennanb2025/orca-settings-html-mock
Oct 29, 2026
Merged

brennanb2025 merged 19 commits into
mainfrom
brennanb2025/orca-settings-html-mock

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Orca’s default limit of 256 running terminals per computer was introduced in #27488. When Orca reaches that limit, users cannot start another terminal or terminal agent. This adds Settings → Terminal → Advanced → Maximum running terminals so they can see and change that limit for the selected computer, including a connected remote computer.

  • Shows the current limit and, when available, the operating system’s terminal limit.
  • Prevents entering a value above the known system limit or 4096 terminals. Changing the setting does not change the operating system’s limit or require sudo.
  • Raising the limit allows more terminals to start. Lowering it leaves existing terminals running.
  • Derives the default from half of the selected computer’s known system limit, rounded up and capped at 4096; uses 256 when that limit is unavailable. An existing environment-variable override and a saved user value still take priority.
  • Has no range/default caption or Reset button.

Older connected servers continue to work as before; editing the limit is unavailable until the server supports it.

Orca checks the system limit on the computer where the terminals run. For a remote connection, that means the remote computer. These checks only read the current limit; they do not use sudo or change it.

Platform How Orca gets the system PTY limit
macOS Runs /usr/sbin/sysctl -n kern.tty.ptmx_max.
Linux Reads /proc/sys/kernel/pty/max and /proc/self/mounts directly, without starting a command. The equivalent commands for inspecting those files are cat /proc/sys/kernel/pty/max and cat /proc/self/mounts. If the /dev/pts mount has its own max= limit, Orca uses the lower of that value and the system limit.
Windows Runs no command to get a system PTY limit. This implementation cannot read a comparable limit on Windows, so it shows Unavailable. Orca’s own running-terminal limit can still be changed.

The system value is total capacity shared with other terminal apps, not the number of terminals the user can still open or a separate per-user allowance.

The sleeping-conversation Resume correction is tracked in #35401 and is separate from this change.

Saved-limit reads happen in the background; terminal admission uses the effective value already in memory. Valid reads apply when they finish, including slow reads. If a saved file becomes unreadable or invalid, Orca keeps the last good value and Settings explains how to replace it. An explicitly edited value can repair the file, including re-entering the same number; untouched or canceled edits do not save. A pending read alone does not show a failure warning.

Validation: focused policy, daemon socket, admission, selected-host/older-server, renderer, existing-user settings and deterministic startup-error tests pass. The branch-only Settings run saved 384, corrupted only its disposable policy file, retained 384 with the explanation, and repaired the real file through the input. The app-language number-formatting regression also passes (11/11 renderer tests). CI is green on d2b3387, including static analysis/typecheck, all ten unit shards, cross-version compatibility, packaging, persistence, SSH and the separate WSL checks. Review status.

Intended limits: other profiles receive changes after their next eligible background read completes. An already-open Settings field keeps its last fetched value until its next normal fetch, even if a late read or another window changes the daemon’s effective value; it is not a live display. Already-issued filesystem replacements can complete after a save request expires; the daemon reconciles the actual saved file, without a global latest-request-wins promise.

Screenshots from the isolated branch copy

Saved 384; this computer’s system limit is 511:

loop2-settings.png

Unreadable saved file; effective 384 remains editable:

loop2-saved-read-failed.png

Explicit same-number edit repaired the file and cleared the explanation:

loop2-saved-read-repaired.png

@brennanb2025
brennanb2025 marked this pull request as ready for review October 21, 2026 04:32
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in 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

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16228ce8-e342-447b-9412-a6234f7b5aea
📥 Commits

Reviewing files that changed from the base of the PR and between 51c0a9d and 5da3151.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 2
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/i18n/locales/en.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Adds per-host terminal-limit policy, including system PTY capacity detection and saved settings. Daemon and runtime APIs support reading and updating the limit. Terminal spawn admission uses the resolved host maximum. The settings interface adds a host-scoped control with status, validation, retry handling, translations, and tests.

Priority: Normal

Merge Risk: Moderate · up to 5da31

A damaged policy file can leave terminal-limit settings unavailable until the file or permissions are repaired, so this recovery gap should be addressed before merge.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding a per-host running terminal limit setting.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is detailed and relevant. It explains the user impact, implementation, platform behavior, testing, screenshots, known limitations, and review status. It does not follow the template he…
Full details: Description check

Explanation

The description is detailed and relevant. It explains the user impact, implementation, platform behavior, testing, screenshots, known limitations, and review status. It does not follow the template headings exactly and does not include a Fixes #... linked issue, explicit checklist items, or an agent-skill boundary statement.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f598061f-0550-4091-b00b-cd2bb86226a1
📥 Commits

Reviewing files that changed from the base of the PR and between b0d873d and 58ff3e6.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 39
  • src/main/daemon/daemon-automatic-work-guard.ts
  • src/main/daemon/daemon-automatic-work-resume.ts
  • src/main/daemon/daemon-control-request.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-request-deadline.ts
  • src/main/daemon/daemon-server-options.ts
  • src/main/daemon/daemon-server.ts
  • src/main/daemon/daemon-terminal-limit-protocol.ts
  • src/main/daemon/daemon-terminal-limit.test.ts
  • src/main/daemon/host-terminal-ledger.ts
  • src/main/daemon/host-terminal-policy.test.ts
  • src/main/daemon/host-terminal-policy.ts
  • src/main/daemon/system-pty-limit.ts
  • src/main/daemon/terminal-spawn-admission-mode.ts
  • src/main/daemon/terminal-spawn-gate.ts
  • src/main/daemon/terminal-spawn-host-share.ts
  • src/main/ipc/pty/runtime/controller.ts
  • src/main/runtime/orca-runtime-get-status.ts
  • src/main/runtime/orca-runtime-pty-controller.ts
  • src/main/runtime/rpc/methods/terminal-daemon.ts
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/main/window/owned-temp-staging-root.ts
  • src/renderer/src/components/settings/TerminalAdvancedSection.tsx
  • src/renderer/src/components/settings/TerminalLimitSetting.test.tsx
  • src/renderer/src/components/settings/TerminalLimitSetting.tsx
  • src/renderer/src/components/settings/TerminalPane.tsx
  • src/renderer/src/components/settings/settings-interface-primary-section-renderers.tsx
  • src/renderer/src/components/settings/terminal-advanced-platform-search.ts
  • src/renderer/src/components/settings/terminal-limit-transport.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/owned-private-directory.ts
  • src/shared/rpc-contract/terminal-limit-params.ts
  • src/shared/terminal-limit-policy.ts
  • src/shared/terminal-runtime-capabilities.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment thread src/main/daemon/host-terminal-policy.ts Resolved
Comment thread src/main/daemon/terminal-spawn-gate.ts Resolved
@brennanb2025

brennanb2025 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Orca previously limited each computer to 256 running terminals without a Settings control. This adds Settings → Terminal → Advanced → Maximum running terminals for the selected computer. The initial default is half of the known system limit, rounded up and capped at 4096, or 256 if unavailable. A saved value and ORCA_DAEMON_MAX_HOST_TERMINALS retain priority. Editing is capped at the known system limit or 4096; older paired servers show editing unavailable and retain their launch behavior.

The review corrected a silent fallback that could ignore a saved value when storage was slow or unreadable. Admissions now use the daemon’s effective in-memory value. Background reads apply validated results whenever they finish; actual failures retain the last good value and show a short explanation in Settings. An explicitly edited same-number value can repair the saved file. Untouched fields and canceled edits do not save. The Resume correction is separate in #35401.

Verified: focused policy, real socket, terminal-gate, selected-host/old-server, renderer and existing-user settings tests. The three actual branch screenshots below passed. CI is green on d2b3387, including static analysis/typecheck, all ten unit shards, cross-version compatibility, packaging, persistence, SSH and the separate WSL checks. Deterministic startup-test synchronization and app-language number formatting were also corrected (11/11 renderer tests). Settings is a tests-row flow, so this review did not rerun agents, Resume or a platform matrix. Terminal source round 6 (cd1d714), reference, performance and readiness reviews accepted the fix. The single main merge (002998f) and subsequent CI corrections were narrowly reviewed. Bounded source review confirms the two automated threads describe explicitly accepted limitations, disclosed below. Production-loop tests cover finite slow reads, held reads, save/disposal fencing and N/10N admission work.

Intended limits: propagation to another profile takes its next eligible background read plus storage latency. An already-open Settings field retains its last fetched value until its next normal fetch; it does not update live after a late read or another window’s save. This can differ from the daemon’s independently refreshed admission value. Startup waits only a bounded time; a pending read alone does not claim a storage failure. An already-issued filesystem replacement may finish after its request expires and physically replace a later save; the daemon reconciles the actual file without confirming the expired request. The review explicitly retained this physical-write ordering limit; no global latest-request-wins guarantee is claimed.

For Brennan’s review

Saved value:

loop2-settings.png

Unreadable saved file, retaining 384:

loop2-saved-read-failed.png

After explicitly clearing/retyping 384 and Enter:

loop2-saved-read-repaired.png

Review spots: cache publication and health, explicit edit and repair, physical save completion.

Screenshots ran on 386f99556f0d0ae445003020629339a2f94a2a93 using an isolated M4Air copy; later 3ad31801c432b0e144e8f835d17318b3eaee7baf changes test synchronization. The reviewed current head, d2b3387a65e2ea9815cdd42c66e26c2be4bc6b80, only changes the two displayed-number calls to use the app language, covered by the French renderer regression (11/11). The captured English 384/511 screens are unchanged. Graceful cleanup is verified; real config hashes are unchanged. Both thread schedules are acknowledged as accepted limitations, not claimed fixed or refuted. Final head is out of draft, merge state CLEAN, with no unresolved threads. No merge has been performed.

The Resume correction fixes a bug that already exists at the default limit,
so it now lives in #35401 and this change only adds the terminal limit
setting.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the existing non-blocking issue that an open setting can show an outdated limit.

Summary

Adds a running-terminal limit for the selected computer, including remote computers.

  • Each computer now has a configurable running-terminal limit.
  • The selected daemon now reports and saves its terminal limit.
  • Terminal settings now show and edit the selected computer’s limit.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Settings: selected computer] --> B[Host RPC]
  B --> C[Terminal daemon]
  C --> D[HostTerminalPolicy]
  D --> E[Saved policy file]
  D --> F[Cached effective limit]
  F --> G[TerminalSpawnGate]
  G --> H[Allow or refuse a new terminal]
Loading

Reviews (9) · Last reviewed commit: "Format terminal capacity using the app l..." · Reviewed by Greptile

Comment thread src/main/daemon/host-terminal-policy.ts Resolved
Comment thread src/main/daemon/host-terminal-policy.ts Resolved
Comment thread src/renderer/src/i18n/locales/pt.json Resolved
@brennanb2025
brennanb2025 merged commit 91efcc4 into main Oct 29, 2026
71 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/orca-settings-html-mock branch October 29, 2026 19:19
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.

1 participant