Files
orca/src/main/codex/codex-structured-compaction-refusal.test.ts
T
Brennan BensonandClaude 6af34a4d99 fix(chat): name the agent when it refuses a message (#27946)
* refactor: move provider-retry pieces into a sibling words file

Pure move of the six provider-retry translation pieces out of
agent-session-failure-words-text.ts, which sits at the 300-line limit.
No key or behaviour change.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(chat): name the agent when it refuses a message

"The provider did not accept this message" becomes "{{agent}} didn't
accept this message" ("The agent" when the name is unknown), in English
and every locale. The providerRejected failure kind is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 14:29:38 -07:00

43 lines
1.5 KiB
TypeScript

// A compaction Codex refuses up front keeps Codex's own words for the chat's failure row.
import { describe, expect, it } from 'vitest'
import { structuredAgentSessionCommandTurn } from '../native-chat/agent-session-wire/structured-agent-session-command-turn'
import { CodexAppServerRequestError } from './codex-app-server-connection'
import { acquired, fakeCodex } from './codex-structured-session-adapter-fixture'
describe('Codex compaction refused at the request', () => {
it("carries Codex's message as the detail, apart from Orca's wrapper", async () => {
const codex = fakeCodex({
'thread/compact/start': () => {
throw new CodexAppServerRequestError(
'thread/compact/start',
-32600,
'codex app-server thread/compact/start failed: thread has nothing to compact',
'thread has nothing to compact'
)
}
})
const adapter = await acquired(codex)
const turn = structuredAgentSessionCommandTurn('cmd-1')
await expect(
adapter.compact({
sessionId: 'session-1',
fence: 7,
command: {
clientMessageId: 'cmd-1',
...turn,
running: { kind: 'turn', turnId: turn.turnId, state: 'running' }
}
})
).resolves.toEqual({
state: 'rejected',
reason: "Codex didn't accept this message: thread has nothing to compact.",
rejection: {
kind: 'providerRejected',
detail: { text: 'thread has nothing to compact', audience: 'person' }
}
})
})
})