Skip to content

👥 fix: Sanitize Subagent Update Events#185

Merged
danny-avila merged 7 commits into
mainfrom
danny-avila/sanitize-subagent-events
May 21, 2026
Merged

👥 fix: Sanitize Subagent Update Events#185
danny-avila merged 7 commits into
mainfrom
danny-avila/sanitize-subagent-events

Conversation

@danny-avila
Copy link
Copy Markdown
Owner

Summary

I sanitized subagent update forwarding so observational events no longer publish raw child graph payloads while preserving operational tool execution behavior.

  • Sanitized forwarded ON_TOOL_EXECUTE subagent updates down to agentId and compact toolCalls entries with id, name, and args.
  • Stripped operational and sensitive top-level fields from forwarded subagent update payloads, including configurable, metadata, token fields, user context, request body, checkpoint/scratchpad fields, and promise callbacks.
  • Preserved the raw parent ON_TOOL_EXECUTE path so event-driven subagent tools still receive inherited configurable context for execution.
  • Changed observational subagent updates to fire-and-forget inside the awaited forwarder callback so slow UI/SSE publication cannot backpressure child graph execution.
  • Added regression coverage proving sensitive metadata is absent from ON_SUBAGENT_UPDATE while completed tool output remains intact.
  • Confirmed the leak with a live API repro from the main worktree, then confirmed the patched worktree still executes the subagent tool with no token-shaped values in subagent updates.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • npx jest src/tools/__tests__/SubagentExecutor.test.ts --runInBand
  • npx tsc --noEmit
  • npx eslint src/tools/subagent/SubagentExecutor.ts src/tools/subagent/index.ts src/tools/__tests__/SubagentExecutor.test.ts
  • Live API repro on unpatched main confirmed ON_SUBAGENT_UPDATE leaked inherited configurable values.
  • Live API repro on patched worktree confirmed the subagent tool still executed and no fake token/request values appeared in ON_SUBAGENT_UPDATE.

Test Configuration:

  • Node.js via local repository toolchain
  • OpenAI live API using the existing main worktree .env

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

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

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: f4aeffed3b

ℹ️ 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 src/tools/subagent/SubagentExecutor.ts Outdated
Comment thread src/tools/subagent/SubagentExecutor.ts Outdated
Comment thread src/tools/subagent/SubagentExecutor.ts Outdated
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

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

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

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

@danny-avila danny-avila marked this pull request as ready for review May 21, 2026 05:01
@danny-avila
Copy link
Copy Markdown
Owner Author

@codex review

@danny-avila
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

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

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: a8d98f6bfe

ℹ️ 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 src/tools/subagent/SubagentExecutor.ts
Comment thread src/graphs/Graph.ts Outdated
Comment thread src/graphs/Graph.ts Outdated
@danny-avila
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

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

@danny-avila
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

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

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

@danny-avila
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

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

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

@danny-avila
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

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

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

@danny-avila danny-avila changed the title 🛡️ fix: Sanitize Subagent Update Events 👥 fix: Sanitize Subagent Update Events May 21, 2026
@danny-avila danny-avila merged commit 8766027 into main May 21, 2026
4 checks passed
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