Skip to content

Commit 5582959

Browse files
committed
test(embedded-runner): keep timeout invariants durable
1 parent 2fff8a7 commit 5582959

2 files changed

Lines changed: 8 additions & 18 deletions

File tree

‎src/agents/embedded-agent-runner/run/attempt-stream-finalize.test.ts‎

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,7 @@ describe("runEmbeddedAttemptSettledPhase stream finalization", () => {
632632
});
633633

634634
it("drains queued events after a run-budget abort before re-flushing partial assistant text", async () => {
635-
// Regression for #119935 (ClawSweeper P1): abortRun(true) aborts the run
636-
// signal synchronously before settlement, so the abort-aware join returns
635+
// abortRun(true) aborts the run signal synchronously before settlement, so the abort-aware join returns
637636
// without draining. The run-budget terminal must still drain the serialized
638637
// event chain (bounded) so a message_update queued behind the abort commits
639638
// before the re-flush.
@@ -664,8 +663,7 @@ describe("runEmbeddedAttemptSettledPhase stream finalization", () => {
664663
});
665664

666665
it("discards buffered partial text when an external abort supersedes the run-budget timeout during the drain", async () => {
667-
// P1 regression (ClawSweeper 08-12): partial output must be committed only
668-
// after terminal ownership is final. The drain is awaited, then the
666+
// Partial output must be committed only after terminal ownership is final. The drain is awaited, then the
669667
// terminal is re-read: if an external abort wins while the queued chain
670668
// drains, the run-budget timeout no longer owns the terminal and the
671669
// buffered text must NOT be published.
@@ -697,8 +695,7 @@ describe("runEmbeddedAttemptSettledPhase stream finalization", () => {
697695
});
698696

699697
it("discards buffered partial text when a provider failure is attached before the terminal-owned flush", async () => {
700-
// P1 regression (ClawSweeper 08-12, second round): a provider error queued
701-
// behind the run-budget abort is merged into the terminal before the
698+
// A provider error queued behind the run-budget abort is merged into the terminal before the
702699
// post-drain flush decision. The failure-terminal invariant must suppress
703700
// the salvage — a timed-out run that also failed must not publish partial
704701
// output.
@@ -735,10 +732,7 @@ describe("runEmbeddedAttemptSettledPhase stream finalization", () => {
735732
});
736733

737734
it("skips the bounded drain when a provider failure is already attached before settlement", async () => {
738-
// P1 regression (ClawSweeper 08-14 round): the prior regression covered a
739-
// failure attached DURING the drain. This covers the coverage gap — a
740-
// failure ALREADY attached to the run-budget terminal when settlement
741-
// chooses whether to drain. The bounded drain can only stall settlement
735+
// A failure already attached to the run-budget terminal must prevent the drain. The bounded drain can only stall settlement
742736
// for the full 120s liveness deadline when a serialized handler is wedged,
743737
// and partial output would be discarded by the flush gate anyway. A failed
744738
// run-budget terminal must skip the drain entirely so a wedged event chain
@@ -762,8 +756,7 @@ describe("runEmbeddedAttemptSettledPhase stream finalization", () => {
762756
fixture.order.push("flush-partial");
763757
}),
764758
});
765-
// Failure is attached BEFORE settlement chooses whether to drain — this is
766-
// the gap the prior regression did not cover.
759+
// Failure is attached before settlement chooses whether to drain.
767760
fixture.state.terminal = {
768761
kind: "timeout",
769762
phase: "prompt",
@@ -817,8 +810,7 @@ describe("runEmbeddedAttemptSettledPhase stream finalization", () => {
817810
});
818811

819812
it("re-drains queued events when the run-budget timeout fires during the abort-aware join", async () => {
820-
// P1 regression (ClawSweeper 08-12, third round): settlement starts with a
821-
// non-budget terminal and waits on the abort-aware join. If the run-budget
813+
// Settlement starts with a non-budget terminal and waits on the abort-aware join. If the run-budget
822814
// timer fires while that join is pending, the abort resolves the join
823815
// immediately WITHOUT draining; the salvage must then run the bounded
824816
// drain before flushing so a queued suffix is not lost.
@@ -871,8 +863,7 @@ describe("runEmbeddedAttemptSettledPhase stream finalization", () => {
871863
});
872864

873865
it("does not re-flush partial assistant text on non-run-budget terminals", async () => {
874-
// P2 gate: cancellation and provider-failure aborts must not publish
875-
// partial output through the settlement path.
866+
// Cancellation and provider-failure aborts must not publish partial output through settlement.
876867
const abortController = new AbortController();
877868
abortController.abort(new Error("operator cancel"));
878869
const fixture = createFixture({ runAbortController: abortController });

‎src/agents/embedded-agent-subscribe.partial-reply-lifecycle.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ describe("subscribeEmbeddedAgentSession partial reply lifecycle", () => {
9898
});
9999

100100
it("queue-only drain is not blocked by a stalled partial reply callback", async () => {
101-
// Regression (ClawSweeper 08-12, fourth round): timeout salvage drains only
102-
// the serialized event chain — the queue whose handlers mutate the assistant
101+
// Timeout salvage drains only the serialized event chain — the queue whose handlers mutate the assistant
103102
// text buffer. A stalled onPartialReply transport callback is external
104103
// fan-out and cannot change the buffered text, so it must not hold an
105104
// already-aborted run in settlement. Pre-fix, the salvage path used

0 commit comments

Comments
 (0)