Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ takes `--dry-run`.

## Unreleased

- Closing the window no longer loads every chat's log. Since v0.3.5 the daemon read each chat's transcript from disk when a window went, only to drop the window from that chat's subscribers, so 200 restored chats meant 200 logs read and held open until shutdown. A chat that shuts down no longer reopens its log either.
- The chat's / menu opens for a /word anywhere in the draft, not only at its start. Mid-draft it lists skills and custom commands for Claude chats; a pick replaces only that word.
- A message's pictures show above its text, as thumbnails lined up with the text's left edge, in Ledger and Column alike. In a Claude Code pane, a pasted picture no longer turns into a grey `image-1.png` chip for good once the transcript grows: after the pane chat re-read its transcript's tail, the daemon had forgotten where older messages were and answered "gone" when the window asked for the picture. While a picture loads, its thumbnail shows an empty frame with its number. The chip now shows only when the picture really is gone, and its tooltip says why.

Expand Down
13 changes: 12 additions & 1 deletion internal/daemon/chatresume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@ func TestChatBootLoadsNothing(t *testing.T) {
os.WriteFile(filepath.Join(dir, "config.json"), b, 0o600)
}
spy := &spyProvider{}
sock, stop := runWith(t, f, func(o *Options) {
d, sock, stopNow := runDaemon(t, f, func(o *Options) {
o.Chats = root
o.Providers = map[model.Provider]session.Provider{model.ProviderClaude: spy}
})
stop := sync.OnceFunc(stopNow)
defer stop()
gui := dialHello(t, sock, proto.Hello{Version: proto.Version, Level: proto.Level, Kind: "gui", Cwd: t.TempDir()})
st := waitChat(gui, "chats back", func(s model.State) bool { return len(s.Chats) == n })
Expand Down Expand Up @@ -275,6 +276,16 @@ func TestChatBootLoadsNothing(t *testing.T) {
_, err := eventlog.ReadConfig(filepath.Join(root, "archive", "chat-7"))
return err == nil
})
// A window going, and an unsubscribe, load no chat either.
d.dropSubs(&client{})
d.chatUnsubscribe("chat-9", guiSink{&client{}})
if got := opened(); len(got) != 0 {
t.Fatalf("dropping subscribers opened the logs of %v", got)
}
stop()
if got := opened(); len(got) != 0 {
t.Fatalf("shutdown opened the logs of %v", got)
}
}

func TestRecap(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions internal/daemon/chats.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ func (c *chat) close() {
c.log.Close()
c.log = nil
}
c.loaded = true // why: a do queued behind this cleanup must not reopen the log
for s := range c.subs {
s.Removed(c.id)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/daemon/panestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func (d *Daemon) chatSubscribe(ctx context.Context, c *client, m proto.ChatSubsc
// pane chat's.
func (d *Daemon) chatUnsubscribe(id string, sink web.Sink) {
if ch, err := d.chat(id); err == nil {
ch.do(func() { delete(ch.subs, sink) })
ch.run(func() { delete(ch.subs, sink) }) // run, not do: an unsubscribe loads no log
return
}
d.paneUnsubscribe(id, sink)
Expand Down Expand Up @@ -467,6 +467,6 @@ func (d *Daemon) dropSubs(c *client) {
d.paneUnsubscribe(id, sink)
}
for _, ch := range chats {
ch.do(func() { delete(ch.subs, sink) })
ch.run(func() { delete(ch.subs, sink) }) // run, not do: an unsubscribe loads no log
}
}
Loading