Skip to content

Commit a45f4d8

Browse files
tulsi-builderBasilBotclaude
committed
refactor(agents): name each transcript opening explicitly
A transcript request now carries its numbered opening beside its acknowledgement, and the Activity tab compares that number rather than the callback's identity. An inline callback made anew each render is one opening, so it can no longer reopen the transcript after Back. Co-authored-by: BasilBot <399581b6165ab01343e3a1324774b1024d76942aea563468f93c975e5ee5193c@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: tulsi <[email protected]>
1 parent 15317ca commit a45f4d8

15 files changed

Lines changed: 70 additions & 46 deletions

File tree

‎src/bundled/agents/AgentDetails.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type {
2121
Agents,
2222
AgentConversation,
2323
RegisteredAgentType,
24+
TranscriptRequest,
2425
} from "../../features/agents/service";
2526
import {
2627
AgentArchiveRetry,
@@ -92,7 +93,7 @@ export function AgentDetails({
9293
messageAction: (variant: "glass" | "subtle") => ReactNode;
9394
conversation?: AgentConversation | undefined;
9495
initialActivity?: boolean;
95-
initialTranscript?: (() => void) | undefined;
96+
initialTranscript?: TranscriptRequest | undefined;
9697
/** Closes the panel showing the agent. */
9798
close?: () => void;
9899
communities?: CommunityReader | undefined;

‎src/bundled/agents/AgentTabs.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
AgentSettingsHost,
77
Agents,
88
RegisteredAgentType,
9+
TranscriptRequest,
910
} from "../../features/agents/service";
1011
import type { AgentMemories } from "../../features/agents/MemoryPanel";
1112
import type { CommunityReader } from "../../features/communities/service";
@@ -27,7 +28,7 @@ export function AgentTabs(props: {
2728
settingsContent: ReactNode;
2829
conversation?: AgentConversation | undefined;
2930
initialActivity?: boolean | undefined;
30-
initialTranscript?: (() => void) | undefined;
31+
initialTranscript?: TranscriptRequest | undefined;
3132
close?: (() => void) | undefined;
3233
onDiscard?: () => void;
3334
}) {

‎src/bundled/claude-code/tabs.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ it("opens the conversation's transcript when opened from its activity, once", as
376376
agent={agent()}
377377
save={vi.fn()}
378378
conversation={conversation}
379-
initialTranscript={() => undefined}
379+
initialTranscript={{ opening: 1, done: () => undefined }}
380380
/>,
381381
);
382382
const user = userEvent.setup();

‎src/bundled/claude-code/tabs.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ export function createTabs({
738738
const { open, show, back } = useOpenTranscript(
739739
conversation,
740740
label,
741-
initialTranscript && { initial: here, done: initialTranscript },
741+
initialTranscript && { initial: here, ...initialTranscript },
742742
close,
743743
);
744744
return (

‎src/bundled/codex/tabs.test.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ describe("opened from activity", () => {
399399
});
400400
const close = vi.fn();
401401
const done = vi.fn();
402-
const panel = (initialTranscript?: () => void) => (
402+
// Each call is a new opening, as each Working now click is.
403+
let openings = 0;
404+
const panel = (done?: () => void) => (
403405
<PanelWorkspace
404406
value="profile"
405407
select={() => undefined}
@@ -417,7 +419,9 @@ describe("opened from activity", () => {
417419
<f.tabs.ActivityTab
418420
{...f.props()}
419421
conversation={{ channelId: "channel", rootId: root }}
420-
{...(initialTranscript && { initialTranscript })}
422+
{...(done && {
423+
initialTranscript: { opening: ++openings, done },
424+
})}
421425
close={close}
422426
/>
423427
),

‎src/bundled/codex/tabs.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ export function createTabs(
839839
const { open, show, back } = useOpenTranscript(
840840
conversation,
841841
label,
842-
initialTranscript && { initial: here, done: initialTranscript },
842+
initialTranscript && { initial: here, ...initialTranscript },
843843
close,
844844
);
845845
const saved = new Set(conversations.map((row) => row.key));

‎src/bundled/goose/tabs.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ export function createTabs({
869869
const { open, show, back } = useOpenTranscript(
870870
conversation,
871871
label,
872-
initialTranscript && { initial: here, done: initialTranscript },
872+
initialTranscript && { initial: here, ...initialTranscript },
873873
close,
874874
);
875875
const rows = (recent.value ?? [])

‎src/bundled/pi/tabs.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ it("settles a transcript request without opening it once Pi's late listing arriv
528528
<ActivityTab
529529
agent={AGENT}
530530
conversation={{ channelId: "chan", rootId: "root" }}
531-
initialTranscript={done}
531+
initialTranscript={{ opening: 1, done }}
532532
/>,
533533
);
534534
expect(done).toHaveBeenCalled();

‎src/bundled/pi/tabs.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,9 @@ export function createTabs({
709709
// Pi lists its conversations only after the tab shows, so its transcript
710710
// would open late, under whatever the reader turned to meanwhile. The
711711
// request is settled without opening it.
712-
useEffect(() => initialTranscript?.(), [initialTranscript]);
712+
const opening = initialTranscript?.opening;
713+
// biome-ignore lint/correctness/useExhaustiveDependencies: once per opening.
714+
useEffect(() => initialTranscript?.done(), [opening]);
713715
if (!places)
714716
return listing.status === "error" ? (
715717
<div className="grid gap-2">

‎src/bundled/profiles/ProfilePanel.test.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import type {
1919
Agent,
2020
Agents,
2121
RegisteredAgentType,
22+
TranscriptRequest,
2223
} from "../../features/agents/service";
2324

2425
import { agentDirectory } from "../../features/identity-names/testing";
@@ -378,11 +379,15 @@ function renderAgentActivity(
378379
initialTranscript,
379380
}: {
380381
conversation?: { channelId: string; rootId?: string };
381-
initialTranscript?: () => void;
382+
initialTranscript?: TranscriptRequest;
382383
}) {
383384
// Like a type's Activity tab: it acts on the request as it shows.
384385
const [first] = useState(!!initialTranscript);
385-
useEffect(() => initialTranscript?.(), [initialTranscript]);
386+
// biome-ignore lint/correctness/useExhaustiveDependencies: once per opening.
387+
useEffect(
388+
() => initialTranscript?.done(),
389+
[initialTranscript?.opening],
390+
);
386391
return (
387392
<>
388393
<p>Echo {title.toLowerCase()}</p>

0 commit comments

Comments
 (0)