Repository navigation
fix(agent): notice a closed channel while an acknowledgement waits - #2209
Open
Benoît Cortier (CBenoit) wants to merge 1 commit into
Open
Benoît Cortier (CBenoit) wants to merge 1 commit into
Benoît Cortier (CBenoit) wants to merge 1 commit into
Conversation
An acknowledgement sent while the outbound buffer was full blocked the channel's stream loop, so it stopped reading the Authority's messages. When the Authority ended its response but kept the request open, the Agent never saw the closure, never reconnected, and logged nothing. The loop now keeps the acknowledgement until the stream has room, as it does for reports, and keeps reading meanwhile. A closure drops it, as for any acknowledgement of a closed stream: the Authority repeats a renewal request and `Hello` reconciles the config. Acknowledgements stay in order, and reports wait behind them; a dropped channel sends the pending one before those still queued. Co-authored-by: Copilot App <[email protected]>
Member
Author
|
Acceptance evidence for 7bdbfcf:
Not changed: a dropped channel whose pending acknowledgement never gets room waits until the Authority closes or the connection drops, as before; bounding it would add a liveness rule. Note LLM-assisted content (no human feedback). |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change addressing Agent channel stalls under outbound backpressure.
No open issues 🎉
What changed in this PR
Fixes an Agent channel stall where an acknowledgement waiting for outbound capacity prevented the stream loop from detecting an Authority closure and reconnecting.
Changes:
- Keeps a pending acknowledgement without blocking inbound reads.
- Preserves acknowledgement order and prioritizes acknowledgements over reports.
- Adds regression tests for reconnection under backpressure and acknowledgement ordering when the channel is dropped.
| File | Description |
|---|---|
crates/agent-channel-client/src/tests/mod.rs |
Adds tests for closure detection with a pending acknowledgement and ordered acknowledgement delivery during shutdown. |
crates/agent-channel-client/src/stream.rs |
Sends pending acknowledgements through a selectable capacity reservation so inbound reads can continue. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An acknowledgement sent while the outbound buffer was full blocked the channel's stream loop, so it stopped reading the Authority's messages.
When the Authority ended its response but kept the request open, the Agent never saw the closure, never reconnected, and logged nothing.
The loop now keeps the acknowledgement until the stream has room, as it does for reports, and keeps reading meanwhile.
A closure drops it, as for any acknowledgement of a closed stream: the Authority repeats a renewal request and
Helloreconciles the config.Acknowledgements stay in order, and reports wait behind them; a dropped channel sends the pending one before those still queued.
Possible follow-up: the contract could also require the Authority to reset the request half when it ends a stream, as defence in depth for clients that stop reading.