Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Castiron custom code✅ No new custom-code files detected. 49 mixed files remain; 1 existing customization changed. Compared
48 existing customizations unchanged
8 more in the full report. A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 36893538883 --repo openai/openai-python \
--name castiron-custom-code-36893538883-1 --dir /tmp/castiron-custom-code-36893538883-1
git apply --stat /tmp/castiron-custom-code-36893538883-1/custom-code.patch
cat /tmp/castiron-custom-code-36893538883-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 10f88169b0f3929b4e2528aad7a825df31163156 c1212a23fbe84cc987c1cc470a21baa3344389de
python3 scripts/castiron/custom_code_report.py report \
--base 10f88169b0f3929b4e2528aad7a825df31163156 \
--head c1212a23fbe84cc987c1cc470a21baa3344389de --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-c1212a23fbe8
cat /tmp/castiron-custom-code-c1212a23fbe8/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fcfa98392
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review pls |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 552711cb07
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review pls |
1 similar comment
|
@codex review pls |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour 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". |
|
@codex review pls |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfddcb8747
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review pls |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour 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". |
|
@codex review pls |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review pls |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour 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". |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour 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". |
|
@codex review pls |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a1d2d8749
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@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: de808413ad
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@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: 90c79679eb
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f5e68d3 to
f16973a
Compare
|
@codex review pls |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1212a23fb
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| collector.turn is None | ||
| or collector.turn.id == self.turn.id | ||
| and collector.turn.status not in _TERMINAL | ||
| and self.turn.status in _TERMINAL | ||
| ): |
There was a problem hiding this comment.
Refresh nonterminal turn snapshots in the collector
When attachment initially seeds a queued or in-progress root and a later approval event causes manual diagnostics to refresh that same root to waiting, state.refresh(latest) updates the attachment but this condition refuses to copy the newer snapshot because neither status is terminal. The ensuing requires_action error therefore exposes a stale turn.status (for example, in_progress) alongside a current approval that can only be serviced for the waiting turn. Propagate authoritative same-turn nonterminal refreshes to the collector while retaining the existing protection against downgrading an observed terminal state.
Useful? React with 👍 / 👎.
| def select_candidate( | ||
| sessions: Sessions, state: AgentSessionAttachment, candidate: str, options: _RequestOptions | ||
| ) -> None: | ||
| latest = _latest_root(sessions.turns.list(state.session_id, order="desc", **options)) | ||
| if latest is not None and latest.id == candidate: |
There was a problem hiding this comment.
Request the maximum page size when locating the root
In a long-running multi-agent turn, every subagent turn is newer than its root, so _latest_root() may auto-page through the entire subagent history before finding the current root. This call leaves the turns endpoint at its 20-record default, and attachment invokes the same scan repeatedly during bootstrap, candidate validation, idle refresh, and manual diagnostics; sessions with hundreds of child turns can therefore make dozens of serial requests per lookup and fail reattachment through timeouts or rate limits. Distinct from durable item recovery, these turn-list calls should also request the endpoint's maximum page size in both sync and async paths.
Useful? React with 👍 / 👎.
|
Closing this PR for now while we establish a reliable backend recovery contract. On reattachment, a silent session event stream does not distinguish already-completed work from work the client should continue waiting for. A separate session/history read is not a sufficient boundary either: newly accepted input can still be followed by an idle session snapshot. Returning the latest historical result can therefore select a previous turn, while waiting for completion can wait indefinitely for an event that already happened. We are avoiding SDK-side history reconciliation and heuristics for this ambiguous recovery case. Reattachment/result recovery is deferred until the backend provides an authoritative attachment state or equivalent execution/completion signal. The file/artifact helpers will proceed separately, without depending on this PR. |
## Summary
Stage selected local files and read an artifact from the exact completed
turn, either in memory or streamed to a local path. The helpers keep
upload IDs available for explicit cleanup and stream downloads to a
caller-chosen path.
Before:
```python
uploaded = client.files.create(file=Path("source.pdf"), purpose="user_data")
inputs = [{"type": "file_id", "file_id": uploaded.id, "path": "/workspace/source.pdf"}]
# Pass inputs when creating the hosted environment, then run the session.
artifact = next(a for a in client.beta.agents.sessions.artifacts.list(result.session_id)
if a.turn_id == result.turn_id and a.path == "/workspace/outputs/report.md")
with client.beta.agents.sessions.artifacts.with_streaming_response.content(
artifact.id, session_id=result.session_id,
) as content:
content.stream_to_file("report.md")
```
After:
```python
prepared = client.beta.agents.environments.files.prepare({
"/workspace/source.pdf": Path("source.pdf"),
})
# Pass prepared.files when creating the hosted environment, then run the session.
artifacts = client.beta.agents.sessions.artifacts.for_result(result)
report_bytes = artifacts.content("/workspace/outputs/report.md").content
# Or stream to an application-owned path:
artifact = artifacts.download("/workspace/outputs/report.md", to=Path("report.md"))
```
`prepare_directory(..., include=[...])` selects a directory snapshot;
`files.upload(...)` uploads and stages one file in an existing
environment. Sync and async helpers live under the beta Agents
namespace. They preflight selected files before uploading, preserve
partial upload ownership on errors, and detect missing or ambiguous
artifacts across all pages.
Local path selection is intended for static application-owned files and
stable directories; it is not a filesystem sandbox for untrusted paths
or hostile local writers.
This PR now targets `main` directly. Reattachment/result recovery is
deferred: a silent attachment cannot reliably distinguish pending work
from an already-completed turn, so these helpers do not depend on
SDK-side recovery heuristics.
### Stack
- openai#4004 (merged
prerequisite)
- openai#4007 (merged
prerequisite)
- openai#4008 (closed/deferred;
not a dependency)
- openai#4009 👈 this PR
Summary
Reconnect to a hosted session with the same tool handlers after a worker or event connection stops. Omitting
inputattaches to existing work without sending another prompt.Before, the raw event stream leaves pending-call dispatch and final-answer recovery to the application:
After:
Pending calls come from the reattached stream and use the existing dispatcher. Explicit result collection retrieves the selected turn's durable messages. Already-idle sessions drain without inventing a result from an earlier turn. Reattachment uses at-least-once tool-call delivery with application-owned recovery: restart the worker, recover its saved session ID, and reattach handlers. Applications own idempotency for handler mutations. Sync and async APIs support the same flow.
Stack