Skip to content

fix(coding-agent): preserve RLM child prompt precedence - #2

Draft
pst2154 wants to merge 1 commit into
mainfrom
codex/rlm-child-prompt-precedence-minimal
Draft

fix(coding-agent): preserve RLM child prompt precedence#2
pst2154 wants to merge 1 commit into
mainfrom
codex/rlm-child-prompt-precedence-minimal

Conversation

@pst2154

@pst2154 pst2154 commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Preserve the existing RLM child doctrine unchanged.
  • Defer its insertion while the full system prompt is assembled, then append it after inherited custom, harness, and appended prompt content.
  • Apply the same precedence rule to both the default RLM prompt and custom system prompts.
  • Add regression coverage for controller-prompt precedence and recursive delegation.

Root cause

RLM children intentionally inherit the parent session's custom and appended system-prompt content. The child doctrine was previously inserted inside buildRlmPrompt() or early in the custom-prompt path. Later appended instructions could therefore become the final role-defining text.

When the inherited text described the root as a controller that should spawn and monitor children, a child model could interpret that controller role as its own. In the observed heterogeneous SOL-parent/Lightning-child run, this caused the child to attempt another rlm() call instead of executing its assigned task, eventually reaching the configured recursion limit.

Implementation

buildSystemPrompt() now builds the existing child doctrine once and appends it after all inherited prompt sections. buildRlmPrompt() gains an internal composition option that suppresses its inline copy when called by buildSystemPrompt(); its standalone default remains unchanged.

No new child instructions, messaging behavior, recursion rules, or model-specific workarounds are introduced.

Compatibility

This is a backward-compatible prompt-ordering change. It does not change daemon commands, events, response shapes, protocol versions, capability negotiation, or which parent prompt content children inherit. Recursive delegation remains available when enabled.

Validation

  • npx tsx ../../node_modules/vitest/dist/cli.js --run test/system-prompt.test.ts — 26 tests passed.
  • npm run check — formatting, linting, type checking, installer rendering, and browser smoke checks passed.
  • Live SOL-parent/Lightning-child regression — the child retained its child role and did not enter the inherited controller/recursive-spawn loop.

The live hard-task run remained slow and did not finish before the manual cutoff; this PR intentionally does not address Lightning model quality, gateway latency, or agent-message tool ergonomics.

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