Files
archived-orca/mobile/src/session/agent-session-failure-copy.test.ts
Brennan BensonandNarry 7fbb47e713 fix(omp): use OMP model roles, selectors and effort in chats and workers (#38713)
* fix(omp): launch OMP chats with their saved model and accept OMP effort

OMP's Chat UI model option names only listed provider/id values, so a
worker started with an OMP role or provider/model:level selector failed
before its first message. OMP resolves those on its launch line, so the
chat's saved model now rides 'omp acp --model', and a new session counts
it as applied. OMP's launch catalog gains its thinking levels, so
--effort is accepted and applied (--thinking in a terminal, the session's
thinking option in a chat).

Tracked in STA-13562.

* fix(omp): keep OMP role chats working after a restart

OMP's ACP model option takes listed provider/id values only, and a load restores the conversation's own model, so a role-started chat failed with "Unknown ACP model" on its first send after an Orca restart.

- New chats keep the saved model on OMP's launch line; resumed chats no longer pass it, so a renamed role cannot stop a good conversation from opening.
- When OMP's model option refuses a value as unknown, Orca applies it through OMP's own /model, the resolver --model uses, as a hidden send-time command. It counts as applied only on OMP's "Model set to" reply and a normal end; cancel or timeout retires the process.
- The command's reply and title notices never reach the chat, its status or unread state.
- Proof from the launch line or /model is retired when OMP changes its model or thinking itself; ordinary model-option proof keeps its existing rule.
- A refusal names the agent and the next step; on OMP older than 18.1.9, whose /model takes ids only, it also names the release to update to, carried on the modelUnavailable fact.

Tracked in STA-13562.

Co-authored-by: Narry <3047793+NarryG@users.noreply.github.com>

* fix(omp): keep role steers in order and say when OMP has no model

- A role steer that OMP's model option refuses now holds its place among queued steers: answers ahead of it are cancelled as they start, and a Stop or teardown while it waits withdraws it without sending /model or the message.
- OMP's "No model selected" (an unresolved launch role, or signed out) is reported as its own failure, "OMP has no model selected. Check your model selection and OMP sign-in, then send again.", instead of a sign-in failure; the next send applies the selection again.
- A cancelled model command reads as not sent, and an option write settles once.

Tracked in STA-13562.

Co-authored-by: Narry <3047793+NarryG@users.noreply.github.com>

* fix(omp): keep OMP's no-model text in the log and test a late /model answer

Tracked in STA-13562.

Co-authored-by: Narry <3047793+NarryG@users.noreply.github.com>

* fix(omp): a Stop still withdraws a waiting role steer after main's turn changes

Main now clears stopAt when a turn finishes, so reserveSteer counts Stops
instead of reading stopAt. Refusal wording moves to acpPromptRejection to
keep the turns file within its line budget; behaviour is unchanged.

Co-authored-by: Narry <3047793+NarryG@users.noreply.github.com>

* fix(omp): a Stop withdraws a role message anywhere in its preparation

A message that falls back to OMP's /model now counts as a held steer from
before its option writes until it is admitted. A Stop in that window
withdraws it unsent, even with no turn running; ordinary messages keep
their Stop behaviour. Restores the launch-role no-resend test main's file
removal dropped.

Co-authored-by: Narry <3047793+NarryG@users.noreply.github.com>

* fix(omp): a Stop before OMP refuses /model reads as a withdrawn message

A Stop the role message already took outranks OMP's own refusal of the
model command, so the message reads as cancelled and never sent rather
than as a model failure. Pins that a Stop with no turn running is still
refused while an idle send's first model-option write is pending: the hold
starts when the send falls back, not before its option writes (the host's
Stop aborts the send's signal there).

Co-authored-by: Narry <3047793+NarryG@users.noreply.github.com>

* test(omp): put the cast's safety note on the line above the cast

* test(omp): cover the new failure copy on phone and desktop, and OMP's thinking levels

Tests the no-model sentence and the update hint in English and one
translation on each surface, every level omp --thinking takes, and that a
missing model classifies as the agent's own refusal.

* test(omp): import the launch module once in the catalog test

---------

Co-authored-by: Narry <3047793+NarryG@users.noreply.github.com>
2026-11-06 02:21:09 -08:00

56 lines
1.9 KiB
TypeScript

import { afterEach, expect, it } from 'vitest'
import { agentSessionFailureSentence } from '../../../src/shared/agent-session/failures/agent-session-failure-words'
import { activateMobileUiLocale } from '../i18n/mobile-i18n'
import { sayMobileAgentSessionFailure } from './agent-session-failure-copy'
afterEach(async () => {
await activateMobileUiLocale('en')
})
it('gives new-chat guidance while keeping a missing conversation diagnostic private', () => {
expect(
agentSessionFailureSentence(
{
kind: 'savedConversationMissing',
detail: { text: 'No conversation found with session ID: private-id', audience: 'log' }
},
'row',
{ agentName: 'Claude' },
sayMobileAgentSessionFailure
)
).toBe("Claude couldn't find this chat's saved conversation. Start a new chat to continue.")
})
it.each([
[
'en',
'OMP has no model selected. Check your model selection and OMP sign-in, then send again.',
"OMP couldn't use @worker_be. Update OMP to 18.1.9 or later to keep it after a restart, or pick another model and send again."
],
[
'de',
'OMP hat kein Modell ausgewählt. Modellauswahl und OMP-Anmeldung prüfen und erneut senden.',
expect.stringContaining('OMP auf 18.1.9 oder neuer aktualisieren')
]
] as const)(
'words a missing OMP model and the update hint on the phone (%s)',
async (locale, none, update) => {
await activateMobileUiLocale(locale)
const say = (fact: Parameters<typeof agentSessionFailureSentence>[0]) =>
agentSessionFailureSentence(
fact,
'rejection',
{ agentName: 'OMP' },
sayMobileAgentSessionFailure
)
expect(say({ kind: 'modelNotSelected' })).toBe(none)
expect(
say({
kind: 'modelUnavailable',
detail: { text: '@worker_be', audience: 'log' },
agentUpdate: '18.1.9'
})
).toEqual(update)
}
)