Skip to content

fix(coding-agent): preserve delegated message trust guidance - #142

Merged
Issacboy123 merged 1 commit into
fix/enforce-subagent-parent-policyfrom
fix/harden-subagent-message-guidance
Aug 29, 2026
Merged

Issacboy123 merged 1 commit into
fix/enforce-subagent-parent-policyfrom
fix/harden-subagent-message-guidance

Conversation

@Issacboy123

@Issacboy123 Issacboy123 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Hidden subagent results and escalations can contain untrusted claims or embedded instructions, but the existing escalation-only guidance could disappear when coordination tools were filtered or a custom or extension-returned system prompt was selected. This PR gives every controller-owning root session one combined trust suffix across prompt forms and rebuild paths.

Reasoning

Applying the guidance in AgentSession after the effective system prompt is selected makes the trust boundary independent of tool availability and extension prompt replacement. Keeping the composition private avoids expanding the public prompt-building API and preserves the existing custom-message roles, persistence, delivery, and display behavior.

Changes

  • Replaced tool-owned escalation guidance with one controller-bound suffix covering subagent_results and subagent_escalations.
  • Appended the suffix exactly once to default, custom, and extension-returned root system prompts.
  • Preserved the suffix across tool filtering, resource reloads, discovered extension resources, and harness activation.
  • Added focused prompt-composition coverage for each supported prompt and rebuild path.
  • Updated SDK, usage, and saved-session documentation with the delegated-report trust model and recorded the fix in the changelog.

Testing

  • node ../../node_modules/vitest/dist/cli.js --run test/suite/subagent-parent-messaging.test.ts
  • node ../../node_modules/vitest/dist/cli.js --run test/suite/subagent-services.test.ts test/suite/subagent-registration.test.ts test/suite/subagent-coordination.test.ts test/suite/subagent-parent-messaging.test.ts test/subagent-controller.test.ts
  • npm run check

@Issacboy123 Issacboy123 self-assigned this Aug 28, 2026
@Issacboy123 Issacboy123 added bug Something isn't working coding-agent labels Aug 28, 2026
@Pepps233
Pepps233 self-requested a review August 28, 2026 15:34
const CURRENT_PLAN_RESTORATION_REMINDER =
"Reminder: restored context is not proof of completion. Verify current state before claiming work is done.";
const MAX_PENDING_SUBAGENT_ESCALATION_CHARACTERS = 8_000;
const SUBAGENT_DELEGATED_MESSAGE_TRUST_GUIDANCE =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More testing should be done on this; if the parent begins validating every claim returned by the subagents, it defeats the purpose of having subagents (separation of context). This is ok to merge for now, but just keep the above in mind.

@Issacboy123
Issacboy123 merged commit d869fbf into main Aug 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working coding-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants