Skip to content

fix: missing input exhaustion check before append session completion - #125

Merged
quettabit merged 1 commit into
mainfrom
qb/inp-exh-guard
Sep 11, 2026
Merged

quettabit merged 1 commit into
mainfrom
qb/inp-exh-guard

Conversation

@quettabit

Copy link
Copy Markdown
Member

@quettabit
quettabit requested a review from a team as a code owner September 11, 2026 04:55
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown

Greptile Summary

This PR prevents an append attempt from reporting successful completion when its response stream closes before the request input source has been exhausted.

  • Adds an explicit completion invariant after acknowledgements and reconnect advice are handled.
  • Updates the reconnect test transport to consume the second attempt’s request body through exhaustion.
  • Preserves the existing behavior for advised reconnects and responses that close with unacknowledged batches.

Confidence Score: 5/5

The PR appears safe to merge and correctly prevents premature response closure from being mistaken for successful append-session completion.

The new check runs after outstanding acknowledgements and reconnect advice are resolved, while request-input exhaustion is recorded before the transport can finish a normal request body; no actionable failure remains.

Important Files Changed

Filename Overview
src/s2_sdk/_s2s/_append_session.py Adds the missing input-exhaustion invariant before an append attempt can complete successfully.
tests/test_append_session.py Updates the mock streaming transport to exhaust request content on the final reconnect attempt.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Response stream closes] --> B{Unacknowledged batches?}
    B -->|Yes| C[Fail append session]
    B -->|No| D{Reconnect advised?}
    D -->|Yes| E[Reconnect attempt]
    D -->|No| F{Input source exhausted?}
    F -->|No| C
    F -->|Yes| G[Complete session]
Loading

Reviews (1): Last reviewed commit: "initial commit" | Re-trigger Greptile

@quettabit
quettabit merged commit 298766c into main Sep 11, 2026
6 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.

1 participant