Skip to content

fix(agent): exclude child workflow traces from model tool context - #9326

Closed
mzxchandra wants to merge 1 commit into
stagingfrom
codex/compact-workflow-tool-results
Closed

mzxchandra wants to merge 1 commit into
stagingfrom
codex/compact-workflow-tool-results

Conversation

@mzxchandra

Copy link
Copy Markdown
Contributor

Summary

Agent workflow tools return internal child execution spans alongside their final result. Passing those spans into the next model request can exhaust the context window or make secret projection withhold an otherwise small, usable result.

Remove executor-owned child trace metadata from the model-facing copy before secret projection, including canonical workflow tools selected through wire aliases and replayed tool responses. Preserve the raw response for traces, billing and execution records. Nested business fields and unrelated tools are unchanged; secret checks still apply to all functional output.

Type of Change

  • Bug fix

Testing

  • Regression first: three new cases fail on the original code (large traces with/without secret projection, and legacy replay).
  • 66 tests pass across provider runtime context, workflow tool runner and Agent turn session.
  • A 17 MiB diagnostic trace no longer prevents a small final result from reaching the model; a resolved secret in that final result remains redacted.
  • Focused Biome and git diff --check pass.
  • Full repository checks left to hosted CI. Deployed staging and production checks are NOT RUN.

Rollout verification

No schema or created-before default changes. Before/after deployed verification should use the same synthetic child workflow with a large intermediate payload and a tiny final output, checking model consumption, retained activity traces, secret redaction and unchanged child billing. A replay must not execute or charge the child again. Existing persisted chat history is not rewritten.

This fixes diagnostic transport, not oversized business results or the need for bounded/paged tool contracts.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced (hosted CI pending)
  • Contributor License Agreement confirmation by author

@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 23, 2026 1:02am UTC

Request Review

@mzxchandra mzxchandra closed this Oct 23, 2026
@waleedlatif1
waleedlatif1 deleted the codex/compact-workflow-tool-results branch October 23, 2026 02:30

This branch was previously deployed

1 inactive deployment
Preview — b05178b7 Deployed Oct 23, 2026 by vercel[bot]
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.

1 participant