Merge: worktree-agent-af03a51b8bf6c96ab

This commit is contained in:
2026-11-02 16:47:32 +00:00
4 changed files with 345 additions and 10 deletions
+3 -1
View File
@@ -318,7 +318,9 @@ func (m *chatManager) CreateBackend(ctx context.Context, title, directory, backe
m.mu.Lock()
m.cache[session.ID] = backend
m.mu.Unlock()
return session, nil
// The created row names its mode like a listed one, so the opened chat
// shows the mode control at once rather than after the list re-reads.
return m.withMode(ctx, session), nil
}
func (m *chatManager) Create(ctx context.Context, title, directory string) (protocol.ChatSession, error) {
+14
View File
@@ -100,3 +100,17 @@ func TestChatModeIsStoredAppliedAndSurvivesRestart(t *testing.T) {
t.Fatalf("stored mode not re-applied before turns: %v", fake.applied)
}
}
// A created chat names its mode like a listed row, so the client shows the
// mode control without re-reading the list.
func TestCreatedChatNamesItsMode(t *testing.T) {
fake := &modedChat{fakeChat: scriptedChat()}
manager := &chatManager{claude: fake, cache: map[string]string{}}
session, err := manager.CreateBackend(context.Background(), "chat", "/fixture", "claude")
if err != nil {
t.Fatal(err)
}
if session.Mode != "default" || session.ModeName != "Ask" {
t.Fatalf("created session names %q/%q, want the harness default", session.Mode, session.ModeName)
}
}