fix(coding-agent): preserve RLM child prompt precedence - #2
Draft
pst2154 wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 bybuildSystemPrompt(); 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.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.