claude-remote-cli 2.15.1 → 2.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server/sessions.js
CHANGED
|
@@ -134,9 +134,13 @@ function create({ type, agent = 'claude', repoName, repoPath, cwd, root, worktre
|
|
|
134
134
|
}, 5000);
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
-
proc.onExit((
|
|
138
|
-
// If continue args failed quickly, retry without them
|
|
139
|
-
|
|
137
|
+
proc.onExit(() => {
|
|
138
|
+
// If continue args failed quickly, retry without them.
|
|
139
|
+
// Exit code is intentionally not checked: tmux wrapping exits 0 even
|
|
140
|
+
// when the inner command (e.g. claude --continue) fails, because the
|
|
141
|
+
// tmux client doesn't propagate inner exit codes. The 3-second window
|
|
142
|
+
// is the primary heuristic — no user quits a session that fast.
|
|
143
|
+
if (canRetry && (Date.now() - spawnTime) < 3000) {
|
|
140
144
|
const retryArgs = args.filter(a => !continueArgs.includes(a));
|
|
141
145
|
const retryNotice = '\r\n[claude-remote-cli] --continue not available; starting new session...\r\n';
|
|
142
146
|
scrollback.length = 0;
|
|
@@ -407,4 +407,22 @@ describe('sessions', () => {
|
|
|
407
407
|
done();
|
|
408
408
|
});
|
|
409
409
|
});
|
|
410
|
+
it('retries when continue-arg process exits quickly with code 0 (tmux behavior)', (_, done) => {
|
|
411
|
+
const result = sessions.create({
|
|
412
|
+
repoName: 'test-repo',
|
|
413
|
+
repoPath: '/tmp',
|
|
414
|
+
command: '/bin/sh',
|
|
415
|
+
args: ['-c', 'exit 0', ...sessions.AGENT_CONTINUE_ARGS.claude],
|
|
416
|
+
});
|
|
417
|
+
createdIds.push(result.id);
|
|
418
|
+
const session = sessions.get(result.id);
|
|
419
|
+
assert.ok(session);
|
|
420
|
+
session.onPtyReplacedCallbacks.push((newPty) => {
|
|
421
|
+
assert.ok(newPty, 'should receive new PTY even with exit code 0');
|
|
422
|
+
assert.strictEqual(session.pty, newPty, 'session.pty should be updated');
|
|
423
|
+
const stillExists = sessions.get(result.id);
|
|
424
|
+
assert.ok(stillExists, 'session should still exist after retry');
|
|
425
|
+
done();
|
|
426
|
+
});
|
|
427
|
+
});
|
|
410
428
|
});
|