Skip to content

Expose originating tool call metadata in command environments - #52119

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/1027212b5d495d8e7cfac0f498c3134e060aa897
Oct 8, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/1027212b5d495d8e7cfac0f498c3134e060aa897

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Expose originating tool call metadata in command environments

Why

Command processes need thread and tool call labels for correlation, without stale values from inherited environments or cached shell snapshots.

What changed

  • Export the originating exec_command call ID as CODEX_TOOL_CALL_ID; later write_stdin calls leave it unchanged.
  • Apply executor metadata as CODEX_THREAD_ID and CODEX_TOOL_CALL_ID after environment policies, overlays, and snapshot replay. Clear omitted fields when metadata is present; without metadata, preserve thread context and remove the call ID.
  • Exclude both IDs from newly captured snapshots and omit the call ID from capture and validation helpers.
  • Preserve empty call IDs, omit NUL-containing IDs, and handle case-insensitive environment names on Windows. Document that these labels support correlation, not authorization.

Testing

Add regression coverage for metadata precedence, missing and invalid IDs, snapshot capture and replay, local and remote execution with pipes and TTYs, sandboxed remote execution, and preservation of the originating call ID across later input.

## Why

Command processes need thread and tool call labels for correlation, without stale values from inherited environments or cached shell snapshots.

## What changed

- Export the originating `exec_command` call ID as `CODEX_TOOL_CALL_ID`; later `write_stdin` calls leave it unchanged.
- Apply executor metadata as `CODEX_THREAD_ID` and `CODEX_TOOL_CALL_ID` after environment policies, overlays, and snapshot replay. Clear omitted fields when metadata is present; without metadata, preserve thread context and remove the call ID.
- Exclude both IDs from newly captured snapshots and omit the call ID from capture and validation helpers.
- Preserve empty call IDs, omit NUL-containing IDs, and handle case-insensitive environment names on Windows. Document that these labels support correlation, not authorization.

## Testing

Add regression coverage for metadata precedence, missing and invalid IDs, snapshot capture and replay, local and remote execution with pipes and TTYs, sandboxed remote execution, and preservation of the originating call ID across later input.

GitOrigin-RevId: 1027212b5d495d8e7cfac0f498c3134e060aa897
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Note

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/1027212b5d495d8e7cfac0f498c3134e060aa897 branch from e15e085 to 9b73858 Compare October 8, 2026 13:45
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@copyberry
copyberry Bot merged commit 9b73858 into main Oct 8, 2026
1 check failed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/1027212b5d495d8e7cfac0f498c3134e060aa897 branch October 8, 2026 13:45
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 8, 2026
@lbeezr
lbeezr deployed to issue-triage October 8, 2026 13:47 — with Image GitHub Actions Active
@lbeezr
lbeezr deployed to issue-triage October 8, 2026 13:47 — with Image GitHub Actions Active
@lbeezr
lbeezr deployed to issue-triage October 8, 2026 13:47 — with Image GitHub Actions Active
@lbeezr
lbeezr deployed to issue-triage October 8, 2026 13:48 — with Image GitHub Actions Active
@avfxartist
avfxartist deployed to issue-triage October 8, 2026 13:53 — with Image GitHub Actions Active
@avfxartist
avfxartist deployed to issue-triage October 8, 2026 13:53 — with Image GitHub Actions Active
@avfxartist
avfxartist deployed to issue-triage October 8, 2026 13:53 — with Image GitHub Actions Active
@avfxartist
avfxartist deployed to issue-triage October 8, 2026 13:54 — with Image GitHub Actions Active
@b-aricha
b-aricha deployed to issue-triage October 8, 2026 13:58 — with Image GitHub Actions Active
@b-aricha
b-aricha deployed to issue-triage October 8, 2026 13:58 — with Image GitHub Actions Active
@b-aricha
b-aricha deployed to issue-triage October 8, 2026 13:58 — with Image GitHub Actions Active
@RayzorYv
RayzorYv deployed to issue-triage October 8, 2026 13:58 — with Image GitHub Actions Active
@RayzorYv
RayzorYv deployed to issue-triage October 8, 2026 13:58 — with Image GitHub Actions Active
@RayzorYv
RayzorYv deployed to issue-triage October 8, 2026 13:58 — with Image GitHub Actions Active
@RayzorYv
RayzorYv deployed to issue-triage October 8, 2026 13:59 — with Image GitHub Actions Active
@joaopiccino
joaopiccino deployed to issue-triage October 8, 2026 14:05 — with Image GitHub Actions Active
@joaopiccino
joaopiccino deployed to issue-triage October 8, 2026 14:05 — with Image GitHub Actions Active
@joaopiccino
joaopiccino deployed to issue-triage October 8, 2026 14:06 — with Image GitHub Actions Active
@robjshore
robjshore deployed to issue-triage October 8, 2026 14:32 — with Image GitHub Actions Active
@robjshore
robjshore deployed to issue-triage October 8, 2026 14:32 — with Image GitHub Actions Active
@robjshore
robjshore deployed to issue-triage October 8, 2026 14:32 — with Image GitHub Actions Active
@Dan-Xatia
Dan-Xatia deployed to issue-triage October 8, 2026 14:33 — with Image GitHub Actions Active
@Dan-Xatia
Dan-Xatia deployed to issue-triage October 8, 2026 14:33 — with Image GitHub Actions Active
@Dan-Xatia
Dan-Xatia deployed to issue-triage October 8, 2026 14:33 — with Image GitHub Actions Active
@KobeBeef123
KobeBeef123 deployed to issue-triage October 8, 2026 14:36 — with Image GitHub Actions Active
@KobeBeef123
KobeBeef123 deployed to issue-triage October 8, 2026 14:36 — with Image GitHub Actions Active
@KobeBeef123
KobeBeef123 deployed to issue-triage October 8, 2026 14:36 — with Image GitHub Actions Active
@iiiz-jpg
iiiz-jpg deployed to issue-triage October 8, 2026 14:39 — with Image GitHub Actions Active

This branch was successfully deployed

1 active deployment
issue-triage — 9b738582 Deployed Oct 8, 2026 by erjeve via Translate non-English issue #18480
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.