Fix SSE stream integrity capture #107

Open
nsaspy wants to merge 8 commits from fix/67-stream-integrity into main
Owner

Tracks #67.

What changed

  • record status_kind so connect failures and post-prepare upstream failures are distinguishable from normal upstream responses;
  • never replace an already-prepared HTTP stream with a second 502 response;
  • preserve the upstream status, headers, and bytes already relayed on mid-stream failure;
  • record SSE stream_completed only from protocol terminal evidence ([DONE], provider finish/stop reasons, or known terminal event types);
  • retain provider finish_reason without synthesizing missing values;
  • keep non-SSE stream completion unknown;
  • promote the verified stream-integrity invariants into the repo's Org-roam graph and Prolog KB.

RED evidence

Exact test-only head 74623584b1accf48993ac3fe0c885514d82d46fa ran the complete suite: 99 tests, with only the 3 new stream-integrity contracts failing. The abrupt-upstream case reproduced the prepared-response hang and hit its 3-second bound.

GREEN evidence

Code head 5fa75afa40f15747fdf0a5f1fe8bd0d8f57e9e54 passed both exact-head workflows:

  • Analytics API run 21: full Python regression suite passed.
  • Quota telemetry exact-head contract run 26: full Python suite passed and the delivered Python capture package built successfully.

Final head 74eaf8df2c113e94639962f414445f69c43bdaf3 also passed both exact-head workflows after knowledge promotion:

  • Analytics API run 25: success.
  • Quota telemetry exact-head contract run 30: full Python regression suite and delivered Python capture package build both succeeded.
Tracks #67. ## What changed - record `status_kind` so connect failures and post-prepare upstream failures are distinguishable from normal upstream responses; - never replace an already-prepared HTTP stream with a second `502` response; - preserve the upstream status, headers, and bytes already relayed on mid-stream failure; - record SSE `stream_completed` only from protocol terminal evidence (`[DONE]`, provider finish/stop reasons, or known terminal event types); - retain provider `finish_reason` without synthesizing missing values; - keep non-SSE stream completion unknown; - promote the verified stream-integrity invariants into the repo's Org-roam graph and Prolog KB. ## RED evidence Exact test-only head `74623584b1accf48993ac3fe0c885514d82d46fa` ran the complete suite: 99 tests, with only the 3 new stream-integrity contracts failing. The abrupt-upstream case reproduced the prepared-response hang and hit its 3-second bound. ## GREEN evidence Code head `5fa75afa40f15747fdf0a5f1fe8bd0d8f57e9e54` passed both exact-head workflows: - Analytics API run 21: full Python regression suite passed. - Quota telemetry exact-head contract run 26: full Python suite passed and the delivered Python capture package built successfully. Final head `74eaf8df2c113e94639962f414445f69c43bdaf3` also passed both exact-head workflows after knowledge promotion: - Analytics API run 25: success. - Quota telemetry exact-head contract run 30: full Python regression suite and delivered Python capture package build both succeeded.
Some checks failed
Analytics API / test (pull_request) Failing after 32s
Quota telemetry exact-head contract / quota-contracts (pull_request) Failing after 30s
Analytics API / package (pull_request) Has been skipped
This pull request has changes conflicting with the target branch.
  • llm_log/recorder.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/67-stream-integrity:fix/67-stream-integrity
git switch fix/67-stream-integrity

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff fix/67-stream-integrity
git switch fix/67-stream-integrity
git rebase main
git switch main
git merge --ff-only fix/67-stream-integrity
git switch fix/67-stream-integrity
git rebase main
git switch main
git merge --no-ff fix/67-stream-integrity
git switch main
git merge --squash fix/67-stream-integrity
git switch main
git merge --ff-only fix/67-stream-integrity
git switch main
git merge fix/67-stream-integrity
git push origin main
Sign in to join this conversation.
No description provided.