fix(sessions): reconcile pending input appends - #4906
Conversation
3d1d54d to
e4606b5
Compare
e4606b5 to
b928be7
Compare
seratch
left a comment
There was a problem hiding this comment.
The packaged compatibility assertion is now aligned, and both Linux packaged-contract checks pass. The runtime implementation and pending-input tests are unchanged, so the remaining requests still apply:
- Initialize a fresh
OpenAIConversationsSessionbefore reading its session ID. - Account for Conversations API message normalization when comparing recovery fingerprints.
- Accept SDK-generated local-shell replay items during pending-input deserialization.
- Capture the streamed result's checkpoint after the expected exception, and add a controlled test proving that input appended during an in-flight session write survives recovery.
These are still needed before merging.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f446681dc8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Addressed all four requested follow-ups in commit
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 454d22155b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78784a32c6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 315b4bb3c1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c7106f231
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
Fix pending-input Session appends so they use the existing fail-closed reconciliation checkpoint. A retry appends once after an atomic failure, recognizes a committed lost-ack append without duplicating it, consumes only the checkpoint-owned pending-input prefix, and preserves already-completed guardrail results.
The RunState schema is bumped to 1.18 for the new pending-input ownership metadata. Checkpoint restoration validates input items before Session I/O, and Conversations reconciliation uses the same persistence normalization as its stored batch.
Test plan
make typecheckuv run pytest -q tests/test_run_state_pending_input.py tests/test_run_impl_resume_paths.py tests/test_run_state.py tests/test_run_state_compatibility_corpus.py(710 passed)uv run ruff check src/agents/run_state.py src/agents/run_internal/session_persistence.py tests/test_run_state_pending_input.pygit init --initial-branch=main, which this host's Git does not support.Issue number
Closes #4775
Checks