Add app-server background terminal process APIs#26041
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a5856f7ed
ℹ️ 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: 0d37f064d8
ℹ️ 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: b90d036c9c
ℹ️ 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: e0f9c328df
ℹ️ 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: cce9ca7334
ℹ️ 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: e78df1ea9d
ℹ️ 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".
| if !entry.initial_exec_command_returned { | ||
| return true; | ||
| } | ||
| store.remove(process_id) |
There was a problem hiding this comment.
Keep entries for in-flight stdin polls
When a terminal has already returned its initial exec_command, an agent can still have an in-flight write_stdin/empty poll that cloned the process handles before an app calls thread/backgroundTerminals/terminate. Removing the store entry here makes that in-flight poll wake up from termination and then hit ProcessStatus::Unknown in refresh_process_state, returning UnknownProcessId instead of a normal terminated/exited result; keep the entry visible until the active poll observes the exit, or otherwise let the poll finish with the stored metadata.
Useful? React with 👍 / 👎.
Summary
Codex Apps needs app-server as the source of truth for chat-started background terminals instead of guessing from local process trees.
This PR adds experimental v2 APIs to list and terminate background terminals for a loaded thread using the app-server process id.
Changes
thread/backgroundTerminals/list, returningitemId, app-serverprocessId, command/cwd/runtime metadata, and nullable host OS/process metadata.thread/backgroundTerminals/terminateto terminate one running background terminal byprocessId.UnknownProcessIdafter app-initiated termination, and keep failed remote terminations retryable.