Skip to content

test(session): cover multi-turn 503 bursts, partial recovery and SIGINT flush for transcript appends - #22

Merged
zeekay merged 1 commit into
hanzoai:mainfrom
Thalassa09:test/session-transcript-retry-bursts
Nov 29, 2026
Merged

zeekay merged 1 commit into
hanzoai:mainfrom
Thalassa09:test/session-transcript-retry-bursts

Conversation

@Thalassa09

Copy link
Copy Markdown
Contributor

What this adds

Test-only coverage for the requestId transcript retry path (SessionClient::event). No production code changed; no dependencies added.

  • src/testmock.rs — Config.refuse_schedule: Vec<bool> (+ MockCloud::start_refusing(&[bool])) lets a 503 burst land on the turns a test means it for. start_refusing_first(n) is now expressed as n trues, so its behaviour is unchanged; past the end of the schedule requests are served normally.
  • src/session.rs — three unit tests next to the existing retry tests, same doc-comment + MUTATION: style.
  • tests/signals.rs — the stand-in cloud now records every /events body and can 503 the event POSTs after the first (served opening status), then refuses the run's transcript turn; a new test sends SIGINT inside that retry window.
Test Pins down
a_burst_over_two_turns_names_each_turn_once a burst spanning two turns: A refused twice then lands under ONE id, B lands first try under a new id; wire order a,a,a,b; A is stored once
interleaved_refusals_land_each_turn_once refusals interleaved between turns: every turn tried until it lands, each turn's repeats share its own id, no id crosses turns
a_cloud_that_comes_back_names_turns_again_without_two_names_for_one partial recovery: A lands, two turns are lost (unnamed one-try policy), the next turn lands unnamed, the one after is named again; no payload ever goes out under two different ids
a_signal_inside_a_retry_window_keeps_a_turn_named_once (integration) SIGINT while a transcript turn is mid-retry: gen exits non-zero, the stand-in pi heard INT (not end), and every recorded /events body sharing a payload carries the SAME requestId

The one-try policy after a loss is asserted as the code documents it: the turn that lands after the loss is unnamed, and the turn AFTER it is named again (never a fresh retry budget on a cloud just proven down).

Real output

$ cargo test --locked
     Running unittests src/lib.rs (target/debug/deps/hanzo_gen-45f8c24269b21066)
test result: ok. 406 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 42.01s
     Running unittests src/main.rs (target/debug/deps/gen-ea2418945c8dd30a)
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
     Running tests/filesize.rs (target/debug/deps/filesize-365d3debf8bba6ce)
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
     Running tests/signals.rs (target/debug/deps/signals-b9003611fa81958b)
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.13s
   Doc-tests hanzo_gen
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
$ cargo clippy --all-targets -- -D warnings
    Checking hanzo-gen v0.2.2 (/root/bounty_scan/gen)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 10.23s

Baseline at rest before the change was also green (403 lib tests, 3 signals tests, clippy clean), so no pre-existing failures are hidden by this branch.

Closes #20

@zeekay

zeekay commented Nov 29, 2026

Copy link
Copy Markdown
Member

Exemplary test coverage for multi-turn 503 bursts, outage recovery, requestId idempotency, and SIGINT mid-retry cancellation — matches house style and invariants cleanly (440/440 cargo test green). Merging!

@zeekay
zeekay merged commit b94a099 into hanzoai:main Nov 29, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Intern] Transcript retry edge-case regression tests (requestId idempotency & SIGINT cancellation)

2 participants