fix(edit-history): a remote lookup takes the conversation written last, not the first id's

Review round 2: with the stored conversation tried before the launch id, a
respawn that resumed the launch conversation after a /clear was missed once
claude exited again: the cleared-to conversation still had a file and won,
so the edits made after the resume were never read. No fixed order of the
ids is right both after a /clear and after such a resume. Without a live
conversation the lookup now takes the most recently written transcript of
all known ids (stored, claudeSessionId, id); the live one still goes first.

Also from the review:
- the remote no-transcript note and the docs name login profiles too
  (.profile, .bash_profile): sshd's `bash -c` reads neither, like .zshrc;
- a wiring guard pins that server.ts looks a remote transcript up with
  remoteTranscriptIds and leaves the local lookup on the hook path;
- the browser tests undo the injected remote session in a finally.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
RandalixandClaude Opus 5.5 committed 2026-11-05 11:20:01 +01:00
1 parent 0a6a877415
commit 5bcec26066
9 files changed
+80 -46

No files matched your search

+5 -4
View File
@@ -113,10 +113,11 @@ export interface SyncOptions {
}
/**
* The conversation ids a REMOTE session's transcript lookup tries, in order, after the one its
* claude writes now. No hook tells Codeman of a remote `/clear`, so `claudeSessionId` stays the
* launch id; tried first, it would flip the panel back to the cleared conversation as soon as
* the remote claude exits. The stored history's conversation is the newest the panel has read.
* The conversation ids a REMOTE session's transcript lookup considers when its claude writes
* none now; the most recently written of them wins (`buildRemoteClaudeTranscriptLocateCommand`).
* The stored history's conversation must be among them: no hook tells Codeman of a remote
* `/clear`, so `claudeSessionId` stays the launch id, and without the stored one the panel
* would flip back to the cleared conversation as soon as the remote claude exits.
*/
export function remoteTranscriptIds(session: EditHistorySession, storedTranscriptId: string | null): string[] {
return [...new Set([storedTranscriptId, session.claudeSessionId || session.id, session.id])].filter(
+1 -1
View File
@@ -369,7 +369,7 @@ Object.assign(CodemanApp.prototype, {
? t('Showing saved entries only: {reason}', { reason: data.reason || '' })
: this.sessions?.get?.(h.sessionId)?.remote
? t(
'No transcript found on the remote host yet (Claude writes it with the first prompt). A CLAUDE_CONFIG_DIR set only in an interactive shell profile (.zshrc) cannot be found.'
'No transcript found on the remote host yet (Claude writes it with the first prompt). A CLAUDE_CONFIG_DIR set only in a shell profile (.profile, .bash_profile, .zshrc) cannot be found.'
)
: t(
'No transcript found for this session yet. It is picked up with the next prompt; until then a CLAUDE_CONFIG_DIR set outside Codeman cannot be found.'
+2 -2
View File
@@ -570,8 +570,8 @@
'Showing saved entries only: {reason}': '仅显示已保存的条目:{reason}',
'No transcript found for this session yet. It is picked up with the next prompt; until then a CLAUDE_CONFIG_DIR set outside Codeman cannot be found.':
'尚未找到此会话的记录。它会在下一次提示时被识别;在此之前,在 Codeman 之外设置的 CLAUDE_CONFIG_DIR 无法被找到。',
'No transcript found on the remote host yet (Claude writes it with the first prompt). A CLAUDE_CONFIG_DIR set only in an interactive shell profile (.zshrc) cannot be found.':
'远程主机上尚未找到记录(Claude 会在第一次提示时写入)。仅在交互式 shell 配置文件(.zshrc)中设置的 CLAUDE_CONFIG_DIR 无法被找到。',
'No transcript found on the remote host yet (Claude writes it with the first prompt). A CLAUDE_CONFIG_DIR set only in a shell profile (.profile, .bash_profile, .zshrc) cannot be found.':
'远程主机上尚未找到记录(Claude 会在第一次提示时写入)。仅在 shell 配置文件(.profile、.bash_profile、.zshrc)中设置的 CLAUDE_CONFIG_DIR 无法被找到。',
'No edits yet.': '暂无编辑。',
'No edits by the main agent.': '主智能体没有编辑。',
'Load older': '加载更早的编辑',