mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 08:02:35 +00:00
* fix: recover from an alternate shell install, and close the relay echo gap #18768: a startup profile that `exec`s a second install of the same shell keeps the pid but loses the wrapper's ready marker, and the recovery probe rejected the replacement's different canonical path -- costing plain Codex the full 15s barrier. The probe now also accepts an install that the pane's own PATH resolves, so a binary merely named bash/zsh outside it stays rejected. #18767: the SSH relay left plain Codex on early startup delivery, displaying the launch twice under a slow profile. The shell is the host's to know, so the relay now folds it into the same rule the daemon uses, and the SSH background client waits for the marker on any Codex launch. Bracketed paste is now gated on an observed marker rather than on the intent to wait, so a fallback release on a host shell that never publishes one submits raw. The non-daemon local provider needs no change: it hands Codex to the wrapper's own prompt hook and never writes it into the PTY. * review: correct an overclaiming comment, announce a silent skip, drop a shim Readiness review of #18796. The delivery comment claimed waiting "costs nothing", which is only true on a host that arms the marker -- fish, sh, Windows and hosts predating #18767 release on the fallback instead. Say so. The alternate-install recovery tests skip on usrmerge hosts, where /usr/bin/bash resolves back to /bin/bash; announce that rather than reading as coverage that does not exist. Import the line-editor predicate from shared directly instead of through a re-export left on daemon/shell-ready.
71 lines
2.6 KiB
TypeScript
71 lines
2.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
hasCodexNativeDraftFlag,
|
|
shouldUseShellReadyStartupDelivery
|
|
} from './codex-startup-delivery'
|
|
|
|
describe('hasCodexNativeDraftFlag', () => {
|
|
it('matches Codex --prefill option tokens', () => {
|
|
expect(hasCodexNativeDraftFlag("codex --prefill 'linked issue context'")).toBe(true)
|
|
expect(hasCodexNativeDraftFlag("codex --model gpt-5 --prefill 'draft'")).toBe(true)
|
|
})
|
|
|
|
it('matches Codex --prefill=value option tokens', () => {
|
|
expect(hasCodexNativeDraftFlag('codex --prefill=review')).toBe(true)
|
|
expect(hasCodexNativeDraftFlag("codex --prefill='linked issue context'")).toBe(true)
|
|
})
|
|
|
|
it('does not match quoted prompt text mentioning prefill', () => {
|
|
expect(hasCodexNativeDraftFlag("codex 'please compare --prefill behavior'")).toBe(false)
|
|
expect(hasCodexNativeDraftFlag("codex '--prefill=not-an-option'")).toBe(false)
|
|
})
|
|
|
|
it('does not match non-Codex commands', () => {
|
|
expect(hasCodexNativeDraftFlag("claude --prefill 'review this'")).toBe(false)
|
|
})
|
|
|
|
it('leaves plain Codex and normal Codex arguments on the fast path', () => {
|
|
expect(hasCodexNativeDraftFlag('codex')).toBe(false)
|
|
expect(hasCodexNativeDraftFlag('codex --model gpt-5')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('shouldUseShellReadyStartupDelivery', () => {
|
|
it('honours an explicit shell-ready hint whatever the command', () => {
|
|
expect(
|
|
shouldUseShellReadyStartupDelivery({
|
|
command: 'claude',
|
|
startupCommandDelivery: 'shell-ready'
|
|
})
|
|
).toBe(true)
|
|
})
|
|
|
|
it('keeps plain Codex on the fast path when the shell is unknown', () => {
|
|
expect(shouldUseShellReadyStartupDelivery({ command: 'codex' })).toBe(false)
|
|
})
|
|
|
|
it('waits for plain Codex on shells that publish the marker from the line editor', () => {
|
|
expect(shouldUseShellReadyStartupDelivery({ command: 'codex', shellPath: '/bin/bash' })).toBe(
|
|
true
|
|
)
|
|
expect(
|
|
shouldUseShellReadyStartupDelivery({ command: 'codex', shellPath: '/opt/homebrew/bin/zsh' })
|
|
).toBe(true)
|
|
})
|
|
|
|
it('leaves plain Codex unwaited on shells that emit the marker before the reader', () => {
|
|
expect(
|
|
shouldUseShellReadyStartupDelivery({ command: 'codex', shellPath: '/usr/bin/fish' })
|
|
).toBe(false)
|
|
})
|
|
|
|
it('does not change non-Codex commands, which their transports already wait for', () => {
|
|
expect(shouldUseShellReadyStartupDelivery({ command: 'claude', shellPath: '/bin/bash' })).toBe(
|
|
false
|
|
)
|
|
expect(shouldUseShellReadyStartupDelivery({ command: undefined, shellPath: '/bin/bash' })).toBe(
|
|
false
|
|
)
|
|
})
|
|
})
|