detached caf28f0

fix(snapshot): address final review findings

Signed-off-by: brice <b@bnema.dev>
commit
caf28f0ce690ba4f2fc924bc9410d617ade31b23
author
brice · · 2026-07-06 08:09 UTC
parent
07ec9d9
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +5 -4
M internal/usecase/daemon/process_restore.go +2 -2
@@ -56,7 +56,7 @@ func extractAgentSessionID(strategy string, argv []string) string {
5656 func agentSessionFlag(strategy, arg string) bool {
5757 switch strategy {
5858 case processStrategyClaude:
59- return arg == "--session-id" || arg == "--resume"
59+ return arg == "--session-id" || arg == "--resume" || arg == "-r"
6060 case processStrategyOpenCode:
6161 return arg == "-s" || arg == "--session"
6262 case processStrategyCodex:
@@ -81,7 +81,7 @@ func planProcessRestore(proc *snapcodec.Process, allow map[string]struct{}) proc
8181 switch strategy {
8282 case processStrategyPi:
8383 if id != "" {
84- return processRestoreDecision{Command: shellQuoteArgvMust([]string{"pi", "--session-id", id}), Restore: true}
84+ return processRestoreDecision{Command: shellQuoteArgvMust([]string{"pi", "--resume", id}), Restore: true}
8585 }
8686 return processRestoreDecision{Command: "pi --continue", Restore: true}
8787 case processStrategyClaude:
@@ -56,7 +56,7 @@ func extractAgentSessionID(strategy string, argv []string) string {
56 func agentSessionFlag(strategy, arg string) bool {56 func agentSessionFlag(strategy, arg string) bool {
57 switch strategy {57 switch strategy {
58 case processStrategyClaude:58 case processStrategyClaude:
59- return arg == "--session-id" || arg == "--resume"59+ return arg == "--session-id" || arg == "--resume" || arg == "-r"
60 case processStrategyOpenCode:60 case processStrategyOpenCode:
61 return arg == "-s" || arg == "--session"61 return arg == "-s" || arg == "--session"
62 case processStrategyCodex:62 case processStrategyCodex:
@@ -81,7 +81,7 @@ func planProcessRestore(proc *snapcodec.Process, allow map[string]struct{}) proc
81 switch strategy {81 switch strategy {
82 case processStrategyPi:82 case processStrategyPi:
83 if id != "" {83 if id != "" {
84- return processRestoreDecision{Command: shellQuoteArgvMust([]string{"pi", "--session-id", id}), Restore: true}84+ return processRestoreDecision{Command: shellQuoteArgvMust([]string{"pi", "--resume", id}), Restore: true}
85 }85 }
86 return processRestoreDecision{Command: "pi --continue", Restore: true}86 return processRestoreDecision{Command: "pi --continue", Restore: true}
87 case processStrategyClaude:87 case processStrategyClaude:
M internal/usecase/daemon/process_restore_test.go +2 -1
@@ -37,7 +37,7 @@ func TestProcessRestorePlan(t *testing.T) {
3737 name: "pi with ID resumes",
3838 proc: &snapcodec.Process{Argv: []string{"pi", "cli"}, Strategy: processStrategyPi, Opts: snapcodec.ProcessOpts{AgentSessionID: "session-123"}},
3939 restore: true,
40- command: "pi --session-id session-123",
40+ command: "pi --resume session-123",
4141 },
4242 {
4343 name: "pi no ID continues",
@@ -110,6 +110,7 @@ func TestExtractAgentSessionID(t *testing.T) {
110110 want string
111111 }{
112112 {name: "claude session flag extraction", strategy: processStrategyClaude, argv: []string{"claude", "--session-id", "uuid-123"}, want: "uuid-123"},
113+ {name: "claude short resume extraction", strategy: processStrategyClaude, argv: []string{"claude", "-r", "uuid-456"}, want: "uuid-456"},
113114 {name: "opencode short session flag extraction", strategy: processStrategyOpenCode, argv: []string{"opencode", "-s", "abc"}, want: "abc"},
114115 {name: "codex resume extraction", strategy: processStrategyCodex, argv: []string{"codex", "resume", "abc"}, want: "abc"},
115116 {name: "claude flag-looking ID rejected", strategy: processStrategyClaude, argv: []string{"claude", "--resume", "--continue"}},
@@ -37,7 +37,7 @@ func TestProcessRestorePlan(t *testing.T) {
37 name: "pi with ID resumes",37 name: "pi with ID resumes",
38 proc: &snapcodec.Process{Argv: []string{"pi", "cli"}, Strategy: processStrategyPi, Opts: snapcodec.ProcessOpts{AgentSessionID: "session-123"}},38 proc: &snapcodec.Process{Argv: []string{"pi", "cli"}, Strategy: processStrategyPi, Opts: snapcodec.ProcessOpts{AgentSessionID: "session-123"}},
39 restore: true,39 restore: true,
40- command: "pi --session-id session-123",40+ command: "pi --resume session-123",
41 },41 },
42 {42 {
43 name: "pi no ID continues",43 name: "pi no ID continues",
@@ -110,6 +110,7 @@ func TestExtractAgentSessionID(t *testing.T) {
110 want string110 want string
111 }{111 }{
112 {name: "claude session flag extraction", strategy: processStrategyClaude, argv: []string{"claude", "--session-id", "uuid-123"}, want: "uuid-123"},112 {name: "claude session flag extraction", strategy: processStrategyClaude, argv: []string{"claude", "--session-id", "uuid-123"}, want: "uuid-123"},
113+ {name: "claude short resume extraction", strategy: processStrategyClaude, argv: []string{"claude", "-r", "uuid-456"}, want: "uuid-456"},
113 {name: "opencode short session flag extraction", strategy: processStrategyOpenCode, argv: []string{"opencode", "-s", "abc"}, want: "abc"},114 {name: "opencode short session flag extraction", strategy: processStrategyOpenCode, argv: []string{"opencode", "-s", "abc"}, want: "abc"},
114 {name: "codex resume extraction", strategy: processStrategyCodex, argv: []string{"codex", "resume", "abc"}, want: "abc"},115 {name: "codex resume extraction", strategy: processStrategyCodex, argv: []string{"codex", "resume", "abc"}, want: "abc"},
115 {name: "claude flag-looking ID rejected", strategy: processStrategyClaude, argv: []string{"claude", "--resume", "--continue"}},116 {name: "claude flag-looking ID rejected", strategy: processStrategyClaude, argv: []string{"claude", "--resume", "--continue"}},
M internal/usecase/daemon/snapshot_restore_test.go +1 -1
@@ -148,7 +148,7 @@ func TestRestoreSnapshotsWritesAgentIDCommandAndWriteFailureIsNonFatal(t *testin
148148 d.restoreSnapshots(context.Background())
149149
150150 require.Len(t, factory.opens, 1)
151- require.Equal(t, []string{"pi --session-id abc123\n"}, factory.opens[0].pty.writes)
151+ require.Equal(t, []string{"pi --resume abc123\n"}, factory.opens[0].pty.writes)
152152 factory.writeErr = errors.New("boom")
153153 require.NoError(t, d.restoreSession(context.Background(), snapcodec.Session{Name: "agent2", Tabs: []snapcodec.Tab{{Cols: 80, Rows: 24, Tree: layout.NewTree("pane-1"), Panes: []snapcodec.Pane{{ID: "pane-1", Cwd: "/tmp", Process: proc}}}}}))
154154 }
@@ -148,7 +148,7 @@ func TestRestoreSnapshotsWritesAgentIDCommandAndWriteFailureIsNonFatal(t *testin
148 d.restoreSnapshots(context.Background())148 d.restoreSnapshots(context.Background())
149 149
150 require.Len(t, factory.opens, 1)150 require.Len(t, factory.opens, 1)
151- require.Equal(t, []string{"pi --session-id abc123\n"}, factory.opens[0].pty.writes)151+ require.Equal(t, []string{"pi --resume abc123\n"}, factory.opens[0].pty.writes)
152 factory.writeErr = errors.New("boom")152 factory.writeErr = errors.New("boom")
153 require.NoError(t, d.restoreSession(context.Background(), snapcodec.Session{Name: "agent2", Tabs: []snapcodec.Tab{{Cols: 80, Rows: 24, Tree: layout.NewTree("pane-1"), Panes: []snapcodec.Pane{{ID: "pane-1", Cwd: "/tmp", Process: proc}}}}}))153 require.NoError(t, d.restoreSession(context.Background(), snapcodec.Session{Name: "agent2", Tabs: []snapcodec.Tab{{Cols: 80, Rows: 24, Tree: layout.NewTree("pane-1"), Panes: []snapcodec.Pane{{ID: "pane-1", Cwd: "/tmp", Process: proc}}}}}))
154 }154 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close