Skip to content

[staging codex review] #12234 Studio: stop tool calls from getting stuck in Running forever - #112

Closed
Lyxot wants to merge 2 commits into
staging/12234-basefrom
staging/12234
Closed

Lyxot wants to merge 2 commits into
staging/12234-basefrom
staging/12234

Conversation

@Lyxot

@Lyxot Lyxot commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Staging copy of unslothai#12234 for Codex review and CI. Base is the upstream PR merge base, so the diff is exactly the PR. Head is identical to the upstream PR head (a73163af8e). Do not merge; closed once Codex converges and CI finishes.

Since the chat database started reusing connections, a terminal or Python tool call now and then never starts. Its card stays on Running far past Max Tool Call Duration and Stop cannot clear it. It is more likely when several chats are busy at once.

Starting a tool forks Studio, and the copy tried to close database connections owned by other threads. If one of them was mid-query at that moment, the copy waited forever on its lock. Now the copy leaves them alone and the tool starts normally.

With eight busy project chats on main, 29 of about 1,260 terminal calls got stuck this way. On this branch none of 1,306 did. unslothai#12087 fixed a different hang (the credential check on commands like echo "A=$A") and closed the issue, but this one still happens with it merged. Two branch calls still stalled on the Hugging Face client's own cleanup in the forked copy, which is a separate issue.

Refs unslothai#12048

The second commit also covers the other instance of the same hang: huggingface_hub closes its shared httpx client in every forked child through an at-fork hook, which a preexec_fn child runs before exec and can block on an httpx lock another thread held at the fork. A before-fork hook in utils/hub_settings.py now makes that close a no-op outside the owning process.

NilayYadav and others added 2 commits September 29, 2026 01:09
huggingface_hub closes its shared httpx client in every forked child through an at-fork hook. A tool or sidecar spawned with preexec_fn runs that hook before exec, and it blocks forever on an httpx lock another thread held at the fork, leaving the tool call stuck in Running. A before-fork hook now makes the live client's close a no-op outside the process that owns it, so the child keeps it referenced and execs.
@Lyxot

Lyxot commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T08:09:39.719312Z a73163a Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a73163af8e

ℹ️ 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".

Comment thread studio/backend/utils/hub_settings.py Resolved
@Lyxot

Lyxot commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: a73163af8e

ℹ️ 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".

@Lyxot

Lyxot commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Codex converged and CI finished on a73163a; results posted upstream in unslothai#12234.

@Lyxot Lyxot closed this Sep 29, 2026
@Lyxot
Lyxot deleted the staging/12234 branch September 29, 2026 10:45
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.

2 participants