Repository navigation
Conversation
Options hung off CatalogModel.options, which is per-model; permission mode is per-session and orthogonal to the model, so the catalog gains a sessionOptions array and a cycle-key mid-session kind. hasYoloTuiAgentLaunch asks 'is bypass granted?' by containment, unlike resolveTuiAgentPermissionMode which asks 'are these exactly the yolo preset?' and reports mixed once any extra arg is present.
A session option has no model to file under, so the record gains a sessionValues bucket beside valuesByModel. Reported values route there by catalog id, survive a model switch, and stay truthful when the model itself is unreadable.
Every mode names itself in the status line, manual included — observed live, not derivable from the binary's label table. Reading it needs no banner, which matters because the banner scrolls out of the viewport after the first screenful and would otherwise strand the read. The live-screen reader is parse-driven across three sources: the snapshot's current frame (the alternate screen itself while a TUI owns it), its normal buffer, then the mounted xterm. Falling back only on an empty READ stranded us on a stale buffer that parsed to nothing.
…pped Shift+Tab advances one mode per press — there is no menu to answer, and which modes exist varies per session. So press-and-observe rather than computing a step count, bounded by a completed lap or a press cap. The send queue is drained first: a chat send holds a delayed Enter for ~500ms, and one landing mid-cycle would pick a mode the user never chose. Bypass is gated on the launch flag, read from the pane's own status entry rather than settings.agentDefaultArgs (the default for new sessions, not what this one launched with — see stablyai#10886). An observed bypass mode is itself proof of the grant, which backstops a launch-args lookup miss. Every failure here is invisible from the chat pane, so the outcome names the step that gave up and the modes it saw.
…lyai#11548) Mode sits left of the options and model pills and shows the current selection — including Manual, since the button's whole job is naming what is selected. It is deliberately out of the effort menu. Bypass renders an Enable affordance that deep-links to Settings → Agents → Agent Permissions rather than driving Claude's danger warning, so Orca never auto-consents to a permission bypass on the user's behalf. That needed per-choice disabling, which the picker could not express before. Mode labels are scoped to their own option: Cursor ships a model named 'auto', and a shared switch would relabel it in every non-English locale. The composer's send-path choice moves to its own module to stay under the file's max-lines budget.
…status line A bare `/fast` no longer toggles — it opens a confirmation panel (Tab to toggle · Enter to confirm) that a dispatch leaves hanging and unapplied. The CLI still accepts `/fast on|off`, which sets the value directly. That makes fast mode an absolute setter, so the flip-only machinery it was the last user of is gone: the blind-flip fallback for an unknown baseline was a bare `/fast`, which is exactly the command that now opens the panel. Its state instead comes from Claude's own ↯ glyph, so the picker no longer needs a baseline to reason from — absence is only read as off on a screen the banner proves is Claude's. Also fixes a latent bug in command recording: a picker command cleared the tracked model for whichever option was being matched, so a typed bare `/fast` would have blanked every model-scoped row.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThe change adds Claude session-scoped permission modes with launch-argument gating and Shift+Tab cycling. Terminal readers detect permission and fast modes from live screens. Session state separates session values from model values. Native chat pickers render permission modes separately and expose settings actions for unavailable choices. Fast mode uses explicit on/off commands. Composer sending uses a unified dispatcher, and mobile toggle-only handling is removed. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
mobile/src/session/use-mobile-native-chat-session-options.ts (1)
163-171: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftWire session-scoped options through the mobile controller.
The shared snapshot publishes
permissionModeas settable.setOption()only resolves model-scoped options, sosetOption('permissionMode', 'plan')returnsfalsebefore it can dispatch the mode change.Resolve
catalog.sessionOptionsbefore model options. Thread the liveagentArgsandagentEnvinto the snapshot call so a mobile session launched with bypass permissions does not render Bypass as unavailable.Also applies to: 217-225
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bc032dae-3acd-444e-b998-289c47296a15
📒 Files selected for processing (43)
mobile/src/session/MobileNativeChatSessionOptionRows.tsxmobile/src/session/use-mobile-native-chat-session-options.tssrc/renderer/src/components/native-chat/NativeChatComposer.tsxsrc/renderer/src/components/native-chat/NativeChatSessionOptionPickers.test.tsxsrc/renderer/src/components/native-chat/NativeChatSessionOptionPickers.tsxsrc/renderer/src/components/native-chat/claude-permission-mode-cycle.test.tssrc/renderer/src/components/native-chat/claude-permission-mode-cycle.tssrc/renderer/src/components/native-chat/claude-terminal-session-options.mode.test.tssrc/renderer/src/components/native-chat/claude-terminal-session-options.test.tssrc/renderer/src/components/native-chat/claude-terminal-session-options.tssrc/renderer/src/components/native-chat/native-chat-composer-send-dispatch.tssrc/renderer/src/components/native-chat/native-chat-live-screen.test.tssrc/renderer/src/components/native-chat/native-chat-live-screen.tssrc/renderer/src/components/native-chat/native-chat-live-session-launch-args.test.tssrc/renderer/src/components/native-chat/native-chat-live-session-launch-args.tssrc/renderer/src/components/native-chat/native-chat-pty-session-options.mode.test.tssrc/renderer/src/components/native-chat/native-chat-pty-session-options.test.tssrc/renderer/src/components/native-chat/native-chat-pty-session-options.tssrc/renderer/src/components/native-chat/native-chat-session-option-apply.tssrc/renderer/src/components/native-chat/native-chat-session-option-command-dispatch.tssrc/renderer/src/components/native-chat/native-chat-session-option-labels.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-labels.tssrc/renderer/src/components/native-chat/native-chat-session-option-snapshot.mode.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-snapshot.tssrc/renderer/src/components/native-chat/use-native-chat-session-option-command.mode-cycle.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-session-option-command.tssrc/renderer/src/components/native-chat/use-native-chat-session-options.tssrc/renderer/src/components/settings/AgentsPane.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/shared/agent-session-option-catalog-claude-codex.tssrc/shared/agent-session-option-catalog-types.tssrc/shared/agent-session-option-catalog.test.tssrc/shared/agent-session-option-catalog.tssrc/shared/native-chat-session-option-commands.test.tssrc/shared/native-chat-session-option-commands.tssrc/shared/native-chat-session-option-record.test.tssrc/shared/native-chat-session-option-reporting.test.tssrc/shared/native-chat-session-option-snapshot.test.tssrc/shared/native-chat-session-option-snapshot.tssrc/shared/native-chat-session-option-state.tssrc/shared/native-chat-session-options.tssrc/shared/tui-agent-permissions.test.tssrc/shared/tui-agent-permissions.ts
💤 Files with no reviewable changes (1)
- mobile/src/session/MobileNativeChatSessionOptionRows.tsx
| // A repeat means a full lap completed without ever showing the target — | ||
| // it isn't in this session's cycle (e.g. bypass without the launch flag). | ||
| if (seen.has(mode)) { | ||
| return result('unavailable', 'not-in-cycle') | ||
| } | ||
| seen.add(mode) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
A stale screen read can be misreported as not-in-cycle.
The lap check treats any repeated mode as proof that the target is absent from the cycle. A slow repaint after a press returns the previous mode within settleMs, so the cycler reports unavailable and the user sees "is not in this session's cycle" even though the mode is available. Remote (SSH) hosts repaint more slowly than the fixed 250 ms settle.
Re-read once before you conclude a lap completed.
🛠️ Proposed re-read before declaring a lap
// A repeat means a full lap completed without ever showing the target —
// it isn't in this session's cycle (e.g. bypass without the launch flag).
if (seen.has(mode)) {
- return result('unavailable', 'not-in-cycle')
+ // Why: an unrepainted screen repeats the previous mode, which is not a lap.
+ await delay(settleMs)
+ const recheck = await args.readMode()
+ if (recheck === args.target) {
+ observed.push(recheck)
+ return result('applied', 'reached')
+ }
+ if (recheck === null || seen.has(recheck)) {
+ return result('unavailable', 'not-in-cycle')
+ }
+ observed.push(recheck)
+ seen.add(recheck)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // A repeat means a full lap completed without ever showing the target — | |
| // it isn't in this session's cycle (e.g. bypass without the launch flag). | |
| if (seen.has(mode)) { | |
| return result('unavailable', 'not-in-cycle') | |
| } | |
| seen.add(mode) | |
| // A repeat means a full lap completed without ever showing the target — | |
| // it isn't in this session's cycle (e.g. bypass without the launch flag). | |
| if (seen.has(mode)) { | |
| // Why: an unrepainted screen repeats the previous mode, which is not a lap. | |
| await delay(settleMs) | |
| const recheck = await args.readMode() | |
| if (recheck === args.target) { | |
| observed.push(recheck) | |
| return result('applied', 'reached') | |
| } | |
| if (recheck === null || seen.has(recheck)) { | |
| return result('unavailable', 'not-in-cycle') | |
| } | |
| observed.push(recheck) | |
| seen.add(recheck) | |
| } |
| function matchFastModeGlyph(lines: readonly string[]): boolean { | ||
| return lines.some( | ||
| (line) => line.includes(FAST_MODE_GLYPH) && !line.toLowerCase().includes(FAST_MODE_PANEL_TITLE) | ||
| ) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Restrict the fast-mode glyph match to the indicator window.
matchPermissionModeIndicator scans only the last INDICATOR_WINDOW_SIZE nonblank rows, but matchFastModeGlyph scans the whole screen. Any scrolled-past conversation row that contains ↯ reports fast mode as on. Both readClaudeFastModeFromTerminalScreen and readClaudeSessionOptionsFromTerminalScreen inherit that false positive.
Apply the same window to the glyph.
🛠️ Proposed windowed glyph match
function matchFastModeGlyph(lines: readonly string[]): boolean {
- return lines.some(
+ // Why: same staleness reason as the mode indicator — older rows may quote the glyph.
+ return withoutTrailingBlankRows(lines)
+ .slice(-INDICATOR_WINDOW_SIZE)
+ .some(
(line) => line.includes(FAST_MODE_GLYPH) && !line.toLowerCase().includes(FAST_MODE_PANEL_TITLE)
- )
+ )
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| function matchFastModeGlyph(lines: readonly string[]): boolean { | |
| return lines.some( | |
| (line) => line.includes(FAST_MODE_GLYPH) && !line.toLowerCase().includes(FAST_MODE_PANEL_TITLE) | |
| ) | |
| } | |
| function matchFastModeGlyph(lines: readonly string[]): boolean { | |
| // Why: same staleness reason as the mode indicator — older rows may quote the glyph. | |
| return withoutTrailingBlankRows(lines) | |
| .slice(-INDICATOR_WINDOW_SIZE) | |
| .some( | |
| (line) => line.includes(FAST_MODE_GLYPH) && !line.toLowerCase().includes(FAST_MODE_PANEL_TITLE) | |
| ) | |
| } |
| const screens: (string | null)[] = [] | ||
| if (args.ptyId && window.api?.pty?.getMainBufferSnapshot) { | ||
| try { | ||
| const snapshot = await window.api.pty.getMainBufferSnapshot(args.ptyId, { scrollbackRows: 0 }) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Add a timeout before the xterm fallback.
getMainBufferSnapshot has no deadline. If the IPC promise remains pending, this function never reads scrollbackAnsi or the mounted xterm. This can leave permission-mode changes waiting indefinitely. Bound the IPC read and continue with fallback sources when it times out. Add a pending-promise test.
| const parsed = args.parse(screen) | ||
| if (parsed) { | ||
| return parsed |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Accept valid falsy parser results.
parse permits any T | null. A parser that returns false is valid, but this truthiness check discards it and can return a later result or null. Compare against null explicitly. Add a test with a false result.
Proposed fix
- if (parsed) {
+ if (parsed !== null) {
return parsed
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const parsed = args.parse(screen) | |
| if (parsed) { | |
| return parsed | |
| const parsed = args.parse(screen) | |
| if (parsed !== null) { | |
| return parsed |
| const target = resolveTarget() | ||
| if (!target || disabled) { | ||
| return { outcome: 'unknown', reason: 'unreadable', presses: 0, observed: [] } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
The no-target path reports a misleading reason.
reason: 'unreadable' makes describeClaudePermissionModeCycle render "Could not read the current mode from the terminal." The actual cause is a missing PTY target or a disabled composer. Add a distinct reason so the toast states the real cause.
🛠️ Proposed distinct reason
src/renderer/src/components/native-chat/claude-permission-mode-cycle.ts:
export type ClaudePermissionModeCycleReason =
| 'reached'
| 'unreadable'
+ | 'no-terminal'
| 'undelivered' case 'unreadable':
return 'Could not read the current mode from the terminal.'
+ case 'no-terminal':
+ return 'No live terminal is available.'Then in this file:
- return { outcome: 'unknown', reason: 'unreadable', presses: 0, observed: [] }
+ return { outcome: 'unknown', reason: 'no-terminal', presses: 0, observed: [] }| const discoveredModels = discoveryContext | ||
| ? readNativeChatEnrichedModels(agent, discoveryContext.hostKey) | ||
| : null | ||
| const { agentArgs, agentEnv } = resolveNativeChatLiveSessionLaunchArgs(paneKey) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Inspect the launch-arg resolver, the store slice it reads, and pane-key construction.
fd -a 'native-chat-live-session-launch-args.ts' -X cat -n
rg -nP -C4 'agentStatusByPaneKey|getAgentLaunchConfigForStatusEntry' --type=ts --type=tsx -g '!**/*.test.*'
rg -nP -C4 '\bpaneKey\s*[=:]' --type=tsx -g '**/native-chat/**'Repository: stablyai/orca
Length of output: 1110
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- target file ---'
cat -n src/renderer/src/components/native-chat/use-native-chat-session-options.ts | sed -n '1,220p'
printf '%s\n' '--- resolver and store definitions/usages ---'
rg -n -C5 'agentStatusByPaneKey|getAgentLaunchConfigForStatusEntry|resolveNativeChatLiveSessionLaunchArgs' src/renderer/src --glob '*.ts' --glob '*.tsx'
printf '%s\n' '--- native-chat pane key references ---'
rg -n -C4 'paneKey' src/renderer/src/components/native-chat --glob '*.ts' --glob '*.tsx'Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- session options hook ---'
cat -n src/renderer/src/components/native-chat/use-native-chat-session-options.ts | sed -n '1,210p'
printf '%s\n' '--- launch-arg resolver location ---'
fd -a -t f 'native-chat-live-session-launch-args.ts'
printf '%s\n' '--- resolver usages and status-store writes (excluding tests) ---'
rg -n -C3 'resolveNativeChatLiveSessionLaunchArgs|agentStatusByPaneKey' src/renderer/src/components/native-chat src/renderer/src/store --glob '*.ts' --glob '*.tsx' --glob '!*.test.*' | head -n 400
printf '%s\n' '--- status entry type and launch-config selector ---'
rg -n -C6 'getAgentLaunchConfigForStatusEntry|type AgentStatusEntry|interface AgentStatusEntry' src --glob '*.ts' --glob '*.tsx' --glob '!*.test.*' | head -n 300Repository: stablyai/orca
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- remaining hook logic ---'
cat -n src/renderer/src/components/native-chat/use-native-chat-session-options.ts | sed -n '180,380p'
printf '%s\n' '--- pty surface implementation ---'
cat -n src/renderer/src/components/native-chat/native-chat-pty-session-options.ts | sed -n '1,340p'
printf '%s\n' '--- launch config API ---'
rg -n -C10 --glob '*.ts' --glob '*.tsx' --glob '!*.test.*' 'getAgentLaunchConfigForStatusEntry'
printf '%s\n' '--- launch config state updates ---'
rg -n -C8 --glob '*.ts' --glob '*.tsx' --glob '!*.test.*' 'agentLaunchConfigByPaneKey|setAgentLaunchConfig'Repository: stablyai/orca
Length of output: 14991
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- all launch-config references ---'
rg -n -C5 'getAgentLaunchConfig|agentLaunchConfigByPaneKey' . --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' | head -n 500
printf '%s\n' '--- option applier async/state behavior ---'
cat -n src/renderer/src/components/native-chat/native-chat-session-option-apply.ts 2>/dev/null | sed -n '1,320p' || true
fd -a -t f '*session-option*' src/renderer/src/components/native-chat
printf '%s\n' '--- relevant cache implementation ---'
cat -n src/renderer/src/components/native-chat/native-chat-session-option-cache.ts | sed -n '1,240p'Repository: stablyai/orca
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- launch-config matching ---'
cat -n src/renderer/src/store/slices/agent-status.ts | sed -n '1025,1175p'
printf '%s\n' '--- launch-config registration ---'
cat -n src/renderer/src/store/slices/agent-status.ts | sed -n '1675,1778p'
printf '%s\n' '--- cache implementation ---'
cat -n src/renderer/src/components/native-chat/native-chat-session-option-cache.ts | sed -n '1,260p'
printf '%s\n' '--- applier set/dispatch paths ---'
cat -n src/renderer/src/components/native-chat/native-chat-session-option-apply.ts | sed -n '120,340p'Repository: stablyai/orca
Length of output: 20393
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- registration call sites ---'
rg -n -C8 'registerAgentLaunchConfig\(' src --glob '*.ts' --glob '*.tsx' --glob '!*.test.*' | head -n 300
printf '%s\n' '--- hook call sites and prop flow ---'
rg -n -C12 'useNativeChatSessionOptions\(' src/renderer/src --glob '*.ts' --glob '*.tsx' --glob '!*.test.*'
printf '%s\n' '--- pane key construction and status event keys ---'
rg -n -C5 'setAgentStatus\(|paneKey.*:.*leafId|\\$\\{.*\\}:\\$\\{.*\\}' src/renderer/src --glob '*.ts' --glob '*.tsx' --glob '!*.test.*' | head -n 500Repository: stablyai/orca
Length of output: 15534
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
hook = Path("src/renderer/src/components/native-chat/use-native-chat-session-options.ts").read_text()
store = Path("src/renderer/src/store/slices/agent-status.ts").read_text()
cache = Path("src/renderer/src/components/native-chat/native-chat-session-option-cache.ts").read_text()
apply = Path("src/renderer/src/components/native-chat/native-chat-session-option-apply.ts").read_text()
# Read-only structural checks for the state-shape and lifecycle claim.
assert "const state = useAppStore.getState()" in Path(
"src/renderer/src/components/native-chat/native-chat-live-session-launch-args.ts"
).read_text()
memo_deps = hook[hook.index(" }, [", hook.index("const surface")):hook.index(" ])", hook.index("const surface"))]
assert "agentStatusByPaneKey" not in memo_deps
assert "agentLaunchConfigByPaneKey" not in memo_deps
register = store[store.index("registerAgentLaunchConfig:"):store.index("getAgentLaunchConfigForStatusEntry:")]
assert "agentLaunchConfigByPaneKey:" in register
assert "agentStatusByPaneKey:" not in register
# Minimal state transition model: registering launch metadata changes the
# registry object but leaves the status-entry object reference unchanged.
status_entry = {"paneKey": "tab-1:leaf-1", "agentType": "claude"}
state_before = {
"agentStatusByPaneKey": {"tab-1:leaf-1": status_entry},
"agentLaunchConfigByPaneKey": {},
}
state_after = {
"agentStatusByPaneKey": state_before["agentStatusByPaneKey"],
"agentLaunchConfigByPaneKey": {
"tab-1:leaf-1": {"launchConfig": {"agentArgs": "--dangerously-skip-permissions"}}
},
}
assert state_after["agentStatusByPaneKey"]["tab-1:leaf-1"] is status_entry
assert state_after["agentLaunchConfigByPaneKey"] is not state_before["agentLaunchConfigByPaneKey"]
# The cache is cloned on read/write, so replacing the surface creates a new
# record. The async applier writes only after its dispatch finishes.
assert "cloneNativeChatSessionOptionRecord(record)" in cache
assert "await dispatchLiveCommand" in apply
assert "ctx.publish()" in apply
print("status-entry selector would not observe a launch-config-only update")
print("launch config is keyed independently by the same pane key")
print("surface replacement creates an independent cached record while live dispatch is async")
PYRepository: stablyai/orca
Length of output: 240
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
files = {
"hook": Path("src/renderer/src/components/native-chat/use-native-chat-session-options.ts").read_text(),
"resolver": Path("src/renderer/src/components/native-chat/native-chat-live-session-launch-args.ts").read_text(),
"store": Path("src/renderer/src/store/slices/agent-status.ts").read_text(),
"cache": Path("src/renderer/src/components/native-chat/native-chat-session-option-cache.ts").read_text(),
"apply": Path("src/renderer/src/components/native-chat/native-chat-session-option-apply.ts").read_text(),
}
checks = [
("resolver uses getState", "const state = useAppStore.getState()" in files["resolver"]),
("memo has no status selector", "agentStatusByPaneKey" not in files["hook"][files["hook"].index(" }, [", files["hook"].index("const surface")):files["hook"].index(" ])", files["hook"].index("const surface")]),
("memo has no launch selector", "agentLaunchConfigByPaneKey" not in files["hook"]),
("registration updates launch registry", "agentLaunchConfigByPaneKey:" in files["store"][files["store"].index("registerAgentLaunchConfig:"):files["store"].index("getAgentLaunchConfigForStatusEntry:")]),
("registration does not update status map", "agentStatusByPaneKey:" not in files["store"][files["store"].index("registerAgentLaunchConfig:"):files["store"].index("getAgentLaunchConfigForStatusEntry:")]),
("cache clones records", "cloneNativeChatSessionOptionRecord(record)" in files["cache"]),
("apply awaits dispatch", "await dispatchLiveCommand" in files["apply"]),
("apply publishes", "ctx.publish()" in files["apply"]),
]
for name, value in checks:
print(f"{name}: {value}")
PYRepository: stablyai/orca
Length of output: 683
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
hook = Path("src/renderer/src/components/native-chat/use-native-chat-session-options.ts").read_text()
resolver = Path("src/renderer/src/components/native-chat/native-chat-live-session-launch-args.ts").read_text()
store = Path("src/renderer/src/store/slices/agent-status.ts").read_text()
cache = Path("src/renderer/src/components/native-chat/native-chat-session-option-cache.ts").read_text()
apply = Path("src/renderer/src/components/native-chat/native-chat-session-option-apply.ts").read_text()
surface_start = hook.index(" const surface = useMemo")
deps_start = hook.index(" }, [", surface_start)
deps_end = hook.index(" ])", deps_start)
deps = hook[deps_start:deps_end]
checks = [
("resolver uses getState", "const state = useAppStore.getState()" in resolver),
("memo has no status selector", "agentStatusByPaneKey" not in deps),
("memo has no launch selector", "agentLaunchConfigByPaneKey" not in deps),
("registration updates launch registry", "agentLaunchConfigByPaneKey:" in store[store.index("registerAgentLaunchConfig:"):store.index("getAgentLaunchConfigForStatusEntry:")]),
("registration does not update status map", "agentStatusByPaneKey:" not in store[store.index("registerAgentLaunchConfig:"):store.index("getAgentLaunchConfigForStatusEntry:")]),
("cache clones records", "cloneNativeChatSessionOptionRecord(record)" in cache),
("apply awaits dispatch", "await dispatchLiveCommand" in apply),
("apply publishes", "ctx.publish()" in apply),
]
for name, value in checks:
print(f"{name}: {value}")
PYRepository: stablyai/orca
Length of output: 415
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
store = Path("src/renderer/src/store/slices/agent-status.ts").read_text()
start = store.index(" registerAgentLaunchConfig:")
end = store.index(" getAgentLaunchConfigForStatusEntry:", start)
register = store[start:end]
print("registration range:", start, end)
print("updates launch registry:", "agentLaunchConfigByPaneKey:" in register)
print("updates status map:", "agentStatusByPaneKey:" in register)
print("relevant lines:")
for number, line in enumerate(register.splitlines(), start=1695):
if "agentLaunchConfigByPaneKey" in line or "agentStatusByPaneKey" in line:
print(f"{number}: {line.strip()}")
PYRepository: stablyai/orca
Length of output: 464
Make launch-argument availability reactive to the launch-config registry.
agentLaunchConfigByPaneKey is separate from agentStatusByPaneKey, and registerAgentLaunchConfig updates only the registry. Subscribe to the pane's launch-config and status entries, then update the existing surface without replacing it during an in-flight option command.
|
Addressing both warnings. Out of Scope Changes ✅Fair catch — #11548 only asks for Plan mode. Filed #14752 for the fast-mode bug and linked it, so that scope is now covered by an issue of its own rather than riding on #11548. On why it isn't split into a separate PR: the two changes are entangled in the same files ( The fast-mode change is isolated to its own commit ( Docstring Coverage
|
|
Related active PRs for cross-review: #30677 (agent settings and terminal Auto), #30853 (native-chat defaults, stacked on #30677), and #19244. Refs #13081 and #25559. #30853 configures per-agent defaults for newly created structured native chats. This PR adds live permission-mode controls for terminal-backed native chat. Cross-review launch-default seeding alongside live mode persistence, preserving existing chat choices when defaults change, and CLI/model support checks for Auto. #19244 and #30677 overlap settings controls and permission mappings. #30853 uses explicit native-sync opt-in and a separate host capability to preserve behavior in both directions of mixed-version pairing. |
|
Thank you for this PR. Both halves have now landed on main in other forms: the composer has a permission mode picker with per-agent defaults (#30853, #31315), and Fast mode is owned by the chat (#30561). Since this branch is stale and conflicting, we are closing it as superseded. We appreciate you taking the time to build it. Please open an issue if either is still off on the latest build. |
ELI5
Claude Code lets you change how much it's allowed to do on its own — ask me every time, auto-accept edits, plan without touching anything, and so on. In the terminal you switch that with Shift+Tab. In Orca's Chat UI there was no way to see or change it, so a chat session was stuck on whatever it launched with.
This adds a Mode button next to the composer that shows the current mode and lets you change it, and fixes Claude's fast mode toggle, which broke when the CLI started asking for confirmation.
What Changed
Mode button in the composer (Claude sessions), left of the options and model pills. Shows the live mode — Manual / Accept edits / Plan / Auto / Bypass permissions — and switches it mid-session.
Under the hood:
sessionOptionsonAgentSessionOptionCatalogsessionValueson the option recordclaude-terminal-session-options.tsnative-chat-live-screen.tsclaude-permission-mode-cycle.tsNativeChatSessionOptionPickers.tsxFast mode fix (#14752). A bare
/fastno longer toggles — it opens a confirmation panel (Tab to toggle · Enter to confirm) that a dispatch leaves hanging and unapplied. The CLI still accepts/fast on|off, which sets the value outright.That makes fast mode an absolute setter, so the flip-only machinery it was the last user of is removed (
isFlipOnlyMidSession, thetoggle-commandkind, the Toggle action row, flip dedup — across shared, renderer and mobile). The flip's fallback for an unknown baseline was a bare/fast, which is exactly the command that now opens the panel. State comes from Claude's↯glyph instead, so no baseline is needed.Also fixes a latent bug found on the way: a picker command cleared the tracked model for whichever option was being matched, so a typed bare
/fastwould have blanked every model-scoped row.Why
Three facts about Claude's CLI shaped the implementation. All were verified against a live session — the first two contradict what the shipped binary's own strings suggest, and cost me a rewrite each:
There is no slash command for permission mode, and Shift+Tab cycles — it does not open a menu. The numbered menu is the Claude Code desktop app; Orca drives the CLI. So an apply presses, re-reads the status line, and repeats until the target appears — bounded by a completed lap or a press cap.
Every mode names itself in the status line, manual included (
⏸ manual mode on). Reading it needs no banner, which matters because Claude's banner scrolls out of the viewport after the first screenful — a banner-gated read reports nothing for the rest of the session.Bypass is launch-granted only. Claude refuses it otherwise:
So that row deep-links to Settings → Agents → Agent Permissions rather than driving Claude's danger warning. Orca never auto-consents to a permission bypass on the user's behalf — that decision stays with the existing setting.
Safety property: the cycle drains the PTY send queue before its first keystroke. A chat send holds a delayed Enter for ~500 ms, and one landing mid-cycle would select a mode the user never chose. Pinned by an order-asserting test, not just a "was called" check.
Linked Issue
Fixes #11548
Fixes #14752 (Chat UI fast mode toggle no longer applies — bare
/fastopens a confirmation panel)Substantially addresses #12576 (Per-session permission mode selector in the Chat UI composer), which specifies this feature in detail. Deliberately not covered, so review can judge scope rather than discover gaps:
orca terminal show/ worktree JSON./approvalsand other harnesses are untouched — the catalog now has the extension point for them.Relationship to open work
tui-agent-permissions.ts,AgentsPane.tsx,en.json— whichever lands second rebases. They compose correctly: an Auto-preset session reports bypass as unavailable here, which is right.agent-session-option-catalog-claude-codex.tsand the labels/pickers. It adds Codex fast mode while this changes Claude's. Worth coordinating on ordering.settings.agentDefaultArgs(the default for new sessions).No open PR implements the chat-UI permission mode picker — this is not a duplicate.
Visual Proof
1 — Composer, Mode button (after). The new control, showing the live mode (
Auto). Before this PR the composer had only the options and model pills, with no way to see or change permission mode.2 — The same session's terminal.
▶▶ auto mode on (shift+tab to cycle)— the pill reflects what the TUI actually reports, and changing it in the TUI propagates back to the pill.3 — After setting fast mode from the picker. Pills read
Accept editsandHigh · Fast; the transcript showsRan /fast on.4 — The same, in the terminal.
/fast on→↯ Fast mode ON · $10/$50 per Mtok, with no confirmation panel left hanging. Status line readsaccept edits on.5 — Effort dropdown, Fast mode section. Fast mode now shows real
On/Offstate read from Claude's↯glyph. Before, an unknown baseline could only offer a blind "Toggle fast mode" action.6 — Mode dropdown. Manual / Accept edits / Plan / Auto, plus
Bypass permissionscarrying anEnableaffordance because this session wasn't launched with--dangerously-skip-permissions. That row deep-links to Settings → Agents → Agent Permissions rather than driving Claude's danger warning.Testing
pnpm run lint,pnpm typecheck,pnpm test,pnpm buildall pass locally.src/main/rate-limits/codex-fetcher-pty-settle.test.tsfail identically on cleanorigin/main(verified in a separate worktree atb849099045). Not from this change.Regression tests pin the specific things that broke during development, all of which shipped-and-were-caught by real use:
how do I turn plan mode onmust not be read as live status.plan 2 thingsabove the menu must not yield a wrong digit.✓, so a fixed label→digit table is wrong).Failure paths are diagnosable rather than silent — a failed change names the step that gave up and the modes it saw (
Gave up after 6 presses; saw auto → plan → …).AI Disclosure
Written with Claude Code (Opus 5, 1M context) driving implementation, review and this description, with the author testing against live sessions and directing the design.
Review
Cross-platform (macOS / Linux / Windows). No platform-specific code paths, no
metaKeyhardcoding, no path construction. The change is terminal-text parsing plus a dropdown. Verified on macOS; the parsing is platform-neutral (it reads PTY output, not OS APIs).Remote SSH / local. The screen reader tries the main-buffer snapshot API first and falls back to the mounted xterm, which is the only source for remote/SSH ptys the API doesn't cover — the same layering the existing model/effort read uses. Keystrokes go through
sendRuntimePtyInput, which already branches local vs. remote. Not yet tested over a real SSH session:settleMs(250 ms between cycle presses) is a reasoned default, and a slow round-trip could make it read a stale mode. That self-corrects (one extra press, re-settle) but is the one number to tune if it misbehaves.Mobile. Touched only by the flip-only removal (
use-mobile-native-chat-session-options.ts,MobileNativeChatSessionOptionRows.tsx). Mobile has no permission-mode picker; its option surface is unchanged otherwise, and its tests pass.Agent / integration compatibility. Codex, Gemini, Cursor and Grok catalogs declare no
sessionOptions, so no new descriptor appears for them and their reporting path is unchanged. Mode labels are scoped by option id — Cursor ships a model literally namedauto, and an unscoped label switch would have relabelled it in every non-English locale (there's a test for exactly that).Backwards compatibility.
sessionValuesis guarded for records rehydrated from a cache written before the field existed. The removedtoggle-commandkind had no remaining catalog user in any agent.Performance. The screen read runs once on mount and once per mode change, not in a hot path. The cycle is bounded by a press cap and a completed-lap check, so it cannot spin. No new subscriptions or timers outside the bounded cycle.
Security. The one security-relevant decision is deliberate: Orca never auto-confirms Claude's dangerous-permissions prompt. Selecting Bypass when it isn't launch-granted routes the user to Orca's own Agent Permissions setting instead of pressing through the warning — consent stays an explicit, existing control. Launch args are read from the live pane's status entry, never from the global default, so a stale global can't imply a permission the session doesn't have.
Known limitation worth its own issue.
getLaunchConfigForEntry(agent-status.ts:948) passeslaunchToken: undefined, whileregisterAgentLaunchConfigstores entries with a token and the matcher rejects on mismatch — so launch args resolve empty for essentially every Orca-launched session, not an edge case. This PR works around it (an observedbypass permissions onis itself proof of the grant); the residual gap is a bypass-launched session never scraped even once. A real fix needslaunchTokenonAgentStatusEntryand everysetAgentStatussite, which is out of scope here.Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (one pre-existing unrelated test failure, noted above)Author