Make synchronous session closing transactional across the blocking client,
threaded singleton, and managed group.
Close transaction
Preencode authenticated close bytes during normal open acceptance and store them
in the active session. Prepare a consuming close commit before adapter work, then
commit protocol state immediately after kernel acceptance.
Failure and rollback behavior
Blocking send failures leave the machine and schedule open and restore negotiated
DSCP best-effort while preserving the original send error. Successful short sends
commit close before reporting the datagram-length mismatch.
Peer-close cleanup
Authenticated peer close remains protocol-authoritative. The blocking adapter
clears its schedule and attempts DSCP cleanup without suppressing returned events
or sending another close packet.
Managed-group behavior
Managed targets use prepare/send/commit without changing shared-socket DSCP.
Failed sends produce failed outcomes without false close commits; peer close
affects only the matching target.
Testing
Adds deterministic regressions for close preparation, HMAC bytes, allocation and
DSCP failures, rollback, retry, short sends, peer cleanup, managed completion,
removal, cancellation, failures, and target isolation.
## Summary
Make synchronous session closing transactional across the blocking client,
threaded singleton, and managed group.
## Close transaction
Preencode authenticated close bytes during normal open acceptance and store them
in the active session. Prepare a consuming close commit before adapter work, then
commit protocol state immediately after kernel acceptance.
## Failure and rollback behavior
Blocking send failures leave the machine and schedule open and restore negotiated
DSCP best-effort while preserving the original send error. Successful short sends
commit close before reporting the datagram-length mismatch.
## Peer-close cleanup
Authenticated peer close remains protocol-authoritative. The blocking adapter
clears its schedule and attempts DSCP cleanup without suppressing returned events
or sending another close packet.
## Managed-group behavior
Managed targets use prepare/send/commit without changing shared-socket DSCP.
Failed sends produce failed outcomes without false close commits; peer close
affects only the matching target.
## Testing
Adds deterministic regressions for close preparation, HMAC bytes, allocation and
DSCP failures, rollback, retry, short sends, peer cleanup, managed completion,
removal, cancellation, failures, and target isolation.
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
### 💡 Codex Review
Here are some automated review suggestions for this pull request.
**Reviewed commit:** `ef19c45c1f`
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
[Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
</details>
Timestamp close events only when sending the request
When a close blocks behind a full UDP send buffer, or socket-option work is delayed, prepare_close() captures at before event reservation, DSCP clearing, and the eventual send/send_to. This makes both blocking-client and managed-group SessionClosed timestamps precede the actual send, despite the public field contract defining at as when the close request was sent; construct or timestamp the event after successful kernel acceptance, immediately before committing the close.
Useful? React with 👍 / 👎.
**<sub><sub></sub></sub> Timestamp close events only when sending the request**
When a close blocks behind a full UDP send buffer, or socket-option work is delayed, `prepare_close()` captures `at` before event reservation, DSCP clearing, and the eventual `send`/`send_to`. This makes both blocking-client and managed-group `SessionClosed` timestamps precede the actual send, despite the public field contract defining `at` as when the close request was sent; construct or timestamp the event after successful kernel acceptance, immediately before committing the close.
Useful? React with 👍 / 👎.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Make synchronous session closing transactional across the blocking client,
threaded singleton, and managed group.
Close transaction
Preencode authenticated close bytes during normal open acceptance and store them
in the active session. Prepare a consuming close commit before adapter work, then
commit protocol state immediately after kernel acceptance.
Failure and rollback behavior
Blocking send failures leave the machine and schedule open and restore negotiated
DSCP best-effort while preserving the original send error. Successful short sends
commit close before reporting the datagram-length mismatch.
Peer-close cleanup
Authenticated peer close remains protocol-authoritative. The blocking adapter
clears its schedule and attempts DSCP cleanup without suppressing returned events
or sending another close packet.
Managed-group behavior
Managed targets use prepare/send/commit without changing shared-socket DSCP.
Failed sends produce failed outcomes without false close commits; peer close
affects only the matching target.
Testing
Adds deterministic regressions for close preparation, HMAC bytes, allocation and
DSCP failures, rollback, retry, short sends, peer cleanup, managed completion,
removal, cancellation, failures, and target isolation.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
ef19c45c1fℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@@ -401,28 +419,35 @@ impl SessionMachine {Ok(events)When a close blocks behind a full UDP send buffer, or socket-option work is delayed,
prepare_close()capturesatbefore event reservation, DSCP clearing, and the eventualsend/send_to. This makes both blocking-client and managed-groupSessionClosedtimestamps precede the actual send, despite the public field contract definingatas when the close request was sent; construct or timestamp the event after successful kernel acceptance, immediately before committing the close.Useful? React with 👍 / 👎.