feat(ai): structured evidence-backed subagent prompt + parent-LLM inheritance (PR1 1.b/1.c)#1279
Merged
Merged
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
A spawned subagent fell back to CONFIG.addons.ai.default_model, which may be a different provider than the parent (e.g. anthropic-direct vs the parent's openrouter) with no key set -> AuthenticationError before the subagent did anything, so subagents never actually ran. Carry the parent's resolved LLM config on ActionContext (api_key/api_base; model already present) and setdefault them onto the child opts at the name=='ai' spawn branch (an explicit LLM-supplied model still wins). Verified E2E: subagents now run to SUCCESS and receive the structured prompt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NNjPggRSVZ2xnLb7ZxWP5H
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.
What (PR 1, parts 1.b + 1.c + a subagent-runnability fix)
1.b/1.c — structured, evidence-backed subagent prompt. When the ai task spawns a subagent, its prompt becomes a structured template whose "already known" section is auto-assembled from workspace findings for the subagent's target(s), so it doesn't redo work.
build_subagent_prompt(objective, targets, evidence)— wraps the LLM-supplied objective (verbatim) in## Objective / ## Scope / ## Already known (do not re-run) / ## Expected output._gather_subagent_evidence(ctx, targets, limit=40)— queries the workspace (single source of truth incl. this run's live findings, per fix(ai): make query_workspace the single source of truth (local-driver union) #1278) for findings matching the targets; token-bounded; best-effort (failure →"", never breaks the spawn)._run_runner'sname=="ai"branch. 1.a (permissions) untouched — out of scope.Subagent LLM inheritance (fold-in). E2E testing surfaced that a spawned subagent fell back to
CONFIG.addons.ai.default_model— a different provider than the parent (anthropic-direct vs openrouter) with no key →AuthenticationErrorbefore it ran, so subagents never actually ran. Fixed: carry the parent's resolvedmodel/api_key/api_baseonActionContextandsetdefaultthem onto the child opts at spawn (explicit LLM-supplied model still wins).Verification
TestBuildSubagentPrompt,TestGatherSubagentEvidence, andTestRunRunnertests for the structured prompt + LLM inheritance (+ explicit-model-wins).test_ai_actions.py97 passed; no new failures vs baseline.session_id.Known limitation (accepted, v1)
The
$orhost/ip/url evidence match is exact —matched_at-only findings on URL-only targets aren't gathered yet (deliberate follow-up).Part of the AI-task series →
ai-resiliency(#1241).🤖 Generated with Claude Code