feat: enhance mode routing with track_progress and context preservation

This PR implements enhanced mode routing to address two critical v1 migration issues:
1. Lost GitHub context when using custom prompts in tag mode
2. Missing tracking comments for automatic PR reviews

Changes:
- Add track_progress input to force tag mode with tracking comments for PR/issue events
- Support custom prompt injection in tag mode via <custom_instructions> section
- Inject GitHub context as environment variables in agent mode
- Validate track_progress usage (only allowed for PR/issue events)
- Comprehensive test coverage for new routing logic

Event Routing:
- Comment events: Default to tag mode, switch to agent with explicit prompt
- PR/Issue events: Default to agent mode, switch to tag mode with track_progress
- Custom prompts can now be used in tag mode without losing context

This ensures backward compatibility while solving context preservation and tracking visibility issues reported in discussions #490 and #491.
This commit is contained in:
km-anthropic
2025-08-28 13:16:39 -07:00
parent 0c127307fa
commit 07a69eeb9c
10 changed files with 347 additions and 9 deletions

View File

@@ -32,6 +32,7 @@ describe("prepareMcpConfig", () => {
useStickyComment: false,
useCommitSigning: false,
allowedBots: "",
trackProgress: false,
},
};