Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Let Change agent switch a busy Claude harness, and say why a switch is held (#1484)

0xken15812bcd8963a1
diff --git a/cli/src/engines/kit/exactTranscript.spec.ts b/cli/src/engines/kit/exactTranscript.spec.ts
index 20329e214..f16bd5851 100644
--- a/cli/src/engines/kit/exactTranscript.spec.ts
+++ b/cli/src/engines/kit/exactTranscript.spec.ts
@@ -79,6 +79,23 @@ describe('exact resume uses complete native evidence', () => {
})
await expect(repair.findResumedTranscript('claude', ID)).rejects.toMatchObject({ code: 'IDENTITY_UNAVAILABLE' })
})
+ // A working Claude Code appends to its transcript all the time. The readability check demanded an unchanged size, so a
+ // busy session was held on every pass and Change agent refused it (a lamp-tasks agent, 2026-10-21).
+ it('accepts a transcript its engine appends to while it is checked, but not one replaced by another file', async () => {
+ const transcript = claude()
+ const actual = await vi.importActual<typeof import('node:fs/promises')>('node:fs/promises')
+ vi.mocked(fs.open).mockImplementation(async (name, flags, mode) => {
+ if (String(name) === transcript) await actual.appendFile(transcript, '{"type":"assistant"}\n')
+ return actual.open(name, flags, mode)
+ })
+ await expect(repair.findResumedTranscript('claude', ID)).resolves.toBe(transcript)
+ vi.mocked(fs.open).mockImplementation(async (name, flags, mode) => {
+ // Moved aside, not deleted: Linux hands a freed inode straight to the next file, which would look like the same one.
+ if (String(name) === transcript) { renameSync(transcript, `${transcript}.old`); writeFileSync(transcript, '{}\n') }
+ return actual.open(name, flags, mode)
+ })
+ await expect(repair.findResumedTranscript('claude', ID)).rejects.toMatchObject({ code: 'IDENTITY_UNAVAILABLE' })
+ })
it('uses the Codex header id rather than a coincidental filename substring', async () => {
codex('wrong', OTHER)
await expect(repair.findResumedTranscript('codex', ID)).resolves.toBeNull()
diff --git a/cli/src/engines/kit/exactTranscript.ts b/cli/src/engines/kit/exactTranscript.ts
index 2be7ab3c7..9af95a29e 100644
--- a/cli/src/engines/kit/exactTranscript.ts
+++ b/cli/src/engines/kit/exactTranscript.ts
@@ -1,9 +1,9 @@
/** A complete, bounded native pool for an exact resume id. No optional reader or cross-poll cache. */
-import { lstatSync, realpathSync, statSync, type Stats } from 'node:fs'
-import { lstat, readlink, realpath } from 'node:fs/promises'
+import { constants, lstatSync, realpathSync, statSync, type Stats } from 'node:fs'
+import { lstat, open, readlink, realpath } from 'node:fs/promises'
import { dirname, isAbsolute, join, parse, resolve, sep } from 'node:path'
import { performance } from 'node:perf_hooks'
-import { identityBytes, identityEntries, identityScanBudget, IdentityReadUnavailable, type IdentityVersion } from './identityScan.js'
+import { identityEntries, identityScanBudget, IdentityReadUnavailable, type IdentityVersion } from './identityScan.js'
type Layout = { kind: 'projects'; filename: string }
| { kind: 'walk' | 'directory'; matches: (name: string) => boolean }
@@ -11,6 +11,17 @@ type Proof = { path: string; info: Stats | null; content: boolean }
const identity = (info: Stats | null) => info && `${info.dev}:${info.ino}:${info.mode}`
const signature = (info: Stats | null) => info && `${identity(info)}:${info.size}:${info.mtimeMs}:${info.ctimeMs}`
+/** The inspected file opens and reads. Its engine may append meanwhile: a working session writes its transcript all the
+ * time, and demanding an unchanged size held every busy one (2026-10-21). Another file at the path is still refused. */
+async function readable(path: string, info: Stats): Promise<void> {
+ const handle = await open(path, constants.O_RDONLY | constants.O_NONBLOCK)
+ try {
+ const opened = await handle.stat()
+ if (identity(opened) !== identity(info)) throw new Error('another file')
+ if (opened.size > 0) await handle.read(Buffer.alloc(1), 0, 1, 0)
+ } finally { await handle.close() }
+}
+
/** Filename authority remains engine-declared. An optional native header can reject another id/cwd;
* every such exclusion is retained until the complete pool has been checked. */
export async function exactTranscript(roots: readonly string[], layout: Layout,
@@ -84,7 +95,7 @@ export async function exactTranscript(roots: readonly string[], layout: Layout,
if (!info.isFile()) throw new IdentityReadUnavailable('an exact transcript is not a regular file')
// Even filename-based authority needs a readable regular file. Opening one byte is bounded and
// nonblocking; stat alone would let an unreadable file authorize a binding.
- if (options.accepts ? await options.accepts(path, info) : await identityBytes(path, 1, info).then(() => true).catch(() => {
+ if (options.accepts ? await options.accepts(path, info) : await readable(path, info).then(() => true).catch(() => {
throw new IdentityReadUnavailable('an exact transcript could not be read')
})) {
selected.set(identity(info)!, selected.get(identity(info)!) ?? proof)
diff --git a/cli/src/lib/agentHandoff.spec.ts b/cli/src/lib/agentHandoff.spec.ts
index 2c3c75f75..4edcd01f4 100644
--- a/cli/src/lib/agentHandoff.spec.ts
+++ b/cli/src/lib/agentHandoff.spec.ts
@@ -416,6 +416,16 @@ describe('prepareAgentHandoff: a repository', () => {
expect(files.filter((name) => name.endsWith('.tmp'))).toEqual([])
})
+ // The hold names a program updated while it ran: no retry reads it, only a restart. The reply says so in a code.
+ it('names a held binding whose program was replaced, and only that one', async () => {
+ const replaced = 'Conversation identity is held: the agent\u2019s program was replaced on disk while it was running; restart the agent.'
+ await expect(prepareAgentHandoff(depsFor([session({ identityHold: replaced })]), request()))
+ .rejects.toMatchObject({ code: 'IDENTITY_UNAVAILABLE', hold: 'PROGRAM_REPLACED' })
+ const other = await prepareAgentHandoff(depsFor([session({ identityHold: 'Conversation identity is held: an exact transcript could not be read.' })]), request()).catch(e => e)
+ expect(other).toMatchObject({ code: 'IDENTITY_UNAVAILABLE' })
+ expect(other.hold).toBeUndefined()
+ })
+
it('holds unreadable history before consulting the mirror', async () => {
const mirror = vi.fn(() => 'token=supersecret1 done')
await expect(prepareAgentHandoff(depsFor([session({ transcriptPath: join(root, 'missing.jsonl') })], { lastFullText: mirror }), request())).rejects.toMatchObject({ code: 'IDENTITY_UNAVAILABLE' })
diff --git a/cli/src/lib/agentHandoff.ts b/cli/src/lib/agentHandoff.ts
index 9fb0deb48..f0aab8a68 100644
--- a/cli/src/lib/agentHandoff.ts
+++ b/cli/src/lib/agentHandoff.ts
@@ -32,6 +32,7 @@
import { HandoffError, handoffBaseName, handoffExcludeText, handoffSessionFact, type HandoffPermit, type PreparedHandoff, type NativeHandoffRead } from './handoffAuthority.js'
import { readNativeHandoff } from './nativeHandoffRead.js'
import { NativeFiles } from '../engines/kit/nativeFiles.js'
+import { REPLACED_PROGRAM } from '../engines/kit/identityScan.js'
import { nativeFileKey } from '../engines/kit/nativePaths.js'
import { handoffGitRoute } from './handoffGit.js'
import { readHandoffFile } from './handoffFiles.js'
@@ -543,7 +544,9 @@ export function prepareAgentHandoff(deps: HandoffDeps, req: HandoffRequest): Pro
const session = found && structuredClone(found)
if (expired()) throw new HandoffError('TIMEOUT')
if (!session) throw new HandoffError('UNKNOWN_AGENT')
- if (session.identityHold) throw new HandoffError('IDENTITY_UNAVAILABLE')
+ if (session.identityHold) {
+ throw new HandoffError('IDENTITY_UNAVAILABLE', session.identityHold.includes(REPLACED_PROGRAM) ? 'PROGRAM_REPLACED' : undefined)
+ }
const cwd = session.cwd
if (!cwd || !isAbsolute(cwd) || !isDirectory(cwd)) throw new HandoffError('NO_PROJECT')
const running = inFlight.get(session.agentId)
diff --git a/cli/src/lib/handoffAuthority.ts b/cli/src/lib/handoffAuthority.ts
index bc751573e..99d701019 100644
--- a/cli/src/lib/handoffAuthority.ts
+++ b/cli/src/lib/handoffAuthority.ts
@@ -48,9 +48,11 @@ export interface PreparedHandoff {
/** In process this closure belongs to the trusted service request handler. Across processes
* only the routed request id travels; core reconstructs its own live request witness. */
export type HandoffPermit = { requestId?: string; current(request: HandoffIntent): boolean }
+/** Why an identity hold will not clear by retrying, as a code the reply may carry: PROGRAM_REPLACED needs a restart. */
+export type HandoffHold = 'PROGRAM_REPLACED'
export class HandoffError extends Error {
constructor(readonly code: 'UNKNOWN_AGENT' | 'NO_PROJECT' | 'BAD_CHANGE_ID' | 'BUSY' | 'TIMEOUT'
- | 'IDENTITY_UNAVAILABLE' | 'HANDOFF_UNAVAILABLE' | 'CHANGE_CONFLICT') {
+ | 'IDENTITY_UNAVAILABLE' | 'HANDOFF_UNAVAILABLE' | 'CHANGE_CONFLICT', readonly hold?: HandoffHold) {
super(`handoff: ${code}`)
this.name = 'HandoffError'
}
diff --git a/cli/src/services/handoffRequest.spec.ts b/cli/src/services/handoffRequest.spec.ts
index 5c26fce65..f2da6a2e7 100644
--- a/cli/src/services/handoffRequest.spec.ts
+++ b/cli/src/services/handoffRequest.spec.ts
@@ -69,3 +69,17 @@ it.each(['IDENTITY_UNAVAILABLE', 'HANDOFF_UNAVAILABLE', 'TIMEOUT', 'BUSY'])('rep
expect(replies[0]).toMatchObject({ error: code, held: true, retryable: true, reason: expect.any(String) })
expect(replies[0].file).toBeUndefined()
})
+
+// A refusal used to leave no line in the log, so a switch that would not go through could only be guessed at (2026-10-21).
+it('logs every refusal by code, and passes a known hold on in the reply', async () => {
+ const logged = vi.spyOn(console, 'log').mockImplementation(() => {})
+ const replies = ask(async () => { throw { name: 'HandoffError', code: 'IDENTITY_UNAVAILABLE', hold: 'PROGRAM_REPLACED' } }, good({ agentId: 'a1b2c3d4-rest\nforged' }))
+ await vi.waitFor(() => expect(replies).toHaveLength(1))
+ expect(replies[0]).toMatchObject({ error: 'IDENTITY_UNAVAILABLE', held: true, hold: 'PROGRAM_REPLACED' })
+ const other = ask(async () => { throw { name: 'HandoffError', code: 'TIMEOUT', hold: 'made up /secret/path' } }, good())
+ await vi.waitFor(() => expect(other).toHaveLength(1))
+ expect(other[0].hold).toBeUndefined()
+ expect(logged.mock.calls.map(([line]) => line)).toEqual([
+ '[handoff] a1b2c3d4 refused · IDENTITY_UNAVAILABLE (PROGRAM_REPLACED)', '[handoff] a1 refused · TIMEOUT',
+ ])
+})
diff --git a/cli/src/services/handoffRequest.ts b/cli/src/services/handoffRequest.ts
index c57b3b07b..50e8111f5 100644
--- a/cli/src/services/handoffRequest.ts
+++ b/cli/src/services/handoffRequest.ts
@@ -41,8 +41,13 @@ export function createHandoffRequest({ prepare }: { prepare: ((req: HandoffReque
// slice of the transcript it choked on.
if (!known) console.error(`[handoff] prepare failed: ${e instanceof Error ? e.name : typeof e}${typeof code === 'string' && /^[A-Z0-9_]{1,40}$/.test(code) ? ` ${code}` : ''}`)
const held = known && ['IDENTITY_UNAVAILABLE', 'HANDOFF_UNAVAILABLE', 'TIMEOUT', 'BUSY'].includes(code)
+ // Only a hold the clients know goes on the wire, as a code: a program replaced while it ran needs a restart.
+ const hold = known && (e as { hold?: unknown }).hold === 'PROGRAM_REPLACED' ? 'PROGRAM_REPLACED' : undefined
+ // A refusal left no line before, so a switch that would not go through could only be guessed at (2026-10-21).
+ if (known) console.log(`[handoff] ${agentId.slice(0, 8).replace(/[^A-Za-z0-9_-]/g, '_')} refused · ${code}${hold ? ` (${hold})` : ''}`)
reply({ error: known ? code : 'INTERNAL', ...(held ? { held: true, retryable: true,
- reason: code === 'IDENTITY_UNAVAILABLE' ? 'Waiting for verified conversation history.' : 'Waiting for the handoff to become available.' } : {}) })
+ reason: code === 'IDENTITY_UNAVAILABLE' ? 'Waiting for verified conversation history.' : 'Waiting for the handoff to become available.' } : {}),
+ ...(hold ? { hold } : {}) })
})
}
}
diff --git a/desktop/lib/state/agent_handoff_file.dart b/desktop/lib/state/agent_handoff_file.dart
index e35fd5b6c..d57ea5dcd 100644
--- a/desktop/lib/state/agent_handoff_file.dart
+++ b/desktop/lib/state/agent_handoff_file.dart
@@ -88,6 +88,28 @@ String agentHandoffFilePrompt(
return (accepted: true, prompt: prompt);
}
+/// What the person reads when the machine holds a switch, by the reply's code alone: the reply is
+/// not trusted for words. A program updated while it ran stays held until the harness restarts, so
+/// that one says so; a busy or slow machine is worth another try; anything else keeps the old text.
+String agentHandoffHeldMessage(
+ Object? error,
+ Object? hold,
+ String sourceLabel,
+) {
+ if (error == 'IDENTITY_UNAVAILABLE' && hold == 'PROGRAM_REPLACED') {
+ return '$sourceLabel was updated while this harness was running. '
+ 'Use Restart Harness, then switch again.';
+ }
+ if (error == 'IDENTITY_UNAVAILABLE') {
+ return "This harness's conversation is not confirmed yet. "
+ 'Try switching again in a minute, or use Restart Harness.';
+ }
+ if (error == 'TIMEOUT' || error == 'BUSY') {
+ return 'Preparing the handoff took too long. Try switching again.';
+ }
+ return 'Waiting for the conversation handoff. Try switching again.';
+}
+
/// The pane hint for a switch where the machine confirmed there was no conversation to hand off.
String agentSwitchNoHistoryHint(String sourceLabel, String targetLabel) =>
'Switched to $targetLabel without history: no earlier conversation from '
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index cd9b4a1cf..369d8de7f 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -15682,7 +15682,11 @@ class AppNotifier extends ChangeNotifier {
return 'The conversation changed. Choose the agent again to start a new switch.';
}
if (reply['error'] != 'UNSUPPORTED') {
- return 'Waiting for the conversation handoff. Try switching again.';
+ return agentHandoffHeldMessage(
+ reply['error'],
+ reply['hold'],
+ engineIdentity(source.engine).label,
+ );
}
} catch (_) {
return 'Waiting for the conversation handoff. Try switching again.';
diff --git a/desktop/test/agent_change_test.dart b/desktop/test/agent_change_test.dart
index 149aa6d35..0f9cf1fb8 100644
--- a/desktop/test/agent_change_test.dart
+++ b/desktop/test/agent_change_test.dart
@@ -556,6 +556,12 @@ void main() {
'held': true,
'retryable': true,
},
+ 'IDENTITY_UNAVAILABLE for a replaced program': (_) => {
+ 'error': 'IDENTITY_UNAVAILABLE',
+ 'held': true,
+ 'retryable': true,
+ 'hold': 'PROGRAM_REPLACED',
+ },
'SERVICE_UNAVAILABLE': (_) => {'error': 'SERVICE_UNAVAILABLE'},
'a held reply without an error': (p) => {...handoffOk(p), 'held': true},
'an empty reply without project identity': (_) => {
@@ -587,7 +593,12 @@ void main() {
connection.handoff = reply;
expect(
await app.changeAgent('m', 'a0', 'claude'),
- contains('Waiting'),
+ anyOf(
+ contains('Waiting'),
+ contains('not confirmed yet'),
+ contains('took too long'),
+ contains('Restart Harness'),
+ ),
);
expect(connection.handoffCalls, hasLength(1));
expect(connection.recentReads, 0);
@@ -606,6 +617,25 @@ void main() {
);
}
+ test('says which hold it is, by the reply\'s code alone', () async {
+ final (connection, app) = await open();
+ connection.handoff = (_) => {
+ 'error': 'IDENTITY_UNAVAILABLE',
+ 'held': true,
+ 'hold': 'PROGRAM_REPLACED',
+ 'reason': 'words from the machine are never shown',
+ };
+ final message = await app.changeAgent('m', 'a0', 'claude');
+ expect(message, contains('was updated while this harness was running'));
+ expect(message, contains('Restart Harness'));
+ expect(message, isNot(contains('words from the machine')));
+ connection.handoff = (_) => {'error': 'TIMEOUT', 'held': true};
+ expect(
+ await app.changeAgent('m', 'a0', 'claude'),
+ 'Preparing the handoff took too long. Try switching again.',
+ );
+ });
+
test(
'unreadable history holds even if the mirror has no saved text',
() async {
@@ -638,7 +668,10 @@ void main() {
final (connection, app) = await open();
connection.recent = {'asks': <String>[], 'events': <Object>[]};
arrange(connection);
- expect(await app.changeAgent('m', 'a0', 'claude'), contains('Waiting'));
+ expect(
+ await app.changeAgent('m', 'a0', 'claude'),
+ anyOf(contains('Waiting'), contains('took too long')),
+ );
expect(connection.recentReads, 0);
expect(connection.creations, isEmpty);
expect(connection.events, isNot(contains('save/stop')));
diff --git a/desktop/test/agent_handoff_file_test.dart b/desktop/test/agent_handoff_file_test.dart
index 89da3d734..76d9153be 100644
--- a/desktop/test/agent_handoff_file_test.dart
+++ b/desktop/test/agent_handoff_file_test.dart
@@ -220,4 +220,51 @@ void main() {
expect(result.accepted, isFalse);
});
});
+
+ group('agentHandoffHeldMessage', () {
+ test('a program replaced while it ran asks for Restart Harness', () {
+ expect(
+ agentHandoffHeldMessage(
+ 'IDENTITY_UNAVAILABLE',
+ 'PROGRAM_REPLACED',
+ 'Claude Code',
+ ),
+ 'Claude Code was updated while this harness was running. '
+ 'Use Restart Harness, then switch again.',
+ );
+ });
+ test('an unconfirmed conversation, a slow machine and anything else', () {
+ expect(
+ agentHandoffHeldMessage('IDENTITY_UNAVAILABLE', null, 'Claude Code'),
+ contains('not confirmed yet'),
+ );
+ expect(
+ agentHandoffHeldMessage(
+ 'IDENTITY_UNAVAILABLE',
+ 'made up',
+ 'Claude Code',
+ ),
+ contains('not confirmed yet'),
+ reason: 'only a known hold changes the words',
+ );
+ for (final code in ['TIMEOUT', 'BUSY']) {
+ expect(
+ agentHandoffHeldMessage(code, null, 'Claude Code'),
+ 'Preparing the handoff took too long. Try switching again.',
+ );
+ }
+ expect(
+ agentHandoffHeldMessage(
+ 'HANDOFF_UNAVAILABLE',
+ 'PROGRAM_REPLACED',
+ 'Claude Code',
+ ),
+ 'Waiting for the conversation handoff. Try switching again.',
+ );
+ expect(
+ agentHandoffHeldMessage(null, null, 'Claude Code'),
+ 'Waiting for the conversation handoff. Try switching again.',
+ );
+ });
+ });
}
diff --git a/mobile/lib/core/agent_handoff.dart b/mobile/lib/core/agent_handoff.dart
index 014469e01..ec65889c5 100644
--- a/mobile/lib/core/agent_handoff.dart
+++ b/mobile/lib/core/agent_handoff.dart
@@ -162,6 +162,28 @@ String? agentSwitchHandoff(String source, Map<String, dynamic> recent) {
return [head, ...sections, tail].join('\n\n');
}
+/// What the person reads when the machine holds a switch, by the reply's code alone: the reply is
+/// not trusted for words. A program updated while it ran stays held until the harness restarts, so
+/// that one says so; a busy or slow machine is worth another try; anything else keeps the old text.
+String agentHandoffHeldMessage(
+ Object? error,
+ Object? hold,
+ String sourceLabel,
+) {
+ if (error == 'IDENTITY_UNAVAILABLE' && hold == 'PROGRAM_REPLACED') {
+ return '$sourceLabel was updated while this harness was running. '
+ 'Use Restart Harness, then switch again.';
+ }
+ if (error == 'IDENTITY_UNAVAILABLE') {
+ return "This harness's conversation is not confirmed yet. "
+ 'Try switching again in a minute, or use Restart Harness.';
+ }
+ if (error == 'TIMEOUT' || error == 'BUSY') {
+ return 'Preparing the handoff took too long. Try switching again.';
+ }
+ return 'Waiting for the conversation handoff. Try switching again.';
+}
+
/// The notice for a switch where the machine confirmed there was no conversation to hand off.
String agentSwitchNoHistoryHint(String sourceLabel, String targetLabel) =>
'Switched to $targetLabel without history: no earlier conversation from '
diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dart
index 4ebd4ae05..8619715b6 100644
--- a/mobile/lib/state/app_state.dart
+++ b/mobile/lib/state/app_state.dart
@@ -8500,7 +8500,11 @@ class AppNotifier extends ChangeNotifier {
change,
'handoff refused (${failure.code}); the old agent keeps running',
);
- return waiting;
+ return agentHandoffHeldMessage(
+ failure.code,
+ failure.hold,
+ engineIdentity(source.engine).label,
+ );
}
_logChange(
change,
diff --git a/mobile/lib/ws/ws_conn.dart b/mobile/lib/ws/ws_conn.dart
index 1e1b43b40..ae3b10bd1 100644
--- a/mobile/lib/ws/ws_conn.dart
+++ b/mobile/lib/ws/ws_conn.dart
@@ -66,6 +66,7 @@ class WsRequestFailure implements Exception {
required this.responseType,
required this.code,
this.detail,
+ this.hold,
});
/// The frame that carried the refusal — `agent_create_result`, say.
@@ -78,6 +79,10 @@ class WsRequestFailure implements Exception {
/// SPAWN_FAILED. Already reads as a sentence; prefer it to anything rewritten from [code].
final String? detail;
+ /// A code naming why the peer holds the request, when it sends one — `PROGRAM_REPLACED` from a
+ /// Change agent handoff. A code, never words to show: the caller picks its own sentence.
+ final String? hold;
+
@override
String toString() => detail == null || detail!.isEmpty
? '$responseType: $code'
@@ -838,11 +843,13 @@ class WsConn {
// message behind SPAWN_FAILED, say. Without it an error code alone sends the user to a log file
// on a machine that is not the one in front of them.
final detail = payload['detail'];
+ final hold = payload['hold'];
pending.completer.completeError(
WsRequestFailure(
responseType: message['type'] as String? ?? 'unknown_result',
code: '${payload['error']}',
detail: detail is String && detail.isNotEmpty ? detail : null,
+ hold: hold is String && hold.isNotEmpty ? hold : null,
),
);
} else {
diff --git a/mobile/test/agent_handoff_test.dart b/mobile/test/agent_handoff_test.dart
index a95f09865..c6a700dd8 100644
--- a/mobile/test/agent_handoff_test.dart
+++ b/mobile/test/agent_handoff_test.dart
@@ -263,4 +263,51 @@ void main() {
expect(supportsAgentHandoff(engine), isFalse, reason: engine);
}
});
+
+ group('agentHandoffHeldMessage', () {
+ test('a program replaced while it ran asks for Restart Harness', () {
+ expect(
+ agentHandoffHeldMessage(
+ 'IDENTITY_UNAVAILABLE',
+ 'PROGRAM_REPLACED',
+ 'Claude Code',
+ ),
+ 'Claude Code was updated while this harness was running. '
+ 'Use Restart Harness, then switch again.',
+ );
+ });
+ test('an unconfirmed conversation, a slow machine and anything else', () {
+ expect(
+ agentHandoffHeldMessage('IDENTITY_UNAVAILABLE', null, 'Claude Code'),
+ contains('not confirmed yet'),
+ );
+ expect(
+ agentHandoffHeldMessage(
+ 'IDENTITY_UNAVAILABLE',
+ 'made up',
+ 'Claude Code',
+ ),
+ contains('not confirmed yet'),
+ reason: 'only a known hold changes the words',
+ );
+ for (final code in ['TIMEOUT', 'BUSY']) {
+ expect(
+ agentHandoffHeldMessage(code, null, 'Claude Code'),
+ 'Preparing the handoff took too long. Try switching again.',
+ );
+ }
+ expect(
+ agentHandoffHeldMessage(
+ 'HANDOFF_UNAVAILABLE',
+ 'PROGRAM_REPLACED',
+ 'Claude Code',
+ ),
+ 'Waiting for the conversation handoff. Try switching again.',
+ );
+ expect(
+ agentHandoffHeldMessage(null, null, 'Claude Code'),
+ 'Waiting for the conversation handoff. Try switching again.',
+ );
+ });
+ });
}
diff --git a/mobile/test/phone_edge/focus_behavior_test.dart b/mobile/test/phone_edge/focus_behavior_test.dart
index 832707731..979d71a77 100644
--- a/mobile/test/phone_edge/focus_behavior_test.dart
+++ b/mobile/test/phone_edge/focus_behavior_test.dart
@@ -1168,7 +1168,7 @@ void main() {
expect(find.text('Rename'), findsNothing, reason: 'the menu went');
expect(
- find.text('Waiting for the conversation handoff. Try switching again.'),
+ find.text('Preparing the handoff took too long. Try switching again.'),
findsOneWidget,
);
expect(find.text('switching to Codex…'), findsNothing);
diff --git a/mobile/test/state/change_agent_test.dart b/mobile/test/state/change_agent_test.dart
index e36ac7d85..4b96c2479 100644
--- a/mobile/test/state/change_agent_test.dart
+++ b/mobile/test/state/change_agent_test.dart
@@ -231,7 +231,7 @@ void main() {
expect(
held.error,
- 'Waiting for the conversation handoff. Try switching again.',
+ 'Preparing the handoff took too long. Try switching again.',
);
expect(steps(rig), ['agent_handoff_prepare']);