Skip to content

runtime: share the sub-agent runtime notes between pi and Codex #8403

Open

Description

@waynesun09

Problem

#8384 (merged, a79714498) made every Codex role open with codexChildNote: the child contract followed by codexChunkedReadNote, the same chunked-read constant the parent note uses. What remains is drift between the pi and Codex copies:

Purpose pi Codex
Child contract ("carry out the single task… your final assistant message is the entire result") CHILD_SYSTEM_NOTE (internal/runtime/pi_extension/fullsend-agent.js) inside codexChildNote (codex_personas.go), a word-for-word copy; no test checks the two match
Parent with no sub-agent tool piNoSubagentNote (pi_bootstrap.go) codexNoSubagentNote (codex_bootstrap.go); the "execute each sub-agent definition yourself" sentence is the same, the opening differs

Proposal

  1. A runtime-neutral Go file (e.g. internal/runtime/subagent_notes.go) with:
    • childContract, used by codexChildNote;
    • the shared "no sub-agent tool" sentence, used by piNoSubagentNote and codexNoSubagentNote.
  2. Keep pi's JS CHILD_SYSTEM_NOTE (the extension must run under bare node) and add a Go test that reads the embedded fullsend-agent.js and checks it matches childContract. Alternative: pass it in through the pi manifest, which needs a JS fallback and fixture changes.
  3. Optional: the chunked-read rule names "a SKILL.md or other instruction file"; children mostly read long source and diff files, where exec truncation drops the middle the same way. Consider widening it to any long file.

Out of scope: Explore enforcement differs by design (pi restricts tools; a Codex role cannot restrict a child's tools).

Notes for PR 6 of #6970

  • "You have no sub-agent tool" holds for a Codex child only through Codex defaults: V1 depth limit 1 (DEFAULT_AGENT_MAX_DEPTH) and children inheriting the V1 parent model. When delegating, write [agents] max_depth = 1 and run the V1 check for each child model (per-persona models), not only the parent; V2 ignores depth.
  • Codex V1's default open-children limit is 6 (DEFAULT_AGENT_MAX_THREADS, codex-rs/core/src/config/mod.rs at rust-v0.159.3); ADR 0126 states four, so the config should set it.

Related

Activity

  1. fullsend-ai-triage commented on Oct 13, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 8:10 PM UTC · Completed 8:12 PM UTC

    Commit: 3939307 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.19

  2. added
    blocked
    on Oct 13, 2026
  3. fullsend-ai-triage commented on Oct 13, 2026

    @fullsend-ai-triage

    Thanks for the detailed proposal. The direction (one runtime-neutral definition of the child contract and the shared no-sub-agent sentence, with per-runtime additions on top, plus a Go test pinning the pi JS constant to the Go one) is well specified.

    It is currently blocked on #8384. The Codex role text this issue wants to unify (the default/explore texts and the per-persona role files) is generated by code that only exists in that open PR; internal/runtime/codex_personas.go is not on main yet. The issue also notes that item 3 depends on the open 'body only' question on that PR, so the shape of the Codex role text should be settled there first.

    Once #8384 merges (and the 'body only' question is resolved), this can be re-triaged. At that point the work should be straightforward: add internal/runtime/subagent_notes.go, switch piNoSubagentNote and codexNoSubagentNote to the shared sentence, apply the chunked-read constant to every Codex role, and add the JS/Go parity test. Note that the shared-constant parts for the parent notes (items 1, 2, 4) are not themselves dependent on #8384, so a maintainer could choose to land those separately.

    Also worth tracking for PR 6 of #6970: the Codex default open-children limit mentioned in the issue differs from the value stated in ADR 0126, so config should set it explicitly.

    Blocked by:

  4. removed
    blocked
    on Oct 15, 2026
  5. waynesun09 commented on Oct 15, 2026

    @waynesun09
    MemberAuthor

    Unblocked: #8384 merged (a797144) and settled the role-text question. Body narrowed to the remaining items.

  6. fullsend-ai-triage commented on Oct 15, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 7:46 PM UTC · Completed 7:48 PM UTC

    Commit: a797144 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.21

  7. added
    triaged
    on Oct 15, 2026
  8. fullsend-ai-triage commented on Oct 15, 2026

    @fullsend-ai-triage

    The earlier blocker (#8384) has merged, so this is ready for implementation. The claims in the issue check out against main: codexChildNote is a verbatim copy of the JS CHILD_SYSTEM_NOTE, nothing tests that they match, and internal/runtime/subagent_notes.go does not exist yet. No open PR addresses this.

    Implementation notes:

    • fullsend-agent.js is already go:embeded in pi_bootstrap.go, so the parity test can read it directly without a manifest change. That makes it the simpler option compared with passing the text through the pi manifest.
    • Keep rendered Codex output byte-identical so existing expectations in the persona and bootstrap tests keep passing.
    • Item 3 (widening the chunked-read rule) changes prompt behavior for every Codex role and is optional. It could be split into a follow-up if reviewers want the refactor to stay behavior-neutral.
    • The max_depth and open-children limit notes (Codex default 6 vs ADR 0126's four) are for PR 6 of codex runtime: run the review/retro sub-agent rosters through codex's native spawn_agent roles #6970 and are not part of this change.

    Proposed test case:

    Read embedded fullsend-agent.js -> extract CHILD_SYSTEM_NOTE
    assert extracted == childContract
    assert codexChildNote contains childContract
    assert piNoSubagentNote and codexNoSubagentNote both contain the shared sentence
    assert rendered Codex notes unchanged vs. current golden expectations
    

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions