Skip to content

refactor(agents): move contextPipeline from strategies to triggers#601

Merged
zbigniewsobiecki merged 1 commit intodevfrom
refactor/context-pipeline-per-trigger
Mar 2, 2026
Merged

refactor(agents): move contextPipeline from strategies to triggers#601
zbigniewsobiecki merged 1 commit intodevfrom
refactor/context-pipeline-per-trigger

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Moves context pipeline configuration from strategies.contextPipeline to trigger-specific definitions
  • Provides more explicit control over what context each trigger fetches
  • Fixes copy-paste error in respond-to-review.yaml taskPrompt
  • Adds missing trailingMessage to respond-to-pr-comment.yaml for consistency

Changes

Schema & Logic

  • Remove contextPipeline from StrategiesSchema (now trigger-only)
  • Simplify resolveContextPipeline() to return [] when no trigger matches
  • Add comprehensive JSDoc documenting edge cases

Agent Definitions

  • All YAML files now have contextPipeline per-trigger instead of in strategies
  • Fix respond-to-review.yaml taskPrompt (was incorrectly copy-pasted from respond-to-pr-comment)
  • Add trailingMessage to respond-to-pr-comment.yaml

API & UI

  • Remove contextStepNames from schema endpoint (frontend no longer needs it)
  • Simplify strategies section in dashboard editor

Tests

  • Update schema and loader tests for new structure
  • Add 4 edge case tests for resolveContextPipeline:
    • triggerType: undefined[]
    • Unknown triggerType[]
    • Agent with no triggers → []
    • Empty string triggerType[]

Benefits

  1. Explicit context per trigger: Each trigger clearly defines what context it needs
  2. No hidden defaults: Removed fallback behavior that could mask misconfiguration
  3. Simpler mental model: One place to look for context configuration

Test plan

  • npm run typecheck passes
  • npm run lint passes
  • npm test passes (3726 tests)
  • Pre-commit hooks pass (lint, typecheck)
  • Pre-push hooks pass (test)

🤖 Generated with Claude Code

This refactoring moves context pipeline configuration from a global
default in `strategies.contextPipeline` to trigger-specific definitions.
This provides more explicit control over what context each trigger fetches.

## Changes

### Schema (`schema.ts`)
- Remove `contextPipeline` from `StrategiesSchema`
- Update comment to clarify context step names are only used by triggers
- Update JSDoc for `contextPipeline` in `SupportedTriggerSchema`

### Profile Resolution (`profiles.ts`)
- Simplify `resolveContextPipeline()` to only use trigger-defined pipelines
- Return empty array when no trigger matches (no default fallback)
- Add comprehensive JSDoc documenting edge cases

### Agent Definitions (YAML)
- Move `contextPipeline` from `strategies` to each trigger definition
- `strategies` now only contains `gadgetOptions` (or empty object)
- Fix respond-to-review.yaml taskPrompt (was copy-pasted from respond-to-pr-comment)
- Add missing `trailingMessage` to respond-to-pr-comment.yaml for consistency

### API Router
- Remove `contextStepNames` from schema endpoint (no longer needed by frontend)

### Dashboard UI
- Remove context pipeline editor from strategies section
- Strategies section now only shows gadgetOptions when present
- Clean up unused schema data

### Tests
- Update loader tests to use trigger-defined pipelines
- Update schema tests to remove strategies.contextPipeline assertions
- Add edge case tests for resolveContextPipeline:
  - Returns empty array when triggerType is undefined
  - Returns empty array when triggerType matches no trigger
  - Returns empty array for agents with no triggers (debug)
  - Returns empty array when triggerType is empty string

## Benefits

1. **Explicit context per trigger**: Each trigger clearly defines what
   context it needs, making the configuration more transparent
2. **No hidden defaults**: Removed the fallback behavior that could mask
   misconfiguration
3. **Simpler mental model**: One place to look for context configuration
4. **Better for review agents**: SCM-triggered agents don't accidentally
   fetch PM context they don't need

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit cdb3cf2 into dev Mar 2, 2026
6 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the refactor/context-pipeline-per-trigger branch March 2, 2026 11:30
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