Skip to content

feat: manual debug analysis triggering and automatic base branch for PRs#304

Merged
zbigniewsobiecki merged 1 commit intodevfrom
feat/manual-debug-analysis
Feb 16, 2026
Merged

feat: manual debug analysis triggering and automatic base branch for PRs#304
zbigniewsobiecki merged 1 commit intodevfrom
feat/manual-debug-analysis

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Manual debug analysis: Users can now trigger debug analysis on any agent run (not just auto-triggered on failures). Available via tRPC mutation, CLI --analyze/--wait flags, and web UI "Run Analysis" / "Re-run Analysis" buttons with auto-polling.
  • Automatic PR base branch: The create-pr tool now auto-resolves the target base branch from CASCADE_BASE_BRANCH env var (injected from project config), removing a common source of agent errors where the wrong --base was specified.

Changes

Manual Debug Analysis (CLI + Web UI + API)

  • src/triggers/shared/debug-status.ts — New in-memory tracker for running analyses
  • src/triggers/shared/debug-runner.ts — Integrate status tracker; fix severity to 'manual' for non-failure runs
  • src/db/repositories/runsRepository.ts — Add deleteDebugAnalysisByRunId for replace-on-rerun
  • src/api/routers/runs.ts — Add triggerDebugAnalysis mutation + getDebugAnalysisStatus query
  • src/cli/dashboard/runs/debug.ts — Add --analyze and --wait flags
  • web/src/components/debug/debug-analysis.tsx — Run/Re-run Analysis buttons with polling
  • CLAUDE.md — Document new CLI flags

Automatic PR Base Branch

  • src/backends/adapter.ts — Inject CASCADE_BASE_BRANCH from project.baseBranch into project secrets
  • src/cli/github/create-pr.ts--base defaults to CASCADE_BASE_BRANCH env var
  • src/agents/prompts/templates/implementation.eta — Stop instructing agents to specify --base
  • src/agents/prompts/templates/partials/git.eta — Remove --base instruction

Tests

  • New: tests/unit/triggers/debug-status.test.ts (6 tests)
  • Updated: tests/unit/triggers/debug-runner.test.ts (+3 tests: status tracker calls, severity: manual)
  • Updated: tests/unit/api/routers/runs.test.ts (+12 tests: getDebugAnalysisStatus, triggerDebugAnalysis)
  • Updated: tests/unit/api/router.test.ts (+2 procedure assertions, new mocks)
  • Updated: tests/unit/db/runsRepository.test.ts (+1 test: deleteDebugAnalysisByRunId)
  • Fixed: tests/unit/backends/adapter.test.ts (2 tests updated for CASCADE_BASE_BRANCH injection)

Test plan

  • npm run typecheck passes
  • npm run lint clean
  • npm test — 83 files, 1266 tests all pass
  • npm run build:web succeeds
  • CI passes on PR
  • cascade runs debug <id> --analyze triggers analysis
  • Web UI: Debug Analysis tab shows "Run Analysis" button, transitions to running state, shows result

🤖 Generated with Claude Code

Add on-demand debug analysis for any agent run via CLI, web UI, and tRPC API.
Previously, debug analysis only ran automatically for failed/timed_out runs.
Now users can analyze any run (including successful ones for efficiency review)
and re-run analysis on already-analyzed runs.

Changes:
- Add triggerDebugAnalysis tRPC mutation and getDebugAnalysisStatus query
- Add --analyze and --wait flags to `cascade runs debug` CLI command
- Add Run Analysis / Re-run Analysis buttons in web UI with auto-polling
- Add in-memory analysis status tracker (debug-status.ts)
- Add deleteDebugAnalysisByRunId for replace-on-rerun
- Fix severity field: use 'manual' for non-failure/non-timeout runs

Also makes PR base branch automatic via CASCADE_BASE_BRANCH env var:
- create-pr CLI: --base defaults to CASCADE_BASE_BRANCH env var
- adapter: injects project.baseBranch as CASCADE_BASE_BRANCH into secrets
- Remove --base from CreatePR tool manifest (agents no longer specify it)
- Update implementation prompt and git partial to stop specifying --base

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 1ea33d4 into dev Feb 16, 2026
4 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the feat/manual-debug-analysis branch February 16, 2026 17:50
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