fix: store provider signatures before terminal streams - #1000
fix: store provider signatures before terminal streams#1000hanakannzashi wants to merge 4 commits into
Conversation
Review · Status🟩 CompletedIronLoop completed the review and posted it to GitHub. ResultRun detailsAutomatic trigger · attempt 1 of 3 · completed in 4m 51s |
|
Review: hold provider terminal suffix until signature is persisted Approach is correct. Three issues before merge: 1. Post-
In a well-behaved stream this is Suggest a cap that fails open (forwards instead of holding) once exceeded: if holding_provider_terminal_suffix.load(Ordering::Relaxed) {
let mut held = held_provider_terminal_bytes.lock().await;
if held.len() + event.raw_bytes.len() > MAX_HELD_TERMINAL_SUFFIX_BYTES {
tracing::warn!(%organization_id, "Upstream exceeded held terminal suffix cap; forwarding");
holding_provider_terminal_suffix.store(false, Ordering::Relaxed);
let flush = std::mem::take(&mut *held);
drop(held);
return Some(Ok::<Bytes, Infallible>(Bytes::from(
[flush.as_slice(), &event.raw_bytes].concat(),
)));
}
held.extend_from_slice(&event.raw_bytes);
return None;
}A few KiB is ample for a legitimate terminal suffix. 2. The latch check lives inside the Either route the error frame through the hold buffer too, or drop the held suffix and let the error be terminal. Worth an explicit decision plus a comment either way. 3.
Narrow in practice (needs alias + Minor: the new test could assert the stronger property
Flagging as an intentional tradeoff rather than a defect: client-visible Note: I could not compile in this environment, so the above is from static reading; CI should confirm. |
There was a problem hiding this comment.
Review · Summary
Found two medium-severity defects in the terminal-suffix buffering change.
Findings: 🟠 Medium 2
Code-specific findings are attached to the diff.
Validation
- ✅ Static lifecycle inspection — The normal raw provider-signature path was traced through completion-stream finalization before releasing its held terminal bytes.
Review details
- Run:
9d22a71a-1f1d-43b7-8e17-9f4e4d3ca62c - Attempts: 1
|
✅ OpenCodeReview: Review failed: 0 finding(s); 2 of 2 selected item(s) failed. |
4384a9c to
49dbdc1
Compare
6230341 to
db4e6b2
Compare
think-in-universe
left a comment
There was a problem hiding this comment.
No actionable findings. Terminal buffering is bounded to the terminal event/separator and preserves signature availability before [DONE].
|
@ironloopai review |
Review · Status🟩 CompletedIronLoop completed the review and posted it to GitHub. ResultRun detailsManual command by think-in-universe · attempt 1 of 3 · completed in 16m 17s |
There was a problem hiding this comment.
Review · Summary
Found 1 medium-severity issue.
Findings: 🟠 Medium 1
Code-specific findings are attached to the diff.
Validation
- ✅ Rust formatting — Changed sources conform to repository formatting.
- ✅ Terminal-stream state tests — Both complete and incomplete terminal-marker state-machine tests passed.
Review details
- Run:
edda806a-edf6-4f12-b06b-b2d160f479cb - Attempts: 1
think-in-universe
left a comment
There was a problem hiding this comment.
Approved.
Please resolve review comments before merge
Summary
[DONE]This is stacked on #998, which prevents successful signatures for errored streams.
Fixes #999
Testing
cargo fmt --checkcargo test -p services completions:: --libcargo test -p api --libcargo test -p api --test e2e_all --no-runFocused E2E execution is blocked locally by PostgreSQL authentication during test bootstrap.