fix(cloud): a paste that isn't a code shows the refusal instead of nothing

This commit is contained in:
Neil
2026-11-11 17:30:23 -08:00
parent cdc4735aa6
commit 4ba241c00e
3 changed files with 11 additions and 0 deletions
@@ -176,6 +176,9 @@ describe('service: the code from the strip, Settings or the chat UI', () => {
canReopen: true
})
expect(service.submitClaudeCode('not a code')).toEqual({ ok: false, error: 'invalid_code' })
// A paste that isn't a code shows the refusal; the CLI never sees it.
expect(service.setups().claude).toMatchObject({ phase: 'browser', code: 'rejected' })
expect(children[0]!.writes).toEqual([])
expect(service.submitClaudeCode(` ${CODE} `)).toEqual({ ok: true, value: true })
expect(service.setups().claude).toMatchObject({ phase: 'browser', code: 'checking' })
expect(children[0]!.writes[0]).toBe(CODE)
@@ -13,6 +13,8 @@ export type ClaudeSetupRun = {
url: () => string | null
/** Types a (normalized) code into the waiting CLI; false when it can't take one now. */
submit: (code: string) => boolean
/** A paste that isn't a code at all: shown like a refused code, and the CLI never sees it. */
refuse: () => void
/** Abandons the run (cancel, sign-out, paste instead); nothing it reports afterwards lands. */
stop: () => void
}
@@ -105,6 +107,11 @@ export function startClaudeSetupRun(args: {
browser({ code: 'checking' })
return true
},
refuse: () => {
if (live && submitter) {
browser({ code: 'rejected' })
}
},
stop: () => {
live = false
url = null
@@ -275,6 +275,7 @@ export function createOrcaCloudAgentsService(deps: OrcaCloudAgentsServiceDeps) {
submitClaudeCode: (raw: string): OrcaCloudAgentsResult<true> => {
const code = normalizeClaudeSetupCode(raw)
if (!code) {
claudeRun?.refuse()
return { ok: false, error: 'invalid_code' }
}
return claudeRun?.submit(code)