Skip to content

feat(subagent): derive child run context - #97

Merged
delete-cloud merged 3 commits into
mainfrom
adr16-subagent-foundations
May 4, 2026
Merged

delete-cloud merged 3 commits into
mainfrom
adr16-subagent-foundations

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • allow create_agent and create_child_pipeline to accept an explicit run_id_override for child runtime construction
  • derive child run identity from the parent AgentRunContext in the subagent tool and forward environment, budget, and merged trace metadata to the child builder
  • preserve compatibility for legacy child builders by only sending the new environment and run_id_override kwargs when a parent run context exists

Verification

  • uv run pytest tests/coding_agent/tools/test_subagent.py tests/coding_agent/test_bootstrap.py -v
  • uv run pytest tests/coding_agent/plugins/test_core_tools.py -k "subagent_runs_child_pipeline" -q
  • uv run pytest tests/coding_agent/tools/test_subagent.py tests/coding_agent/test_bootstrap.py tests/coding_agent/plugins/test_core_tools.py -k "subagent or run_id_override" -q
  • uv run basedpyright src/coding_agent/tools/subagent.py src/coding_agent/app.py tests/coding_agent/tools/test_subagent.py tests/coding_agent/test_bootstrap.py --level error
  • python3 -m py_compile src/coding_agent/tools/subagent.py src/coding_agent/app.py
  • manual subagent QA driver script exercising child run-id/environment forwarding
  • uv run python -m coding_agent --help

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for specifying custom run IDs during agent and pipeline creation
    • Improved context inheritance when creating child agents from parent agents
  • Tests

    • Added validation tests for run ID override parameter
    • Enhanced test coverage for child agent environment configuration and context propagation

delete-cloud and others added 2 commits May 4, 2026 13:13
Subagent builders need to preserve derived child run identity instead of always minting a fresh bootstrap run id.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Child runs should inherit parent identity context without breaking legacy child builders that only accept the older kwargs.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@coderabbitai

coderabbitai Bot commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@delete-cloud has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 39 minutes and 59 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 861b11fa-1c54-42ef-b1c3-cdb3264e6541

📥 Commits

Reviewing files that changed from the base of the PR and between 6fd5bf2 and ba4f287.

📒 Files selected for processing (2)
  • coding-agent/src/coding_agent/tools/subagent.py
  • coding-agent/tests/coding_agent/test_bootstrap.py
📝 Walkthrough

Walkthrough

The PR adds run_id_override parameter support to create_child_pipeline and create_agent functions, allowing callers to specify or override the run ID for child agents. When provided, the override is validated; when absent, a new UUID is generated. The subagent dispatch tool derives a child run context with a distinct run ID and threads it through to the child pipeline builder.

Changes

Run ID Override Plumbing

Layer / File(s) Summary
Core Parameter Addition
coding-agent/src/coding_agent/app.py
create_child_pipeline and create_agent accept new run_id_override: str | None parameter. Resolved run_id (UUID when None, validated when provided) is passed to AgentRunContext instead of always generating a new UUID.
Tool Integration
coding-agent/src/coding_agent/tools/subagent.py
Subagent tool derives a child run_context from parent, generates a distinct child run_id, and threads run_id_override, context_budget, trace_metadata, environment, and parent_run_id_override to child pipeline builder.
Tests & Validation
coding-agent/tests/coding_agent/test_bootstrap.py, coding-agent/tests/coding_agent/tools/test_subagent.py
Added tests verifying non-empty run_id_override is applied to ctx.run_context.run_id, empty override raises ValueError, child builder receives a distinct run_id_override, and parent environment is forwarded to child builder.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • [codex] Add agent run context #91: Both PRs modify run-context threading through create_child_pipeline/create_agent and subagent dispatch to plumb AgentRunContext fields and ID overrides into child pipelines.

Poem

🐰 A rabbit hops through IDs with care,
Each child run gets its own affair,
No UUID confusion in the air,
Overrides stack with flair so rare—
The pipeline's destiny runs fair! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(subagent): derive child run context' accurately summarizes the main changes: enabling run_id_override support and deriving child run context in the subagent tool.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch adr16-subagent-foundations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 39 minutes and 59 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Review follow-up: cover create_child_pipeline run-id overrides directly and remove the redundant pre-merge before derive_child while keeping legacy child-builder compatibility.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@delete-cloud
delete-cloud merged commit 2798d7a into main May 4, 2026
1 check passed
@delete-cloud
delete-cloud deleted the adr16-subagent-foundations branch May 10, 2026 03:56
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