@nathapp/nax 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +96 -0
- package/BRIEF.md +140 -0
- package/CHANGELOG.md +60 -0
- package/CLAUDE.md +159 -0
- package/README.md +373 -0
- package/US-007-IMPLEMENTATION.md +139 -0
- package/bin/nax.ts +930 -0
- package/biome.json +14 -0
- package/bun.lock +168 -0
- package/bunfig.toml +11 -0
- package/docs/20260216-fix-plan-context-review.md +56 -0
- package/docs/20260216-relentless-vs-ngent-comparison.md +208 -0
- package/docs/20260216-v02-plan.md +136 -0
- package/docs/20260216-v02-review.md +685 -0
- package/docs/20260217-dogfood-findings.md +56 -0
- package/docs/20260217-p2-plus-plan.md +117 -0
- package/docs/20260217-partial-fixes-plan.md +62 -0
- package/docs/20260217-plan-analyze-spec.md +117 -0
- package/docs/20260217-post-impl-review.md +1137 -0
- package/docs/20260217-quick-wins-plan.md +66 -0
- package/docs/20260217-split-runner-plan.md +75 -0
- package/docs/20260217-v03-impl-plan.md +80 -0
- package/docs/20260217-v03-post-impl-review.md +589 -0
- package/docs/20260217-v04-impl-plan.md +86 -0
- package/docs/20260217-v05-post-impl-review.md +850 -0
- package/docs/20260217-v06-post-impl-review.md +817 -0
- package/docs/20260218-adr003-port-plan.md +151 -0
- package/docs/20260218-review-adr003-verification.md +175 -0
- package/docs/20260219-fix-plan-bug16-19.md +79 -0
- package/docs/20260219-fix-plan-bug20-22.md +114 -0
- package/docs/20260219-plan-llm-routing.md +116 -0
- package/docs/20260219-review-bug20-22-fixes.md +135 -0
- package/docs/20260219-routing-baseline-keyword.md +63 -0
- package/docs/20260220-plan-structured-logging-p1.md +80 -0
- package/docs/20260220-plan-structured-logging-p2.md +37 -0
- package/docs/20260220-review-llm-routing.md +180 -0
- package/docs/20260220-review-post-fix-llm-routing.md +70 -0
- package/docs/20260221-fix-plan-relevantfiles-split.md +101 -0
- package/docs/20260221-fix-plan-routing-mode.md +125 -0
- package/docs/20260221-review-v0.9-implementation.md +379 -0
- package/docs/20260222-fix-plan-v091-routing-isolation.md +197 -0
- package/docs/20260223-fix-plan-prompt-audit.md +62 -0
- package/docs/20260224-nax-roadmap-phases.md +189 -0
- package/docs/20260225-phase2-llm-service-layer.md +401 -0
- package/docs/20260225-review-v0.10.1.md +187 -0
- package/docs/20260303-v010-implementation-plan.md +165 -0
- package/docs/CLAUDE.md.bak +191 -0
- package/docs/ROADMAP.md +165 -0
- package/docs/SPEC-rectification.md +0 -0
- package/docs/SPEC.md +324 -0
- package/docs/US-001-plugin-loading-verification.md +152 -0
- package/docs/architecture-analysis.md +1076 -0
- package/docs/bugs/BUG-21-escalation-null-attempts.md +48 -0
- package/docs/bugs-from-dogfood-run-c.md +243 -0
- package/docs/code-review-20260228.md +612 -0
- package/docs/code-review-v0.15.0.md +629 -0
- package/docs/hook-lifecycle-test-plan.md +149 -0
- package/docs/releases/v0.11.0-and-earlier.md +20 -0
- package/docs/releases/v0.12.0.md +15 -0
- package/docs/releases/v0.13.0.md +14 -0
- package/docs/releases/v0.14.0.md +20 -0
- package/docs/releases/v0.14.1.md +36 -0
- package/docs/releases/v0.14.2.md +51 -0
- package/docs/releases/v0.14.3.md +174 -0
- package/docs/releases/v0.14.4.md +94 -0
- package/docs/releases/v0.15.0.md +502 -0
- package/docs/releases/v0.15.1.md +170 -0
- package/docs/releases/v0.15.3.md +193 -0
- package/docs/specs/status-file-v0.10.1.md +812 -0
- package/docs/v0.10-global-config.md +206 -0
- package/docs/v0.10-plugin-system.md +415 -0
- package/docs/v0.10-prompt-optimizer.md +234 -0
- package/docs/v0.3-spec.md +244 -0
- package/docs/v0.4-spec.md +140 -0
- package/docs/v0.5-spec.md +237 -0
- package/docs/v0.6-spec.md +371 -0
- package/docs/v0.7-spec.md +177 -0
- package/docs/v0.8-llm-routing.md +206 -0
- package/docs/v0.8-structured-logging.md +132 -0
- package/docs/v0.9.3-prompt-audit.md +112 -0
- package/examples/plugins/console-reporter/index.test.ts +207 -0
- package/examples/plugins/console-reporter/index.ts +110 -0
- package/nax/config.json +147 -0
- package/nax/features/bugfix-v0171/prd.json +52 -0
- package/nax/features/config-management/prd.json +108 -0
- package/nax/features/config-management/progress.txt +5 -0
- package/nax/features/diagnose/acceptance.test.ts +412 -0
- package/nax/features/diagnose/prd.json +41 -0
- package/nax/features/orchestration-fixes/prd.json +89 -0
- package/nax/features/orchestration-fixes/progress.txt +1 -0
- package/nax/features/plugin-integration/US-007-VERIFICATION.md +259 -0
- package/nax/features/plugin-integration/prd.json +208 -0
- package/nax/features/plugin-integration/progress.txt +5 -0
- package/nax/features/precheck/prd.json +205 -0
- package/nax/features/precheck/progress.txt +15 -0
- package/nax/features/structured-logging/prd.json +199 -0
- package/nax/features/unlock/prd.json +36 -0
- package/package.json +47 -0
- package/src/acceptance/fix-generator.ts +348 -0
- package/src/acceptance/generator.ts +282 -0
- package/src/acceptance/index.ts +30 -0
- package/src/acceptance/types.ts +79 -0
- package/src/agents/claude-decompose.ts +169 -0
- package/src/agents/claude-plan.ts +139 -0
- package/src/agents/claude.ts +324 -0
- package/src/agents/cost.ts +268 -0
- package/src/agents/index.ts +13 -0
- package/src/agents/registry.ts +48 -0
- package/src/agents/types-extended.ts +133 -0
- package/src/agents/types.ts +113 -0
- package/src/agents/validation.ts +69 -0
- package/src/analyze/classifier.ts +305 -0
- package/src/analyze/index.ts +16 -0
- package/src/analyze/scanner.ts +175 -0
- package/src/analyze/types.ts +51 -0
- package/src/cli/accept.ts +108 -0
- package/src/cli/analyze-parser.ts +284 -0
- package/src/cli/analyze.ts +207 -0
- package/src/cli/config.ts +561 -0
- package/src/cli/constitution.ts +109 -0
- package/src/cli/diagnose-analysis.ts +159 -0
- package/src/cli/diagnose-formatter.ts +87 -0
- package/src/cli/diagnose.ts +203 -0
- package/src/cli/generate.ts +127 -0
- package/src/cli/index.ts +37 -0
- package/src/cli/init.ts +188 -0
- package/src/cli/interact.ts +295 -0
- package/src/cli/plan.ts +198 -0
- package/src/cli/plugins.ts +111 -0
- package/src/cli/prompts.ts +295 -0
- package/src/cli/runs.ts +174 -0
- package/src/cli/status-cost.ts +151 -0
- package/src/cli/status-features.ts +338 -0
- package/src/cli/status.ts +13 -0
- package/src/commands/common.ts +171 -0
- package/src/commands/diagnose.ts +17 -0
- package/src/commands/index.ts +8 -0
- package/src/commands/logs.ts +384 -0
- package/src/commands/precheck.ts +86 -0
- package/src/commands/unlock.ts +96 -0
- package/src/config/defaults.ts +160 -0
- package/src/config/index.ts +22 -0
- package/src/config/loader.ts +121 -0
- package/src/config/merger.ts +147 -0
- package/src/config/path-security.ts +121 -0
- package/src/config/paths.ts +27 -0
- package/src/config/schema.ts +56 -0
- package/src/config/schemas.ts +286 -0
- package/src/config/types.ts +423 -0
- package/src/config/validate.ts +103 -0
- package/src/constitution/generator.ts +191 -0
- package/src/constitution/generators/aider.ts +41 -0
- package/src/constitution/generators/claude.ts +35 -0
- package/src/constitution/generators/cursor.ts +36 -0
- package/src/constitution/generators/opencode.ts +38 -0
- package/src/constitution/generators/types.ts +33 -0
- package/src/constitution/generators/windsurf.ts +36 -0
- package/src/constitution/index.ts +10 -0
- package/src/constitution/loader.ts +133 -0
- package/src/constitution/types.ts +31 -0
- package/src/context/auto-detect.ts +227 -0
- package/src/context/builder.ts +246 -0
- package/src/context/elements.ts +83 -0
- package/src/context/formatter.ts +107 -0
- package/src/context/generator.ts +129 -0
- package/src/context/generators/aider.ts +34 -0
- package/src/context/generators/claude.ts +28 -0
- package/src/context/generators/cursor.ts +28 -0
- package/src/context/generators/opencode.ts +30 -0
- package/src/context/generators/windsurf.ts +28 -0
- package/src/context/greenfield.ts +114 -0
- package/src/context/index.ts +33 -0
- package/src/context/injector.ts +279 -0
- package/src/context/test-scanner.ts +370 -0
- package/src/context/types.ts +98 -0
- package/src/errors.ts +67 -0
- package/src/execution/batching.ts +157 -0
- package/src/execution/crash-recovery.ts +373 -0
- package/src/execution/escalation/escalation.ts +44 -0
- package/src/execution/escalation/index.ts +13 -0
- package/src/execution/escalation/tier-escalation.ts +295 -0
- package/src/execution/escalation/tier-outcome.ts +158 -0
- package/src/execution/helpers.ts +38 -0
- package/src/execution/index.ts +45 -0
- package/src/execution/lifecycle/acceptance-loop.ts +272 -0
- package/src/execution/lifecycle/headless-formatter.ts +85 -0
- package/src/execution/lifecycle/index.ts +12 -0
- package/src/execution/lifecycle/parallel-lifecycle.ts +101 -0
- package/src/execution/lifecycle/precheck-runner.ts +140 -0
- package/src/execution/lifecycle/run-cleanup.ts +81 -0
- package/src/execution/lifecycle/run-completion.ts +129 -0
- package/src/execution/lifecycle/run-initialization.ts +141 -0
- package/src/execution/lifecycle/run-lifecycle.ts +312 -0
- package/src/execution/lifecycle/run-setup.ts +204 -0
- package/src/execution/lifecycle/story-hooks.ts +38 -0
- package/src/execution/lifecycle/story-size-prompts.ts +123 -0
- package/src/execution/lock.ts +115 -0
- package/src/execution/parallel-executor.ts +216 -0
- package/src/execution/parallel.ts +400 -0
- package/src/execution/pid-registry.ts +280 -0
- package/src/execution/pipeline-result-handler.ts +388 -0
- package/src/execution/post-verify-rectification.ts +188 -0
- package/src/execution/post-verify.ts +274 -0
- package/src/execution/progress.ts +25 -0
- package/src/execution/prompts.ts +127 -0
- package/src/execution/queue-handler.ts +109 -0
- package/src/execution/rectification.ts +13 -0
- package/src/execution/runner.ts +377 -0
- package/src/execution/sequential-executor.ts +388 -0
- package/src/execution/status-file.ts +264 -0
- package/src/execution/status-writer.ts +139 -0
- package/src/execution/story-context.ts +229 -0
- package/src/execution/test-output-parser.ts +14 -0
- package/src/execution/verification.ts +72 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/runner.ts +286 -0
- package/src/hooks/types.ts +67 -0
- package/src/interaction/chain.ts +154 -0
- package/src/interaction/index.ts +60 -0
- package/src/interaction/init.ts +83 -0
- package/src/interaction/plugins/auto.ts +217 -0
- package/src/interaction/plugins/cli.ts +300 -0
- package/src/interaction/plugins/telegram.ts +384 -0
- package/src/interaction/plugins/webhook.ts +258 -0
- package/src/interaction/state.ts +171 -0
- package/src/interaction/triggers.ts +229 -0
- package/src/interaction/types.ts +163 -0
- package/src/logger/formatters.ts +84 -0
- package/src/logger/index.ts +16 -0
- package/src/logger/logger.ts +298 -0
- package/src/logger/types.ts +48 -0
- package/src/logging/formatter.ts +355 -0
- package/src/logging/index.ts +22 -0
- package/src/logging/types.ts +93 -0
- package/src/metrics/aggregator.ts +190 -0
- package/src/metrics/index.ts +14 -0
- package/src/metrics/tracker.ts +200 -0
- package/src/metrics/types.ts +109 -0
- package/src/optimizer/index.ts +62 -0
- package/src/optimizer/noop.optimizer.ts +24 -0
- package/src/optimizer/rule-based.optimizer.ts +248 -0
- package/src/optimizer/types.ts +53 -0
- package/src/pipeline/events.ts +130 -0
- package/src/pipeline/index.ts +19 -0
- package/src/pipeline/runner.ts +161 -0
- package/src/pipeline/stages/acceptance.ts +197 -0
- package/src/pipeline/stages/completion.ts +99 -0
- package/src/pipeline/stages/constitution.ts +63 -0
- package/src/pipeline/stages/context.ts +117 -0
- package/src/pipeline/stages/execution.ts +194 -0
- package/src/pipeline/stages/index.ts +62 -0
- package/src/pipeline/stages/optimizer.ts +74 -0
- package/src/pipeline/stages/prompt.ts +57 -0
- package/src/pipeline/stages/queue-check.ts +103 -0
- package/src/pipeline/stages/review.ts +181 -0
- package/src/pipeline/stages/routing.ts +81 -0
- package/src/pipeline/stages/verify.ts +100 -0
- package/src/pipeline/types.ts +167 -0
- package/src/plugins/index.ts +31 -0
- package/src/plugins/loader.ts +287 -0
- package/src/plugins/registry.ts +168 -0
- package/src/plugins/types.ts +327 -0
- package/src/plugins/validator.ts +352 -0
- package/src/prd/index.ts +172 -0
- package/src/prd/types.ts +202 -0
- package/src/precheck/checks-blockers.ts +391 -0
- package/src/precheck/checks-warnings.ts +142 -0
- package/src/precheck/checks.ts +30 -0
- package/src/precheck/index.ts +247 -0
- package/src/precheck/story-size-gate.ts +144 -0
- package/src/precheck/types.ts +31 -0
- package/src/queue/index.ts +2 -0
- package/src/queue/manager.ts +254 -0
- package/src/queue/types.ts +54 -0
- package/src/review/index.ts +8 -0
- package/src/review/runner.ts +172 -0
- package/src/review/types.ts +66 -0
- package/src/routing/builder.ts +81 -0
- package/src/routing/chain.ts +74 -0
- package/src/routing/index.ts +16 -0
- package/src/routing/loader.ts +58 -0
- package/src/routing/router.ts +303 -0
- package/src/routing/strategies/adaptive.ts +215 -0
- package/src/routing/strategies/index.ts +8 -0
- package/src/routing/strategies/keyword.ts +163 -0
- package/src/routing/strategies/llm-prompts.ts +209 -0
- package/src/routing/strategies/llm.ts +235 -0
- package/src/routing/strategies/manual.ts +50 -0
- package/src/routing/strategy.ts +99 -0
- package/src/tdd/cleanup.ts +111 -0
- package/src/tdd/index.ts +23 -0
- package/src/tdd/isolation.ts +123 -0
- package/src/tdd/orchestrator.ts +383 -0
- package/src/tdd/prompts.ts +270 -0
- package/src/tdd/rectification-gate.ts +183 -0
- package/src/tdd/session-runner.ts +179 -0
- package/src/tdd/types.ts +81 -0
- package/src/tdd/verdict.ts +271 -0
- package/src/tui/App.tsx +265 -0
- package/src/tui/components/AgentPanel.tsx +75 -0
- package/src/tui/components/CostOverlay.tsx +118 -0
- package/src/tui/components/HelpOverlay.tsx +107 -0
- package/src/tui/components/StatusBar.tsx +63 -0
- package/src/tui/components/StoriesPanel.tsx +177 -0
- package/src/tui/hooks/useKeyboard.ts +142 -0
- package/src/tui/hooks/useLayout.ts +137 -0
- package/src/tui/hooks/usePipelineEvents.ts +183 -0
- package/src/tui/hooks/usePty.ts +194 -0
- package/src/tui/index.tsx +38 -0
- package/src/tui/types.ts +76 -0
- package/src/utils/git.ts +83 -0
- package/src/utils/queue-writer.ts +54 -0
- package/src/verification/executor.ts +235 -0
- package/src/verification/gate.ts +207 -0
- package/src/verification/index.ts +12 -0
- package/src/verification/parser.ts +230 -0
- package/src/verification/rectification.ts +108 -0
- package/src/verification/types.ts +113 -0
- package/src/worktree/dispatcher.ts +65 -0
- package/src/worktree/index.ts +2 -0
- package/src/worktree/manager.ts +187 -0
- package/src/worktree/merge.ts +301 -0
- package/src/worktree/types.ts +4 -0
- package/test/TEST_COVERAGE_US001.md +217 -0
- package/test/TEST_COVERAGE_US003.md +84 -0
- package/test/TEST_COVERAGE_US005.md +86 -0
- package/test/US-002-orchestrator.test.ts +246 -0
- package/test/acceptance/cm-003-default-view.test.ts +194 -0
- package/test/execution/pid-registry.test.ts +240 -0
- package/test/execution/post-verify.test.ts +224 -0
- package/test/helpers/timeout.ts +42 -0
- package/test/integration/US-002-TEST-SUMMARY.md +107 -0
- package/test/integration/US-003-TEST-SUMMARY.md +149 -0
- package/test/integration/US-004-TEST-SUMMARY.md +106 -0
- package/test/integration/US-005-TEST-SUMMARY.md +138 -0
- package/test/integration/US-007-TEST-SUMMARY.md +100 -0
- package/test/integration/agent-validation.test.ts +439 -0
- package/test/integration/analyze-integration.test.ts +261 -0
- package/test/integration/analyze-scanner.test.ts +131 -0
- package/test/integration/cli-config-default-edge-cases.test.ts +222 -0
- package/test/integration/cli-config-default-view.test.ts +229 -0
- package/test/integration/cli-config-diff.test.ts +460 -0
- package/test/integration/cli-config.test.ts +736 -0
- package/test/integration/cli-diagnose.test.ts +592 -0
- package/test/integration/cli-logs.test.ts +314 -0
- package/test/integration/cli-plugins.test.ts +678 -0
- package/test/integration/cli-precheck.test.ts +371 -0
- package/test/integration/cli-run-headless.test.ts +173 -0
- package/test/integration/cli.test.ts +75 -0
- package/test/integration/config/merger.test.ts +465 -0
- package/test/integration/config/paths.test.ts +51 -0
- package/test/integration/config-loader.test.ts +265 -0
- package/test/integration/config.test.ts +444 -0
- package/test/integration/context-integration.test.ts +702 -0
- package/test/integration/context-provider-injection.test.ts +506 -0
- package/test/integration/context-verification-integration.test.ts +295 -0
- package/test/integration/e2e.test.ts +896 -0
- package/test/integration/execution.test.ts +625 -0
- package/test/integration/helpers.test.ts +295 -0
- package/test/integration/hooks.test.ts +361 -0
- package/test/integration/interaction-chain-pipeline.test.ts +464 -0
- package/test/integration/isolation.test.ts +143 -0
- package/test/integration/logger.test.ts +461 -0
- package/test/integration/parallel.test.ts +250 -0
- package/test/integration/path-security.test.ts +173 -0
- package/test/integration/pipeline-acceptance.test.ts +302 -0
- package/test/integration/pipeline-events.test.ts +475 -0
- package/test/integration/pipeline.test.ts +658 -0
- package/test/integration/plan.test.ts +157 -0
- package/test/integration/plugin-routing.test.ts +921 -0
- package/test/integration/plugins/config-integration.test.ts +172 -0
- package/test/integration/plugins/config-resolution.test.ts +522 -0
- package/test/integration/plugins/loader.test.ts +641 -0
- package/test/integration/plugins/registry.test.ts +746 -0
- package/test/integration/plugins/validator.test.ts +563 -0
- package/test/integration/prd-pause.test.ts +205 -0
- package/test/integration/prd-resolvers.test.ts +185 -0
- package/test/integration/precheck-integration.test.ts +468 -0
- package/test/integration/precheck.test.ts +805 -0
- package/test/integration/progress.test.ts +34 -0
- package/test/integration/rectification-flow.test.ts +512 -0
- package/test/integration/reporter-lifecycle.test.ts +860 -0
- package/test/integration/review-config-commands.test.ts +319 -0
- package/test/integration/review-config-schema.test.ts +116 -0
- package/test/integration/review-plugin-integration.test.ts +722 -0
- package/test/integration/review.test.ts +149 -0
- package/test/integration/routing-stage-bug-021.test.ts +274 -0
- package/test/integration/routing-stage-greenfield.test.ts +286 -0
- package/test/integration/runner-config-plugins.test.ts +461 -0
- package/test/integration/runner-fixes.test.ts +399 -0
- package/test/integration/runner-plugin-integration.test.ts +543 -0
- package/test/integration/runner.test.ts +1679 -0
- package/test/integration/s5-greenfield-fallback.test.ts +297 -0
- package/test/integration/status-file-integration.test.ts +325 -0
- package/test/integration/status-file.test.ts +379 -0
- package/test/integration/status-writer.test.ts +345 -0
- package/test/integration/story-id-in-events.test.ts +273 -0
- package/test/integration/tdd-cleanup.test.ts +246 -0
- package/test/integration/tdd-orchestrator.test.ts +1762 -0
- package/test/integration/test-scanner.test.ts +403 -0
- package/test/integration/verification-asset-check.test.ts +142 -0
- package/test/integration/verify-stage.test.ts +275 -0
- package/test/integration/worktree/manager.test.ts +218 -0
- package/test/integration/worktree/merge.test.ts +341 -0
- package/test/manual/logging-formatter-demo.ts +158 -0
- package/test/ui/tui-agent-panel.test.tsx +99 -0
- package/test/ui/tui-controls.test.ts +334 -0
- package/test/ui/tui-cost-and-pty.test.ts +189 -0
- package/test/ui/tui-layout.test.ts +378 -0
- package/test/ui/tui-pty-integration.test.tsx +159 -0
- package/test/ui/tui-stories.test.ts +332 -0
- package/test/unit/acceptance.test.ts +186 -0
- package/test/unit/agent-stderr-capture.test.ts +146 -0
- package/test/unit/analyze-classifier.test.ts +215 -0
- package/test/unit/analyze.test.ts +224 -0
- package/test/unit/auto-detect.test.ts +249 -0
- package/test/unit/cli-status.test.ts +417 -0
- package/test/unit/commands/common.test.ts +320 -0
- package/test/unit/commands/logs.test.ts +416 -0
- package/test/unit/commands/unlock.test.ts +319 -0
- package/test/unit/constitution-generators.test.ts +160 -0
- package/test/unit/constitution.test.ts +209 -0
- package/test/unit/context.test.ts +1722 -0
- package/test/unit/cost.test.ts +231 -0
- package/test/unit/crash-recovery.test.ts +308 -0
- package/test/unit/escalation.test.ts +126 -0
- package/test/unit/execution-logging-stderr.test.ts +156 -0
- package/test/unit/execution-stage.test.ts +122 -0
- package/test/unit/fix-generator.test.ts +275 -0
- package/test/unit/formatters.test.ts +469 -0
- package/test/unit/greenfield.test.ts +179 -0
- package/test/unit/helpers.test.ts +317 -0
- package/test/unit/interaction/human-review-trigger.test.ts +164 -0
- package/test/unit/interaction-network-failures.test.ts +389 -0
- package/test/unit/interaction-plugins.test.ts +164 -0
- package/test/unit/isolation.test.ts +134 -0
- package/test/unit/logging/formatter.test.ts +455 -0
- package/test/unit/merge.test.ts +268 -0
- package/test/unit/metrics.test.ts +276 -0
- package/test/unit/optimizer/noop.optimizer.test.ts +125 -0
- package/test/unit/optimizer/rule-based.optimizer.test.ts +358 -0
- package/test/unit/prd-auto-default.test.ts +290 -0
- package/test/unit/prd-failure-category.test.ts +176 -0
- package/test/unit/prd-get-next-story.test.ts +186 -0
- package/test/unit/precheck-checks.test.ts +840 -0
- package/test/unit/precheck-story-size-gate.test.ts +287 -0
- package/test/unit/precheck-types.test.ts +142 -0
- package/test/unit/prompts.test.ts +475 -0
- package/test/unit/queue.test.ts +237 -0
- package/test/unit/rectification.test.ts +284 -0
- package/test/unit/registry.test.ts +287 -0
- package/test/unit/routing.test.ts +937 -0
- package/test/unit/run-lifecycle.test.ts +140 -0
- package/test/unit/storyid-events.test.ts +224 -0
- package/test/unit/tdd-verdict.test.ts +492 -0
- package/test/unit/test-output-parser.test.ts +377 -0
- package/test/unit/verdict.test.ts +324 -0
- package/test/unit/worktree-manager.test.ts +158 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# BUG-21: Escalation fails when PRD story has null/missing attempts field
|
|
2
|
+
|
|
3
|
+
**Severity:** High
|
|
4
|
+
**Component:** src/execution/runner.ts (escalation logic)
|
|
5
|
+
**Found:** 2026-02-23
|
|
6
|
+
**Status:** Open
|
|
7
|
+
|
|
8
|
+
## Summary
|
|
9
|
+
|
|
10
|
+
When a story attempts field is null or missing in the PRD, escalation breaks. The agent returns finalAction: escalate but the story is immediately marked as failed instead of being re-queued at a higher model tier.
|
|
11
|
+
|
|
12
|
+
## Reproduction
|
|
13
|
+
|
|
14
|
+
1. Create a PRD with stories that do NOT include an attempts field (or set it to null)
|
|
15
|
+
2. Run nax run -f feature --headless
|
|
16
|
+
3. When a story fails and returns finalAction: escalate, observe:
|
|
17
|
+
- Log shows Story failed - max attempts reached immediately
|
|
18
|
+
- No actual escalation to next tier occurs
|
|
19
|
+
- PRD shows attempts: null after the run
|
|
20
|
+
|
|
21
|
+
## Root Cause
|
|
22
|
+
|
|
23
|
+
The runner increments story.attempts via:
|
|
24
|
+
attempts: s.attempts + 1
|
|
25
|
+
But if s.attempts is null or undefined, this produces NaN, breaking subsequent comparisons.
|
|
26
|
+
|
|
27
|
+
Pre-iteration tier check (line ~338):
|
|
28
|
+
if (tierCfg && story.attempts >= tierCfg.attempts)
|
|
29
|
+
null >= 5 evaluates to false in JS, so this check is silently skipped.
|
|
30
|
+
|
|
31
|
+
Post-execution canEscalate check (line ~704):
|
|
32
|
+
const canEscalate = storiesToEscalate.every((s) => s.attempts < maxAttempts);
|
|
33
|
+
null < 10 is true in JS, so canEscalate is true. But then attempts: s.attempts + 1 yields null + 1 = 1.
|
|
34
|
+
The story still gets marked failed, suggesting the PRD save/reload cycle loses the updated value or the iteration loop exits before re-processing.
|
|
35
|
+
|
|
36
|
+
## Suggested Fix
|
|
37
|
+
|
|
38
|
+
1. Initialize attempts to 0 when loading PRD stories with null/undefined attempts
|
|
39
|
+
2. Defensive coercion: attempts: (s.attempts ?? 0) + 1
|
|
40
|
+
3. Add PRD validation on load to ensure all stories have attempts: number (default 0)
|
|
41
|
+
|
|
42
|
+
## Observed Log
|
|
43
|
+
|
|
44
|
+
[21:45:33] [execution] Agent session failed { rateLimited: false, storyId: US-002 }
|
|
45
|
+
[21:45:33] [agent.complete] { storyId: US-002, success: false, finalAction: escalate, estimatedCost: 0.75 }
|
|
46
|
+
[21:45:33] [execution] Story failed - max attempts reached { storyId: US-002 }
|
|
47
|
+
|
|
48
|
+
No escalation log line between finalAction: escalate and Story failed, confirming escalation path was skipped.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Bugs Found: Dogfood Run C (2026-02-19, plan→analyze→run pipeline)
|
|
2
|
+
|
|
3
|
+
## BUG-16: maxIterations is global, not per-story (CODE)
|
|
4
|
+
|
|
5
|
+
**Severity:** High — causes infinite loops on stuck stories
|
|
6
|
+
|
|
7
|
+
**Evidence:** Config had `maxIterations: 5` but nax ran **20 iterations**.
|
|
8
|
+
The main loop at `runner.ts:140` checks `iterations < config.execution.maxIterations`,
|
|
9
|
+
but the config value was overridden. Investigation shows the dogfood config had `maxIterations: 5`
|
|
10
|
+
but per the summary the run did 20 iterations.
|
|
11
|
+
|
|
12
|
+
**Root Cause:** `maxIterations` is a **global** cap across ALL stories, not per-story.
|
|
13
|
+
But the real issue is that the per-story attempt counter (`story.attempts`) doesn't cap the
|
|
14
|
+
story — only the escalation logic reads it. If escalation doesn't trigger (see BUG-17),
|
|
15
|
+
the story retries indefinitely until the global iteration limit.
|
|
16
|
+
|
|
17
|
+
**Expected Behavior:** Each story should respect the tier budget:
|
|
18
|
+
- Per-story max attempts = sum of `tierOrder` attempts (default: 5+3+2=10)
|
|
19
|
+
- After exhausting all tiers, mark story as FAILED and move to next story
|
|
20
|
+
- `maxIterations` should be an override safety cap, not the primary limit
|
|
21
|
+
|
|
22
|
+
**Fix Location:** `src/execution/runner.ts` — add per-story attempt check before retrying
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## BUG-17: ASSET_CHECK_FAILED doesn't trigger escalation (CODE)
|
|
27
|
+
|
|
28
|
+
**Severity:** High — story loops at same tier forever
|
|
29
|
+
|
|
30
|
+
**Evidence:** US-004 failed ASSET_CHECK 16 times, always at `balanced` tier.
|
|
31
|
+
Never escalated to `powerful` despite `countsTowardEscalation: true`.
|
|
32
|
+
|
|
33
|
+
**Root Cause:** The escalation logic lives in the `case "escalate"` handler
|
|
34
|
+
(`runner.ts:367`), but ASSET_CHECK failures flow through `post-verify.ts`
|
|
35
|
+
which only increments `story.attempts` and reverts to `pending`. It never
|
|
36
|
+
returns an `"escalate"` action to the runner — it just reverts the story.
|
|
37
|
+
|
|
38
|
+
The escalation check happens in runner.ts case "escalate" but the pipeline
|
|
39
|
+
never returns "escalate" for verification failures. The verify stage returns
|
|
40
|
+
"continue" (tests passed), then post-verify reverts on ASSET_CHECK but the
|
|
41
|
+
result is already "continue".
|
|
42
|
+
|
|
43
|
+
**Flow:**
|
|
44
|
+
```
|
|
45
|
+
1. Pipeline runs → verify stage → tests pass → "continue"
|
|
46
|
+
2. completion stage → marks story as passed
|
|
47
|
+
3. post-verify → ASSET_CHECK fails → reverts to pending, increments attempts
|
|
48
|
+
4. Runner sees "continue" from pipeline, never hits "escalate" case
|
|
49
|
+
5. Next iteration picks up story at SAME tier (no escalation)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Expected Behavior:** When `story.attempts` exceeds the current tier's budget,
|
|
53
|
+
the runner should check tier escalation BEFORE starting the next iteration,
|
|
54
|
+
not only in the `"escalate"` case handler.
|
|
55
|
+
|
|
56
|
+
**Fix Location:**
|
|
57
|
+
- `src/execution/runner.ts` — add tier check at start of iteration (before agent spawn)
|
|
58
|
+
- OR `src/execution/post-verify.ts` — escalate the story's `routing.modelTier` when attempts exceed tier budget
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## BUG-18: ASSET_CHECK error not fed back to agent prompt (CODE)
|
|
63
|
+
|
|
64
|
+
**Severity:** Medium — agent repeats same mistake endlessly
|
|
65
|
+
|
|
66
|
+
**Evidence:** All 17 retries of US-004 show the exact same warnings:
|
|
67
|
+
```
|
|
68
|
+
⚠️ Relevant file not found: src/finder.ts (story: US-004)
|
|
69
|
+
⚠️ Relevant file not found: test/finder.test.ts (story: US-004)
|
|
70
|
+
```
|
|
71
|
+
The agent kept writing to `src/discovery.ts` instead of `src/finder.ts`.
|
|
72
|
+
The ASSET_CHECK error is stored in `story.priorErrors` (post-verify.ts line 102),
|
|
73
|
+
but the "Prior Errors" section in the prompt only showed the initial ASSET_CHECK
|
|
74
|
+
message, not a clear instruction like "You MUST create src/finder.ts".
|
|
75
|
+
|
|
76
|
+
**Expected Behavior:** The ASSET_CHECK error should be prominent in the prompt,
|
|
77
|
+
ideally as a mandatory instruction: "REQUIRED: Create these files: src/finder.ts, test/finder.test.ts"
|
|
78
|
+
|
|
79
|
+
**Fix Location:** `src/pipeline/stages/prompt.ts` — format ASSET_CHECK errors as mandatory file creation instructions
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## BUG-19: Simple complexity routes to balanced tier, not fast (CODE)
|
|
84
|
+
|
|
85
|
+
**Severity:** Medium — wastes budget on wrong tier
|
|
86
|
+
|
|
87
|
+
**Evidence:** US-001 (simple) and US-004 (simple) both show:
|
|
88
|
+
```
|
|
89
|
+
Complexity: simple | Model: balanced | TDD: test-after
|
|
90
|
+
Routing: test-after: simple task (medium)
|
|
91
|
+
```
|
|
92
|
+
Should start at `fast` (Haiku) per `complexityRouting.simple: "fast"`.
|
|
93
|
+
|
|
94
|
+
**Root Cause:** The routing display shows `(medium)` suggesting the actual
|
|
95
|
+
routed tier is `medium`/`balanced`, not the expected `fast`. Likely the
|
|
96
|
+
routing stage is using test strategy routing instead of complexity routing,
|
|
97
|
+
or there's a fallback that overrides the tier.
|
|
98
|
+
|
|
99
|
+
**Fix Location:** `src/pipeline/stages/routing.ts` or equivalent — check why
|
|
100
|
+
simple stories get routed to balanced instead of fast.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Test Coverage Gaps
|
|
105
|
+
|
|
106
|
+
### Existing (35 tests in runner.test.ts)
|
|
107
|
+
- ✅ Batch prompt building (3 tests)
|
|
108
|
+
- ✅ Batch grouping (8 tests)
|
|
109
|
+
- ✅ Batch precompute (5 tests)
|
|
110
|
+
- ✅ Batch failure escalation (3 tests)
|
|
111
|
+
- ✅ Queue commands (6 tests)
|
|
112
|
+
- ✅ Escalation chain (7 tests)
|
|
113
|
+
- ✅ Hook security/loading/env (19 tests in hooks.test.ts)
|
|
114
|
+
|
|
115
|
+
### Missing (needed to prevent BUG-16–19)
|
|
116
|
+
- ❌ **Per-story iteration capping** — story should fail after tier budget exhausted
|
|
117
|
+
- ❌ **ASSET_CHECK → escalation trigger** — post-verify failure should escalate tier
|
|
118
|
+
- ❌ **ASSET_CHECK error in prompt** — verify mandatory files appear in next prompt
|
|
119
|
+
- ❌ **Complexity → tier routing accuracy** — simple=fast, medium=balanced, complex=powerful
|
|
120
|
+
- ❌ **Post-verify revert + re-queue** — story reverted correctly after ASSET_CHECK
|
|
121
|
+
- ❌ **End-to-end: story passes on retry after escalation** — integration test
|
|
122
|
+
- ❌ **End-to-end: story fails permanently after all tiers exhausted** — integration test
|
|
123
|
+
- ❌ **Verification unit tests** — no `test/verification.test.ts` exists
|
|
124
|
+
- ❌ **Post-verify unit tests** — no `test/post-verify.test.ts` exists
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
*Filed 2026-02-19 from dogfood run C (plan→analyze→run pipeline test)*
|
|
129
|
+
|
|
130
|
+
## BUG-21: No model name validation before run (CONFIG)
|
|
131
|
+
|
|
132
|
+
**Severity:** Medium — causes silent failures, wasted retries
|
|
133
|
+
|
|
134
|
+
**Evidence:** Dogfood Run D — `claude-opus-4` not recognized by Claude Code CLI.
|
|
135
|
+
Agent exited with error message but exit code 0 on some attempts, exit code 1 on others.
|
|
136
|
+
TDD test-writer session ran 3 times producing nothing. Wasted ~$0.13 and 3 minutes.
|
|
137
|
+
|
|
138
|
+
**Root Cause:** No validation of model names in config against the agent's accepted models.
|
|
139
|
+
`claude-opus-4` is not a valid Claude Code model name (`claude-opus-4-5` or `opus` alias is).
|
|
140
|
+
|
|
141
|
+
**Expected Behavior:** Before starting a run, validate that all configured model names
|
|
142
|
+
are accepted by the target agent. Fail fast with a clear error message.
|
|
143
|
+
|
|
144
|
+
**Future Design:** When supporting multiple code agents (Claude, Cursor, Copilot, etc.),
|
|
145
|
+
each agent adapter should expose a `validateModel(name: string)` method or provide
|
|
146
|
+
a model registry. Worst case: maintain a `models.json` per provider.
|
|
147
|
+
|
|
148
|
+
**Workaround:** Use CLI aliases (`haiku`, `sonnet`, `opus`) which always resolve to latest.
|
|
149
|
+
|
|
150
|
+
**Fix Location:** `src/config/validate.ts` — add model validation step.
|
|
151
|
+
Agent adapter interface: add optional `getSupportedModels()` or `validateModel()`.
|
|
152
|
+
|
|
153
|
+
**Priority:** Low — workaround available (use aliases)
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## BUG-21: Claude Code child processes orphaned after TDD session failure
|
|
158
|
+
|
|
159
|
+
**Found:** Run D, US-007 TDD test-writer failure (2026-02-19 20:11)
|
|
160
|
+
**Severity:** Medium (resource leak, CPU waste)
|
|
161
|
+
**Component:** `src/tdd/orchestrator.ts` / `src/agents/claude-adapter.ts`
|
|
162
|
+
|
|
163
|
+
### Symptoms
|
|
164
|
+
- `bun test` (PID 76312) running at 99.9% CPU for 2+ hours after Run D completed
|
|
165
|
+
- Process orphaned (PPID=1), original parent (PGID leader 76309) dead
|
|
166
|
+
- Sibling `tail -5` (PID 76313) also orphaned, plus a zombie child (PID 76555)
|
|
167
|
+
- Pipeline: `bun test 2>&1 | tail -5` — spawned by Claude Code internally during TDD test-writer session
|
|
168
|
+
|
|
169
|
+
### Root Cause
|
|
170
|
+
When Claude Code exits with code 1 (TDD session failure), it does NOT clean up shell commands it spawned internally. nax kills the Claude Code process via the agent adapter, but Claude Code's child processes (`bun test | tail -5`) are in a different process group (PGID 76309 vs Claude Code's own PID).
|
|
171
|
+
|
|
172
|
+
nax's `executeWithTimeout()` in `verification.ts` properly kills process groups for commands IT spawns, but TDD session child processes are spawned by Claude Code, not by nax.
|
|
173
|
+
|
|
174
|
+
### Process Tree at Failure
|
|
175
|
+
```
|
|
176
|
+
launchd (1)
|
|
177
|
+
├── bun test (76312) ← orphaned, 99.9% CPU, PGID 76309
|
|
178
|
+
├── tail -5 (76313) ← orphaned, sleeping, PGID 76309
|
|
179
|
+
└── <defunct> (76555) ← zombie child of 76312
|
|
180
|
+
```
|
|
181
|
+
Original PGID leader (76309) is dead — likely the shell Claude Code spawned.
|
|
182
|
+
|
|
183
|
+
### Fix Options
|
|
184
|
+
1. **nax-side (recommended):** After agent adapter returns failure, run `pkill -P <agent_pid>` recursively or `kill -- -<pgid>` to clean up the entire process tree. Add a `cleanupProcessTree(pid)` utility.
|
|
185
|
+
2. **nax-side (belt+suspenders):** Track all child PIDs before/after TDD session via `pgrep -P`, kill any new orphans.
|
|
186
|
+
3. **Upstream (Claude Code):** File issue — Claude Code should clean up child processes on abnormal exit.
|
|
187
|
+
|
|
188
|
+
### Affected Code
|
|
189
|
+
- `src/tdd/orchestrator.ts` — `runTddSession()` calls agent adapter but doesn't clean up process tree on failure
|
|
190
|
+
- `src/agents/claude-adapter.ts` — `runSession()` kills Claude Code process but not its children
|
|
191
|
+
|
|
192
|
+
### Workaround
|
|
193
|
+
Manually kill orphaned processes: `kill -9 -76309` (kill entire PGID)
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## BUG-22: TDD orchestrator treats verifier fix-and-commit as failure
|
|
198
|
+
|
|
199
|
+
**Found:** Run D2, US-009 (2026-02-19 22:23)
|
|
200
|
+
**Severity:** Medium (false positive pause, wastes human review time)
|
|
201
|
+
**Component:** `src/tdd/orchestrator.ts`
|
|
202
|
+
|
|
203
|
+
### Symptoms
|
|
204
|
+
- US-009 verifier session fixed flaky watcher tests (sleep timing) and added README.md
|
|
205
|
+
- All 355 tests pass, 98.7% coverage, clean commit `9f9b048`
|
|
206
|
+
- nax paused with "Verifier session identified issues" requiring human review
|
|
207
|
+
- No actual issues — the work is complete and correct
|
|
208
|
+
|
|
209
|
+
### Root Cause
|
|
210
|
+
`runThreeSessionTdd()` line 387:
|
|
211
|
+
```typescript
|
|
212
|
+
const allSuccessful = sessions.every((s) => s.success);
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`session.success` is derived from the Claude Code agent's **exit code**, not the final test state. The verifier likely:
|
|
216
|
+
1. Ran `bun test` → some tests failed (flaky watcher timing)
|
|
217
|
+
2. Fixed the tests (increased sleep timers)
|
|
218
|
+
3. Ran `bun test` again → 355 pass
|
|
219
|
+
4. Committed the fix
|
|
220
|
+
5. But Claude Code exited with code 1 (possibly from the initial failed test run, or from an internal error during the long session)
|
|
221
|
+
|
|
222
|
+
The orchestrator checks `sessions.every(s => s.success)` which uses exit code, not actual test outcomes. A verifier that **finds and fixes issues is doing its job** — that's a success, not a failure.
|
|
223
|
+
|
|
224
|
+
### Fix Options
|
|
225
|
+
1. **Post-TDD verification (recommended):** After all 3 sessions complete, run `bun test` independently. If tests pass → mark success regardless of individual session exit codes.
|
|
226
|
+
2. **Verifier exit code tolerance:** If verifier session has commits AND tests pass (checked via isolation), treat as success even with non-zero exit.
|
|
227
|
+
3. **Two-phase verifier:** Split verifier into "check" (run tests, report) and "fix" (apply fixes). Only flag if "fix" also fails.
|
|
228
|
+
|
|
229
|
+
### Evidence
|
|
230
|
+
```
|
|
231
|
+
git log -1: "fix: verify and adjust Comprehensive integration tests and documentation"
|
|
232
|
+
- 355 tests pass, 0 fail
|
|
233
|
+
- 98.70% function coverage, 95.52% line coverage
|
|
234
|
+
- Files changed: README.md (+261), test/integration.test.ts (+7/-7)
|
|
235
|
+
|
|
236
|
+
nax output: "⏸ Human review needed: Verifier session identified issues"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Impact
|
|
240
|
+
- False pause blocks automated pipeline completion
|
|
241
|
+
- Human must manually verify and resume — defeats automation purpose
|
|
242
|
+
- Cost: $4.95 spent on US-009, then paused on a success
|
|
243
|
+
- Combined with misrouting (US-009 shouldn't have been TDD), this story cost ~$5 for ~$0.15 of actual work
|