mirror of
https://github.com/block/buzz.git
synced 2026-11-30 21:21:48 +00:00
test(desktop): pin the plain next-turn gap and stop the 5-minute suite hang
Two review corrections to the previous commit, neither changing production
behaviour.
**The gap test was pinning the wrong sequence.** Its middle frames put a
`session/new` card between `turn_started` and `session_resolved`. That card
renders as a trailing `single` block, which moves `streamingItemId` off the
previous turn's work block on its own — so those frames pass against the old
block-walking code and prove nothing. Measured over the revert mutation:
SEQ A f1 turn_started only liveTurnId=turn-1 tail=tool:2 BUG
SEQ A f2 +session_resolved, no session/new liveTurnId=turn-1 tail=tool:2 BUG
SEQ B f1 +session/new liveTurnId=turn-1 tail=null masked
SEQ B f2 +session/new +session_resolved liveTurnId=turn-1 tail=null masked
The plain sequence — no session restart, which is the overwhelmingly common
path — now leads the frame list, and the restart sequence is kept as a
separately labelled path that also has to settle. Reverting either half of the
fix now fails on frame 1 of the plain sequence rather than on a frame that a
restart card was carrying.
**A five-minute gc timer was being waited out on every run.** The orphaned
suite's own `QueryClient` took React Query's default 300000ms `gcTime`. The one
test that reaches the message-bubble presenter's `useQuery` leaves a query
uncollected, so a 300s timer is armed at teardown and node:test waits it out
before exiting: the file's tests sum to ~2s, the wall was ~303s, and every test
passed, so nothing pointed at the cause. `gcTime: 0` takes the standalone file
from 303s to 7s, and the full desktop suite from 307s to 102s.
The shared rig (`AgentSessionWorkBlockTestRig`) creates a byte-identical client
and gets the same line. It is dormant today — only the relay-bubble test drives
a `useQuery`, and that test builds its own client — but the failure mode if it
ever arms is a silent five-minute hang with no failing assertion, which is
expensive to diagnose and free to prevent.
Verified with a negative control rather than on the passing tree alone: with the
orphaned file restored to its previous blob (17ce5d633) the same command in the
same shell takes 303s, so the number is attributable to the one line.
Contrary to the review note that prompted this, the
'Promise resolution is still pending' marker is NOT present on the previous
commit's tree — grep counts 0 both with and without the fix — so it is not
claimed as fixed here.
Full desktop suite 5491 passing / 0 failing, 81 suites; `tsc --noEmit` clean.
Co-authored-by: Bradley Axen <baxen@squareup.com>
Signed-off-by: Bradley Axen <baxen@squareup.com>
This commit is contained in:
@@ -359,8 +359,13 @@ test("the same relay post outside a work block keeps its message bubble", async
|
||||
"./activityRenderClasses/TranscriptActivityItem.tsx"
|
||||
);
|
||||
|
||||
// `gcTime: 0`: React Query's default is 300000ms, and this is the one test
|
||||
// that actually drives the bubble presenter's `useQuery`, so its query arms a
|
||||
// five-minute gc timer at teardown. node:test waits that timer out before
|
||||
// exiting — this file's tests sum to ~2s but the wall was ~303s, all passing,
|
||||
// with no failing assertion to point at the cause.
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
defaultOptions: { queries: { gcTime: 0, retry: false } },
|
||||
});
|
||||
const rootRoute = createRootRoute({
|
||||
component: () =>
|
||||
|
||||
@@ -253,8 +253,15 @@ export async function renderBlock(
|
||||
// unconditionally so that if a rail step ever DID reach that presenter, the
|
||||
// relay test below would fail on its bubble assertion rather than on a
|
||||
// missing provider — a test must fail for the reason it claims.
|
||||
// `gcTime: 0` because React Query's default is 300000ms, and an un-collected
|
||||
// query arms a timer that long at teardown — node:test then waits it out
|
||||
// before exiting, turning a 2s suite into a 5-minute wall with no failing
|
||||
// assertion. Dormant here today (only the relay-bubble test reaches a
|
||||
// `useQuery`, and it builds its own client), but a silent five-minute hang is
|
||||
// an expensive thing to leave armed for the next rig-based test that renders
|
||||
// a bubble.
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
defaultOptions: { queries: { gcTime: 0, retry: false } },
|
||||
});
|
||||
const rootRoute = createRootRoute({
|
||||
component: () =>
|
||||
|
||||
@@ -414,6 +414,14 @@ test("buildConversationTurnMeta reports no live turn when there is no turn at al
|
||||
* Built from a raw item stream through the real grouping rather than from
|
||||
* hand-written blocks, because the whole bug is which turns DO and DO NOT
|
||||
* produce a block: hand-built blocks would assume the answer away.
|
||||
*
|
||||
* The frames pin the PLAIN next turn (`turn_started`, then `session_resolved`,
|
||||
* with no `session/new` card) because that is the common path and the only one
|
||||
* that pins the bug. On a session restart the `session/new` card lands as a
|
||||
* trailing `single` block, which moves `streamingItemId` off turn-1's work block
|
||||
* on its own — so a restart-only fixture would pass against the old
|
||||
* block-walking code. Both sequences are covered; only the plain one is
|
||||
* load-bearing.
|
||||
*/
|
||||
test("buildConversationTurnMeta hands liveness to a next turn that has no block yet", () => {
|
||||
const stream = (...extra) => [
|
||||
@@ -426,25 +434,38 @@ test("buildConversationTurnMeta hands liveness to a next turn that has no block
|
||||
...extra,
|
||||
];
|
||||
|
||||
const started = lifecycleItem("life:start:2", "turn_started", "turn-2");
|
||||
const resolved = lifecycleItem(
|
||||
"life:resolved:2",
|
||||
"session_resolved",
|
||||
"turn-2",
|
||||
);
|
||||
const sysPrompt = systemPromptItem("meta:sysprompt");
|
||||
|
||||
const frames = [
|
||||
// The plain next turn — no session restart, so no `session/new` card. This
|
||||
// is both the common path and the only one that pins the bug: a
|
||||
// `session/new` card renders as a trailing `single` block, which moves the
|
||||
// streaming item off turn-1's work block by itself and so lets the old
|
||||
// block-walking code pass for the wrong reason.
|
||||
{
|
||||
label: "turn-2 has only started",
|
||||
items: stream(lifecycleItem("life:start:2", "turn_started", "turn-2")),
|
||||
items: stream(started),
|
||||
},
|
||||
{
|
||||
label: "the new session's system prompt has landed",
|
||||
items: stream(
|
||||
lifecycleItem("life:start:2", "turn_started", "turn-2"),
|
||||
systemPromptItem("meta:sysprompt"),
|
||||
),
|
||||
label: "the session has resolved with no restart card",
|
||||
items: stream(started, resolved),
|
||||
},
|
||||
// The restarting next turn, where a system-prompt card lands between the
|
||||
// lifecycle rows. A different route through the grouping, kept because it
|
||||
// has to settle too.
|
||||
{
|
||||
label: "the restarting turn's system prompt has landed",
|
||||
items: stream(started, sysPrompt),
|
||||
},
|
||||
{
|
||||
label: "the session has resolved",
|
||||
items: stream(
|
||||
lifecycleItem("life:start:2", "turn_started", "turn-2"),
|
||||
systemPromptItem("meta:sysprompt"),
|
||||
lifecycleItem("life:resolved:2", "session_resolved", "turn-2"),
|
||||
),
|
||||
label: "the restarted session has resolved",
|
||||
items: stream(started, sysPrompt, resolved),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -465,13 +486,12 @@ test("buildConversationTurnMeta hands liveness to a next turn that has no block
|
||||
);
|
||||
}
|
||||
|
||||
// Fourth frame: turn-2 finally has something renderable, so it gets a block
|
||||
// Final frame: turn-2 finally has something renderable, so it gets a block
|
||||
// and its own prompt becomes the tail. Included so the sequence ends in the
|
||||
// steady state rather than stopping at the gap.
|
||||
const renderable = stream(
|
||||
lifecycleItem("life:start:2", "turn_started", "turn-2"),
|
||||
systemPromptItem("meta:sysprompt"),
|
||||
lifecycleItem("life:resolved:2", "session_resolved", "turn-2"),
|
||||
started,
|
||||
resolved,
|
||||
promptItem("prompt:2", "turn-2"),
|
||||
);
|
||||
const meta = buildConversationTurnMeta(
|
||||
|
||||
Reference in New Issue
Block a user