detached a4b2aa9

fix(daemon): surface palette command failures as notices

The palette dispatch error branch only logged failed commands, so a
failed new-tab/split/etc. spawn was silent to the user. Route every
non-nil paletteExec error through d.reportError so it lands in notice
history and shows a toast; unclassified errors fall back to the
NoticeInternal catch-all until Task 8 wraps specific spawn failures.
commit
a4b2aa9c8f5c38662e54cb469bf5c763a2314ecb
author
brice · · 2026-07-20 17:38 UTC
parent
e6ae2e5
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +24 -0
M internal/usecase/daemon/palette.go +1 -0
@@ -305,6 +305,7 @@ func (d *Daemon) handlePaletteInput(ac *attachedClient, data []byte) {
305305 }
306306 if err := cmd.Run(paletteExec{d: d, sess: sess, ac: ac}, args); err != nil {
307307 d.log.Error("palette command failed", "err", err, "command", cmd.Code)
308+ d.reportError(sess, err)
308309 } else {
309310 d.recordPaletteUse(cmd.Code)
310311 }
@@ -305,6 +305,7 @@ func (d *Daemon) handlePaletteInput(ac *attachedClient, data []byte) {
305 }305 }
306 if err := cmd.Run(paletteExec{d: d, sess: sess, ac: ac}, args); err != nil {306 if err := cmd.Run(paletteExec{d: d, sess: sess, ac: ac}, args); err != nil {
307 d.log.Error("palette command failed", "err", err, "command", cmd.Code)307 d.log.Error("palette command failed", "err", err, "command", cmd.Code)
308+ d.reportError(sess, err)
308 } else {309 } else {
309 d.recordPaletteUse(cmd.Code)310 d.recordPaletteUse(cmd.Code)
310 }311 }
M internal/usecase/daemon/palette_test.go +23 -0
@@ -119,6 +119,29 @@ func TestPaletteOpenTypeEnterRunAndEscClose(t *testing.T) {
119119 awaitFrame(t, sends, ports.MsgOutput)
120120 }
121121
122+// TestPaletteCommandFailureSurfacesAsNotice drives a palette command whose Run
123+// target fails and asserts the failure reaches the user as a notice instead of
124+// only a log line. Task 8 will wrap the new-tab spawn failure as a
125+// domain.UserError with NoticeTabSpawn; until then it flows through
126+// unclassified and lands on the NoticeInternal catch-all.
127+func TestPaletteCommandFailureSurfacesAsNotice(t *testing.T) {
128+ p, release := newBlockingPTY(t)
129+ defer release()
130+ d, sess, ac, sends := newManualSessionWithPTYs(t, p)
131+ ptys := portsmocks.NewMockPTYFactory(t)
132+ ptys.EXPECT().Open(mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("open failed")).Once()
133+ d.ptys = ptys
134+
135+ d.handleInput(sess, ac, []byte("\x1b "))
136+ awaitFrame(t, sends, ports.MsgOutput)
137+ d.handleInput(sess, ac, []byte("CNT\r"))
138+ awaitFrame(t, sends, ports.MsgOutput)
139+
140+ history := d.notices.history()
141+ require.NotEmpty(t, history, "failed palette command must record a notice")
142+ require.Equal(t, domain.NoticeInternal, history[0].Code)
143+}
144+
122145 func TestPaletteEntryPublishesEligibleNamedSessionResults(t *testing.T) {
123146 p, release := newBlockingPTY(t)
124147 defer release()
@@ -119,6 +119,29 @@ func TestPaletteOpenTypeEnterRunAndEscClose(t *testing.T) {
119 awaitFrame(t, sends, ports.MsgOutput)119 awaitFrame(t, sends, ports.MsgOutput)
120 }120 }
121 121
122+// TestPaletteCommandFailureSurfacesAsNotice drives a palette command whose Run
123+// target fails and asserts the failure reaches the user as a notice instead of
124+// only a log line. Task 8 will wrap the new-tab spawn failure as a
125+// domain.UserError with NoticeTabSpawn; until then it flows through
126+// unclassified and lands on the NoticeInternal catch-all.
127+func TestPaletteCommandFailureSurfacesAsNotice(t *testing.T) {
128+ p, release := newBlockingPTY(t)
129+ defer release()
130+ d, sess, ac, sends := newManualSessionWithPTYs(t, p)
131+ ptys := portsmocks.NewMockPTYFactory(t)
132+ ptys.EXPECT().Open(mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("open failed")).Once()
133+ d.ptys = ptys
134+
135+ d.handleInput(sess, ac, []byte("\x1b "))
136+ awaitFrame(t, sends, ports.MsgOutput)
137+ d.handleInput(sess, ac, []byte("CNT\r"))
138+ awaitFrame(t, sends, ports.MsgOutput)
139+
140+ history := d.notices.history()
141+ require.NotEmpty(t, history, "failed palette command must record a notice")
142+ require.Equal(t, domain.NoticeInternal, history[0].Code)
143+}
144+
122 func TestPaletteEntryPublishesEligibleNamedSessionResults(t *testing.T) {145 func TestPaletteEntryPublishesEligibleNamedSessionResults(t *testing.T) {
123 p, release := newBlockingPTY(t)146 p, release := newBlockingPTY(t)
124 defer release()147 defer release()

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