gsd-pi 2.82.0-dev.ed17d078d → 3.0.0-dev.8b8d129d7
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/README.md +93 -18
- package/dist/cli.js +20 -9
- package/dist/headless.js +9 -2
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +10 -1
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +44 -6
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +110 -37
- package/dist/resources/extensions/gsd/auto/orchestrator.js +12 -1
- package/dist/resources/extensions/gsd/auto/phases.js +97 -38
- package/dist/resources/extensions/gsd/auto/session.js +6 -0
- package/dist/resources/extensions/gsd/auto/workflow-kernel.js +3 -0
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +66 -1
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +1 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +20 -19
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +278 -137
- package/dist/resources/extensions/gsd/auto-prompts.js +36 -10
- package/dist/resources/extensions/gsd/auto-recovery.js +79 -14
- package/dist/resources/extensions/gsd/auto-start.js +87 -14
- package/dist/resources/extensions/gsd/auto-timers.js +11 -3
- package/dist/resources/extensions/gsd/auto-verification.js +102 -34
- package/dist/resources/extensions/gsd/auto-worktree.js +178 -11
- package/dist/resources/extensions/gsd/auto.js +98 -54
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +31 -7
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +10 -9
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +5 -4
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +24 -9
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +10 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +38 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +20 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +2 -0
- package/dist/resources/extensions/gsd/commands-mcp-status.js +9 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +7 -2
- package/dist/resources/extensions/gsd/commands-verdict.js +139 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +43 -5
- package/dist/resources/extensions/gsd/db/milestone-leases.js +24 -0
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/db-base-schema.js +2 -0
- package/dist/resources/extensions/gsd/db-migration-steps.js +4 -0
- package/dist/resources/extensions/gsd/db-task-slice-rows.js +2 -0
- package/dist/resources/extensions/gsd/dispatch-guard.js +46 -2
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +8 -0
- package/dist/resources/extensions/gsd/doctor-git-checks.js +46 -1
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
- package/dist/resources/extensions/gsd/doctor.js +2 -28
- package/dist/resources/extensions/gsd/export-html.js +27 -425
- package/dist/resources/extensions/gsd/forensics.js +8 -3
- package/dist/resources/extensions/gsd/git-service.js +138 -10
- package/dist/resources/extensions/gsd/gsd-db.js +76 -33
- package/dist/resources/extensions/gsd/guided-flow-queue.js +4 -3
- package/dist/resources/extensions/gsd/guided-flow.js +110 -117
- package/dist/resources/extensions/gsd/guided-unit-context.js +23 -0
- package/dist/resources/extensions/gsd/init-wizard.js +17 -2
- package/dist/resources/extensions/gsd/markdown-renderer.js +10 -8
- package/dist/resources/extensions/gsd/mcp-filter.js +58 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +57 -14
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -0
- package/dist/resources/extensions/gsd/paths.js +4 -0
- package/dist/resources/extensions/gsd/pending-auto-start.js +52 -0
- package/dist/resources/extensions/gsd/planning-path-scope.js +9 -3
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -9
- package/dist/resources/extensions/gsd/pre-execution-checks.js +38 -11
- package/dist/resources/extensions/gsd/preferences-mcp.js +19 -0
- package/dist/resources/extensions/gsd/preferences-types.js +2 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +138 -0
- package/dist/resources/extensions/gsd/preferences.js +2 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/dist/resources/extensions/gsd/prompts/forensics.md +3 -3
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
- package/dist/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +30 -13
- package/dist/resources/extensions/gsd/repository-registry.js +44 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +2 -0
- package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +42 -18
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +59 -2
- package/dist/resources/extensions/gsd/smart-entry-routing.js +36 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
- package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
- package/dist/resources/extensions/gsd/state.js +14 -4
- package/dist/resources/extensions/gsd/status-guards.js +14 -2
- package/dist/resources/extensions/gsd/templates/plan.md +9 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +10 -2
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
- package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +151 -15
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +36 -17
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +142 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-manifest.js +2 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +17 -1
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +54 -10
- package/dist/resources/extensions/gsd/worktree-manager.js +1 -1
- package/dist/resources/extensions/gsd/worktree-state-projection.js +31 -0
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- package/dist/resources/extensions/shared/interview-ui.js +6 -4
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.js +3 -1
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
- package/dist/resources/extensions/visual-brief/prompts.js +140 -0
- package/dist/resources/skills/forensics/SKILL.md +1 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +9 -9
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +5 -5
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -5
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -7
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -7
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -5
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +9 -9
- package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/8359.65b24fac92188a6b.js +10 -0
- package/dist/web/standalone/.next/static/chunks/9441.ff70bb53f6835771.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-855d616060cb6e59.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +4 -4
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/README.md +13 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +80 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/workflow-tools.test.ts +23 -1
- package/packages/mcp-server/src/workflow-tools.ts +168 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/native/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +5 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.js +41 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +5 -6
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.test.ts +49 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +7 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
- package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
- package/packages/pi-ai/src/providers/simple-options.ts +5 -6
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +44 -3
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +6 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +7 -2
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js +14 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +24 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +71 -97
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +7 -7
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js +25 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +24 -10
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +53 -3
- package/packages/pi-coding-agent/src/core/compaction/compaction.test.ts +23 -1
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +7 -2
- package/packages/pi-coding-agent/src/core/sdk.ts +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +23 -7
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +75 -102
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +15 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +9 -9
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +30 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +29 -10
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js +103 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +45 -2
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/terminal.d.ts +2 -0
- package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
- package/packages/pi-tui/dist/terminal.js +12 -0
- package/packages/pi-tui/dist/terminal.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +106 -27
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/terminal.test.ts +121 -0
- package/packages/pi-tui/src/__tests__/tui.test.ts +59 -2
- package/packages/pi-tui/src/terminal.ts +11 -0
- package/packages/pi-tui/src/tui.ts +108 -27
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +10 -1
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +52 -6
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +49 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +17 -6
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +111 -38
- package/src/resources/extensions/gsd/auto/orchestrator.ts +12 -1
- package/src/resources/extensions/gsd/auto/phases.ts +115 -49
- package/src/resources/extensions/gsd/auto/session.ts +16 -0
- package/src/resources/extensions/gsd/auto/types.ts +3 -0
- package/src/resources/extensions/gsd/auto/workflow-kernel.ts +5 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +72 -1
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +1 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +21 -19
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +312 -148
- package/src/resources/extensions/gsd/auto-prompts.ts +36 -13
- package/src/resources/extensions/gsd/auto-recovery.ts +83 -11
- package/src/resources/extensions/gsd/auto-start.ts +94 -12
- package/src/resources/extensions/gsd/auto-timers.ts +10 -3
- package/src/resources/extensions/gsd/auto-verification.ts +124 -42
- package/src/resources/extensions/gsd/auto-worktree.ts +195 -11
- package/src/resources/extensions/gsd/auto.ts +91 -42
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +42 -7
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +10 -9
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +5 -4
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +27 -10
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +10 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +41 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +21 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -0
- package/src/resources/extensions/gsd/commands-mcp-status.ts +8 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +8 -3
- package/src/resources/extensions/gsd/commands-verdict.ts +202 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +44 -4
- package/src/resources/extensions/gsd/db/milestone-leases.ts +26 -0
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/db-base-schema.ts +2 -0
- package/src/resources/extensions/gsd/db-migration-steps.ts +5 -0
- package/src/resources/extensions/gsd/db-task-slice-rows.ts +4 -0
- package/src/resources/extensions/gsd/dispatch-guard.ts +60 -2
- package/src/resources/extensions/gsd/docs/preferences-reference.md +8 -0
- package/src/resources/extensions/gsd/doctor-git-checks.ts +45 -1
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor-types.ts +1 -0
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/forensics.ts +7 -3
- package/src/resources/extensions/gsd/git-service.ts +166 -11
- package/src/resources/extensions/gsd/gsd-db.ts +80 -31
- package/src/resources/extensions/gsd/guided-flow-queue.ts +4 -3
- package/src/resources/extensions/gsd/guided-flow.ts +142 -134
- package/src/resources/extensions/gsd/guided-unit-context.ts +30 -0
- package/src/resources/extensions/gsd/init-wizard.ts +17 -2
- package/src/resources/extensions/gsd/journal.ts +8 -1
- package/src/resources/extensions/gsd/markdown-renderer.ts +10 -8
- package/src/resources/extensions/gsd/mcp-filter.ts +80 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +63 -14
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +3 -0
- package/src/resources/extensions/gsd/paths.ts +5 -0
- package/src/resources/extensions/gsd/pending-auto-start.ts +79 -0
- package/src/resources/extensions/gsd/planning-path-scope.ts +10 -2
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -12
- package/src/resources/extensions/gsd/pre-execution-checks.ts +49 -11
- package/src/resources/extensions/gsd/preferences-mcp.ts +27 -0
- package/src/resources/extensions/gsd/preferences-types.ts +33 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +145 -0
- package/src/resources/extensions/gsd/preferences.ts +5 -0
- package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/src/resources/extensions/gsd/prompts/forensics.md +3 -3
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/src/resources/extensions/gsd/prompts/queue.md +4 -4
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/queue-reorder-ui.ts +31 -13
- package/src/resources/extensions/gsd/repository-registry.ts +77 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +2 -0
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +54 -19
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +52 -1
- package/src/resources/extensions/gsd/smart-entry-routing.ts +77 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
- package/src/resources/extensions/gsd/state.ts +15 -4
- package/src/resources/extensions/gsd/status-guards.ts +16 -2
- package/src/resources/extensions/gsd/templates/plan.md +9 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +10 -2
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +300 -1
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +174 -8
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +151 -12
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +53 -2
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +18 -6
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +129 -6
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-stop-notification.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +32 -4
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +378 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +5 -9
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +86 -2
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/db-task-slice-rows.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +61 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/doctor-empty-worktree.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/doctor-forensics-db-open-regression.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +97 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/gsdroot-worktree-detection.test.ts +5 -2
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +59 -11
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/guided-tool-contract.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +7 -7
- package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +199 -2
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +49 -3
- package/src/resources/extensions/gsd/tests/journal.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/mcp-filter.test.ts +287 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +26 -18
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +80 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/parallel-orchestrator-zombie-cleanup.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/pending-autostart-scope.test.ts +29 -5
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +343 -3
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +18 -1
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -3
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +84 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/preferences-mcp.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +37 -1
- package/src/resources/extensions/gsd/tests/quality-gates.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/queue-reorder-ui.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +89 -2
- package/src/resources/extensions/gsd/tests/repository-registry.test.ts +52 -0
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +2 -3
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +72 -1
- package/src/resources/extensions/gsd/tests/smart-entry-routing.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +53 -2
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +119 -23
- package/src/resources/extensions/gsd/tests/status-guards.test.ts +17 -1
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +128 -9
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +111 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +29 -2
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +42 -1
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +173 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-kernel.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +19 -1
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/worktree-preferences-sync.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +59 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
- package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
- package/src/resources/extensions/gsd/tools/plan-slice.ts +172 -12
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +135 -0
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +51 -18
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +170 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +2 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +18 -1
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +61 -10
- package/src/resources/extensions/gsd/worktree-manager.ts +1 -1
- package/src/resources/extensions/gsd/worktree-state-projection.ts +43 -0
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/shared/interview-ui.ts +6 -4
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +15 -0
- package/src/resources/extensions/subagent/index.ts +567 -103
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/ttsr/ttsr-manager.ts +5 -1
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
- package/src/resources/extensions/visual-brief/prompts.ts +183 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
- package/src/resources/skills/forensics/SKILL.md +1 -1
- package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/8359.e059d86b255fce1c.js +0 -10
- package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
- package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
- package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → _kljR-_Miq_YV1IW0wpRO}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → _kljR-_Miq_YV1IW0wpRO}/_ssgManifest.js +0 -0
|
@@ -14,7 +14,8 @@ import { clearParseCache } from "./files.js";
|
|
|
14
14
|
import { parseRoadmap as parseLegacyRoadmap, parsePlan as parseLegacyPlan } from "./parsers-legacy.js";
|
|
15
15
|
import { isDbAvailable, getTask, getSlice, getSliceTasks, getPendingGates, updateTaskStatus, updateSliceStatus, insertSlice, getMilestone, refreshOpenDatabaseFromDisk, getCompletedMilestoneTaskFileHints, getMilestoneCommitAttributionShas, recordMilestoneCommitAttribution } from "./gsd-db.js";
|
|
16
16
|
import { isValidationTerminal } from "./state.js";
|
|
17
|
-
import {
|
|
17
|
+
import { getErrorMessage } from "./error-utils.js";
|
|
18
|
+
import { logWarning, logError } from "./workflow-logger.js";
|
|
18
19
|
import { readIntegrationBranch } from "./git-service.js";
|
|
19
20
|
import { isClosedStatus } from "./status-guards.js";
|
|
20
21
|
import { resolveSlicePath, resolveSliceFile, resolveTasksDir, resolveTaskFiles, relMilestoneFile, relSliceFile, buildSliceFileName, resolveMilestoneFile, clearPathCache, resolveGsdRootFile, } from "./paths.js";
|
|
@@ -23,11 +24,36 @@ import { execFileSync } from "node:child_process";
|
|
|
23
24
|
import { dirname, join } from "node:path";
|
|
24
25
|
import { resolveExpectedArtifactPath, diagnoseExpectedArtifact, } from "./auto-artifact-paths.js";
|
|
25
26
|
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
27
|
+
import { hasVerdict } from "./verdict-parser.js";
|
|
26
28
|
import { validateArtifact } from "./schemas/validate.js";
|
|
27
29
|
import { getProjectResearchStatus } from "./project-research-policy.js";
|
|
30
|
+
import { isGsdWorktreePath } from "./worktree-root.js";
|
|
28
31
|
// Re-export so existing consumers of auto-recovery.ts keep working.
|
|
29
32
|
export { resolveExpectedArtifactPath, diagnoseExpectedArtifact };
|
|
30
33
|
export { classifyMilestoneSummaryContent, } from "./milestone-summary-classifier.js";
|
|
34
|
+
// ─── Artifact Resolution & Verification ───────────────────────────────────────
|
|
35
|
+
export function diagnoseWorktreeIntegrityFailure(basePath) {
|
|
36
|
+
if (!isGsdWorktreePath(basePath))
|
|
37
|
+
return null;
|
|
38
|
+
if (!existsSync(basePath)) {
|
|
39
|
+
return `Worktree integrity failure: ${basePath} does not exist. Repair or recreate the worktree before retrying.`;
|
|
40
|
+
}
|
|
41
|
+
const gitPath = join(basePath, ".git");
|
|
42
|
+
if (!existsSync(gitPath)) {
|
|
43
|
+
return `Worktree integrity failure: ${basePath} is not a valid git worktree (.git missing). Repair or recreate the worktree before retrying.`;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
execFileSync("git", ["rev-parse", "--git-dir"], {
|
|
47
|
+
cwd: basePath,
|
|
48
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
49
|
+
encoding: "utf-8",
|
|
50
|
+
});
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
return `Worktree integrity failure: ${basePath} is not a valid git worktree (git rev-parse failed: ${getErrorMessage(err).split("\n")[0]}). Repair or recreate the worktree before retrying.`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
31
57
|
export function refreshRecoveryDbForArtifact(unitType, unitId) {
|
|
32
58
|
if (unitType !== "plan-slice" && unitType !== "execute-task")
|
|
33
59
|
return { ok: true };
|
|
@@ -137,9 +163,16 @@ export function hasImplementationArtifacts(basePath, milestoneId) {
|
|
|
137
163
|
// Strategy: check `git diff --name-only` against the merge-base with the
|
|
138
164
|
// main branch. This captures ALL files changed during the milestone's
|
|
139
165
|
// lifetime while running on a milestone branch.
|
|
140
|
-
const
|
|
141
|
-
? readIntegrationBranch(basePath, milestoneId)
|
|
142
|
-
:
|
|
166
|
+
const recordedIntegrationBranch = milestoneId
|
|
167
|
+
? readIntegrationBranch(basePath, milestoneId)
|
|
168
|
+
: null;
|
|
169
|
+
let integrationBranch;
|
|
170
|
+
if (recordedIntegrationBranch?.startsWith("milestone/")) {
|
|
171
|
+
integrationBranch = detectMainBranch(basePath);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
integrationBranch = recordedIntegrationBranch ?? detectMainBranch(basePath);
|
|
175
|
+
}
|
|
143
176
|
const currentBranch = getCurrentBranch(basePath);
|
|
144
177
|
const branchDiff = getChangedFilesSinceBranch(basePath, integrationBranch);
|
|
145
178
|
if (!branchDiff.ok)
|
|
@@ -471,29 +504,49 @@ function commitMatchesMilestone(basePath, message, milestoneId, files) {
|
|
|
471
504
|
// rather than Mxx/Sxx/Tyy. Bind those commits back to the milestone when
|
|
472
505
|
// either the commit touched this milestone's artifacts, or — for projects
|
|
473
506
|
// where .gsd/ is gitignored/external (#5033) — the message explicitly
|
|
474
|
-
// names the milestone
|
|
507
|
+
// names the milestone, local GSD state proves the task belongs here, or the
|
|
508
|
+
// commit is implementation-bearing evidence itself (#5100).
|
|
475
509
|
if (/^GSD-Task:\s*S[^/\s]+\/T\S+/m.test(message)) {
|
|
476
510
|
if (files.some((file) => isMilestoneArtifactPath(file, milestoneId)))
|
|
477
511
|
return true;
|
|
478
512
|
if (commitMessageMentionsMilestone(message, milestoneId))
|
|
479
513
|
return true;
|
|
480
|
-
|
|
514
|
+
const taskTrailerOwnership = getTaskOwnershipStatus(basePath, message, milestoneId);
|
|
515
|
+
if (taskTrailerOwnership === true)
|
|
516
|
+
return true;
|
|
517
|
+
if (taskTrailerOwnership === false)
|
|
518
|
+
return false;
|
|
519
|
+
// taskTrailerOwnership === null: unknown ownership. Apply fallback only
|
|
520
|
+
// in this case to avoid cross-milestone attribution.
|
|
521
|
+
if (MILESTONE_ID_RE.test(milestoneId) && classifyImplementationFiles(files) === "present")
|
|
481
522
|
return true;
|
|
482
523
|
}
|
|
483
524
|
return false;
|
|
484
525
|
}
|
|
485
|
-
|
|
526
|
+
/**
|
|
527
|
+
* Tri-state task ownership probe.
|
|
528
|
+
* true => DB or local files confirm this milestone owns the task.
|
|
529
|
+
* false => DB is available and this milestone is registered, but task is absent.
|
|
530
|
+
* null => ownership unknown (milestone not in DB yet, or no DB + no local files).
|
|
531
|
+
*/
|
|
532
|
+
function getTaskOwnershipStatus(basePath, message, milestoneId) {
|
|
486
533
|
const match = message.match(/^GSD-Task:\s*(S[^/\s]+)\/(T[^\s]+)/m);
|
|
487
534
|
if (!match)
|
|
488
|
-
return
|
|
535
|
+
return null;
|
|
489
536
|
const [, sliceId, taskId] = match;
|
|
490
|
-
if (
|
|
491
|
-
|
|
537
|
+
if (isDbAvailable()) {
|
|
538
|
+
if (!getMilestone(milestoneId))
|
|
539
|
+
return null;
|
|
540
|
+
return getTask(milestoneId, sliceId, taskId) ? true : false;
|
|
541
|
+
}
|
|
542
|
+
// DB unavailable: fallback to local task-file presence.
|
|
492
543
|
const tasksDir = resolveTasksDir(basePath, milestoneId, sliceId);
|
|
493
|
-
if (
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
544
|
+
if (tasksDir
|
|
545
|
+
&& (existsSync(join(tasksDir, `${taskId}-PLAN.md`))
|
|
546
|
+
|| existsSync(join(tasksDir, `${taskId}-SUMMARY.md`)))) {
|
|
547
|
+
return true;
|
|
548
|
+
}
|
|
549
|
+
return null;
|
|
497
550
|
}
|
|
498
551
|
function commitMessageMentionsMilestone(message, milestoneId) {
|
|
499
552
|
if (!MILESTONE_ID_RE.test(milestoneId))
|
|
@@ -673,6 +726,11 @@ export function verifyExpectedArtifact(unitType, unitId, base) {
|
|
|
673
726
|
return false;
|
|
674
727
|
}
|
|
675
728
|
if (!existsSync(absPath)) {
|
|
729
|
+
const worktreeFailure = diagnoseWorktreeIntegrityFailure(base);
|
|
730
|
+
if (worktreeFailure) {
|
|
731
|
+
logError("recovery", `${worktreeFailure} Unit: ${unitType} ${unitId}.`);
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
676
734
|
logWarning("recovery", `verify-fail ${unitType} ${unitId}: existsSync false for ${absPath}`);
|
|
677
735
|
return false;
|
|
678
736
|
}
|
|
@@ -683,6 +741,13 @@ export function verifyExpectedArtifact(unitType, unitId, base) {
|
|
|
683
741
|
return false;
|
|
684
742
|
}
|
|
685
743
|
}
|
|
744
|
+
if (unitType === "run-uat") {
|
|
745
|
+
const assessmentContent = readFileSync(absPath, "utf-8");
|
|
746
|
+
if (!hasVerdict(assessmentContent)) {
|
|
747
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: assessment missing verdict at ${absPath}`);
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
686
751
|
if (unitType === "plan-milestone") {
|
|
687
752
|
try {
|
|
688
753
|
const roadmap = parseLegacyRoadmap(readFileSync(absPath, "utf-8"));
|
|
@@ -21,10 +21,10 @@ import { invalidateAllCaches } from "./cache.js";
|
|
|
21
21
|
import { writeLock, clearLock } from "./crash-recovery.js";
|
|
22
22
|
import { acquireSessionLock, releaseSessionLock, updateSessionLock, } from "./session-lock.js";
|
|
23
23
|
import { ensureGitignore, untrackRuntimeFiles } from "./gitignore.js";
|
|
24
|
-
import { nativeIsRepo, nativeInit, nativeAddAll, nativeCommit, nativeGetCurrentBranch, nativeDetectMainBranch,
|
|
24
|
+
import { nativeIsRepo, nativeInit, nativeAddAll, nativeCommit, nativeGetCurrentBranch, nativeDetectMainBranch, nativeBranchList, nativeBranchExists, nativeBranchListMerged, nativeBranchDelete, nativeWorktreeRemove, nativeCommitCountBetween, } from "./native-git-bridge.js";
|
|
25
25
|
import { GitServiceImpl } from "./git-service.js";
|
|
26
26
|
import { captureIntegrationBranch, detectWorktreeName, setActiveMilestoneId, } from "./worktree.js";
|
|
27
|
-
import { getAutoWorktreePath } from "./auto-worktree.js";
|
|
27
|
+
import { getAutoWorktreePath, checkoutBranchWithStashGuard } from "./auto-worktree.js";
|
|
28
28
|
import { readResourceVersion, cleanStaleRuntimeUnits } from "./auto-worktree.js";
|
|
29
29
|
import { worktreePath as getWorktreeDir, isInsideWorktreesDir } from "./worktree-manager.js";
|
|
30
30
|
import { emitWorktreeOrphaned } from "./worktree-telemetry.js";
|
|
@@ -33,7 +33,7 @@ import { initRoutingHistory } from "./routing-history.js";
|
|
|
33
33
|
import { restoreHookState, resetHookState } from "./post-unit-hooks.js";
|
|
34
34
|
import { resetProactiveHealing, setLevelChangeCallback } from "./doctor-proactive.js";
|
|
35
35
|
import { snapshotSkills } from "./skill-discovery.js";
|
|
36
|
-
import { isDbAvailable, getMilestone, openDatabase, getDbStatus } from "./gsd-db.js";
|
|
36
|
+
import { isDbAvailable, getMilestone, getAllMilestones, openDatabase, getDbStatus } from "./gsd-db.js";
|
|
37
37
|
import { isClosedStatus } from "./status-guards.js";
|
|
38
38
|
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
39
39
|
import { auditOrphanedPreflightStashes } from "./orphan-stash-audit.js";
|
|
@@ -88,9 +88,11 @@ export function decideSurvivorAction(hasSurvivorBranch, phase) {
|
|
|
88
88
|
return "finalize";
|
|
89
89
|
return "none";
|
|
90
90
|
}
|
|
91
|
-
export function auditOrphanedMilestoneBranches(basePath, isolationMode) {
|
|
91
|
+
export function auditOrphanedMilestoneBranches(basePath, isolationMode, gitDeps = {}) {
|
|
92
92
|
const recovered = [];
|
|
93
93
|
const warnings = [];
|
|
94
|
+
const branchList = gitDeps.branchList ?? nativeBranchList;
|
|
95
|
+
const branchExists = gitDeps.branchExists ?? nativeBranchExists;
|
|
94
96
|
// Skip in none mode — no milestone branches are created
|
|
95
97
|
if (isolationMode === "none")
|
|
96
98
|
return { recovered, warnings };
|
|
@@ -98,15 +100,16 @@ export function auditOrphanedMilestoneBranches(basePath, isolationMode) {
|
|
|
98
100
|
if (!isDbAvailable())
|
|
99
101
|
return { recovered, warnings };
|
|
100
102
|
let milestoneBranches;
|
|
103
|
+
let milestoneBranchListAvailable = true;
|
|
101
104
|
try {
|
|
102
|
-
milestoneBranches =
|
|
105
|
+
milestoneBranches = branchList(basePath, "milestone/*");
|
|
103
106
|
}
|
|
104
107
|
catch {
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
milestoneBranchListAvailable = false;
|
|
109
|
+
// git branch list failed — fall through with an empty branch set so the
|
|
110
|
+
// branch-less orphan pass can still run after per-milestone verification.
|
|
111
|
+
milestoneBranches = [];
|
|
107
112
|
}
|
|
108
|
-
if (milestoneBranches.length === 0)
|
|
109
|
-
return { recovered, warnings };
|
|
110
113
|
// Detect main branch for merge-check
|
|
111
114
|
let mainBranch;
|
|
112
115
|
try {
|
|
@@ -236,6 +239,71 @@ export function auditOrphanedMilestoneBranches(basePath, isolationMode) {
|
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
}
|
|
242
|
+
// Second pass (#5879): catch worktree directories stranded by a previous
|
|
243
|
+
// audit that deleted the milestone/* branch but failed to remove the
|
|
244
|
+
// directory (or the dir was orphaned by a separate path entirely, e.g.
|
|
245
|
+
// postflight-stash-restore-failed during closeout). The branch-keyed loop
|
|
246
|
+
// above is invisible to these cases — `nativeBranchList` returns nothing
|
|
247
|
+
// for the milestone, so the dir-cleanup block at line ~310 is never
|
|
248
|
+
// reached.
|
|
249
|
+
//
|
|
250
|
+
// Keyed on milestones whose DB status is `complete`. We do not iterate
|
|
251
|
+
// over arbitrary directories under .gsd/worktrees/ to avoid touching
|
|
252
|
+
// dirs that belong to an in-progress milestone whose branch was deleted
|
|
253
|
+
// separately — those are handled by the in-progress orphan path above
|
|
254
|
+
// when the branch is present, and by `/gsd doctor` when it is not.
|
|
255
|
+
const seenMilestoneIds = new Set(milestoneBranches.map((branch) => branch.replace(/^milestone\//, "")));
|
|
256
|
+
let completedMilestones = [];
|
|
257
|
+
try {
|
|
258
|
+
completedMilestones = getAllMilestones();
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
// DB read failure — skip the second pass; the first pass is still useful.
|
|
262
|
+
completedMilestones = [];
|
|
263
|
+
}
|
|
264
|
+
for (const m of completedMilestones) {
|
|
265
|
+
if (m.status !== "complete")
|
|
266
|
+
continue;
|
|
267
|
+
if (seenMilestoneIds.has(m.id))
|
|
268
|
+
continue; // already processed in the branch loop
|
|
269
|
+
if (!milestoneBranchListAvailable) {
|
|
270
|
+
try {
|
|
271
|
+
if (branchExists(basePath, `milestone/${m.id}`))
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
catch (err) {
|
|
275
|
+
warnings.push(`Could not verify whether milestone/${m.id} still exists; skipping branch-less worktree cleanup for safety: ${err instanceof Error ? err.message : String(err)}`);
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const wtDir = getWorktreeDir(basePath, m.id);
|
|
280
|
+
if (!existsSync(wtDir))
|
|
281
|
+
continue;
|
|
282
|
+
if (!isInsideWorktreesDir(basePath, wtDir)) {
|
|
283
|
+
warnings.push(`Orphaned worktree directory for ${m.id} is outside .gsd/worktrees/ — skipping removal for safety.`);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
// Try `git worktree remove` first in case the dir is still registered
|
|
287
|
+
// (defensive — usually it is not when we reach this branch-less pass).
|
|
288
|
+
try {
|
|
289
|
+
nativeWorktreeRemove(basePath, wtDir, true);
|
|
290
|
+
}
|
|
291
|
+
catch (e) {
|
|
292
|
+
logWarning("engine", `worktree remove failed (expected for branch-less orphans): ${e instanceof Error ? e.message : String(e)}`);
|
|
293
|
+
}
|
|
294
|
+
if (existsSync(wtDir)) {
|
|
295
|
+
try {
|
|
296
|
+
rmSync(wtDir, { recursive: true, force: true });
|
|
297
|
+
recovered.push(`Removed orphaned worktree directory for ${m.id} (branch already deleted).`);
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
warnings.push(`Failed to remove orphaned worktree directory for ${m.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
recovered.push(`Removed orphaned worktree directory for ${m.id} (branch already deleted).`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
239
307
|
return { recovered, warnings };
|
|
240
308
|
}
|
|
241
309
|
/**
|
|
@@ -368,7 +436,7 @@ export function _mergeOrphanCompletedMilestone(lifecycle, orphanId, ui) {
|
|
|
368
436
|
return { merged: false, error: err };
|
|
369
437
|
}
|
|
370
438
|
export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, requestedStepMode, deps, interrupted) {
|
|
371
|
-
const { shouldUseWorktreeIsolation, registerSigtermHandler, lockBase, buildLifecycle, } = deps;
|
|
439
|
+
const { shouldUseWorktreeIsolation, registerSigtermHandler, registerAutoWorkerForSession, lockBase, buildLifecycle, } = deps;
|
|
372
440
|
const dirCheck = validateDirectory(base);
|
|
373
441
|
if (dirCheck.severity === "blocked") {
|
|
374
442
|
ctx.ui.notify(dirCheck.reason, "error");
|
|
@@ -523,6 +591,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
523
591
|
// consult DB status and avoid clearing runtime units for milestones that
|
|
524
592
|
// only have a failure-path SUMMARY on disk (#4663).
|
|
525
593
|
await openProjectDbIfPresent(base);
|
|
594
|
+
registerAutoWorkerForSession(base);
|
|
526
595
|
// Clean stale runtime unit files for completed milestones (#887).
|
|
527
596
|
// DB-authoritative: when DB is available, require DB status to be closed
|
|
528
597
|
// before clearing runtime units. A SUMMARY file alone is no longer
|
|
@@ -606,12 +675,16 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
606
675
|
// worktree cleanup) was never run — the survivor branch must be merged.
|
|
607
676
|
// Applies to both worktree and branch isolation modes.
|
|
608
677
|
let hasSurvivorBranch = false;
|
|
609
|
-
|
|
678
|
+
let survivorMilestoneId = state.activeMilestone?.id ?? null;
|
|
679
|
+
if (!survivorMilestoneId && state.phase === "complete") {
|
|
680
|
+
survivorMilestoneId = findUnmergedCompletedMilestone(base, getIsolationMode(base));
|
|
681
|
+
}
|
|
682
|
+
if (survivorMilestoneId &&
|
|
610
683
|
(state.phase === "pre-planning" || state.phase === "complete") &&
|
|
611
684
|
getIsolationMode(base) !== "none" &&
|
|
612
685
|
!detectWorktreeName(base) &&
|
|
613
686
|
!base.includes(`${pathSep}.gsd${pathSep}worktrees${pathSep}`)) {
|
|
614
|
-
const milestoneBranch = `milestone/${
|
|
687
|
+
const milestoneBranch = `milestone/${survivorMilestoneId}`;
|
|
615
688
|
const { nativeBranchExists } = await import("./native-git-bridge.js");
|
|
616
689
|
hasSurvivorBranch = nativeBranchExists(base, milestoneBranch);
|
|
617
690
|
if (hasSurvivorBranch) {
|
|
@@ -645,7 +718,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
645
718
|
// Re-evaluate via the helper — the discuss branch above may have cleared
|
|
646
719
|
// hasSurvivorBranch after a successful promotion.
|
|
647
720
|
if (decideSurvivorAction(hasSurvivorBranch, state.phase) === "finalize") {
|
|
648
|
-
const mid =
|
|
721
|
+
const mid = survivorMilestoneId;
|
|
649
722
|
// Commit 68ef58a3c made `_mergeBranchMode` throw on wrong-branch
|
|
650
723
|
// instead of returning false silently. Wrap the call so the throw is
|
|
651
724
|
// converted into an error notify + clean bootstrap abort, not an
|
|
@@ -828,7 +901,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
828
901
|
const integrationBranch = nativeDetectMainBranch(base);
|
|
829
902
|
const branchToCheckout = resolveIsolationNoneBranchCheckout(currentBranch, integrationBranch, isolationMode, isRepo);
|
|
830
903
|
if (branchToCheckout) {
|
|
831
|
-
|
|
904
|
+
checkoutBranchWithStashGuard(base, branchToCheckout, "isolation-none-recovery");
|
|
832
905
|
logWarning("bootstrap", `Returned to "${branchToCheckout}" — HEAD was on stale milestone branch "${currentBranch}" (isolation: none does not use milestone branches).`);
|
|
833
906
|
}
|
|
834
907
|
}
|
|
@@ -262,13 +262,21 @@ export function startUnitSupervision(sctx) {
|
|
|
262
262
|
if (runtime?.continueHereFired)
|
|
263
263
|
return;
|
|
264
264
|
const contextUsage = s.cmdCtx.getContextUsage();
|
|
265
|
-
if (!contextUsage || contextUsage.percent == null
|
|
265
|
+
if (!contextUsage || contextUsage.percent == null)
|
|
266
|
+
return;
|
|
267
|
+
const rawPercent = contextUsage.percent;
|
|
268
|
+
if (rawPercent > 150) {
|
|
269
|
+
logWarning("timer", `[continue-here] ignoring implausible context percent: ${rawPercent}`);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const contextPercent = Math.max(0, Math.min(100, rawPercent));
|
|
273
|
+
if (contextPercent < continueHereThreshold)
|
|
266
274
|
return;
|
|
267
275
|
writeUnitRuntimeRecord(s.basePath, unitType, unitId, s.currentUnit.startedAt, {
|
|
268
276
|
continueHereFired: true,
|
|
269
277
|
});
|
|
270
278
|
if (s.verbose) {
|
|
271
|
-
ctx.ui.notify(`Context at ${
|
|
279
|
+
ctx.ui.notify(`Context at ${contextPercent}% (threshold: ${continueHereThreshold}%) — sending wrap-up signal.`, "info");
|
|
272
280
|
}
|
|
273
281
|
// Only trigger a new turn if no tools are currently in flight (#3512).
|
|
274
282
|
const contextTrigger = getInFlightToolCount() === 0;
|
|
@@ -277,7 +285,7 @@ export function startUnitSupervision(sctx) {
|
|
|
277
285
|
display: s.verbose,
|
|
278
286
|
content: [
|
|
279
287
|
"**CONTEXT BUDGET WARNING — wrap up this unit now.**",
|
|
280
|
-
`Context window is at ${
|
|
288
|
+
`Context window is at ${contextPercent}% (threshold: ${continueHereThreshold}%).`,
|
|
281
289
|
"The next unit needs a fresh context to work effectively. Wrap up now:",
|
|
282
290
|
"1. Finish any in-progress file writes",
|
|
283
291
|
"2. Write or update the required durable artifacts (summary, checkboxes)",
|
|
@@ -10,7 +10,7 @@ import { isClosedStatus } from "./status-guards.js";
|
|
|
10
10
|
import { loadFile } from "./files.js";
|
|
11
11
|
import { parseRoadmap } from "./parsers-legacy.js";
|
|
12
12
|
import { isMilestoneComplete } from "./state.js";
|
|
13
|
-
import { runVerificationGate, formatFailureContext, captureRuntimeErrors, runDependencyAudit, } from "./verification-gate.js";
|
|
13
|
+
import { runVerificationGate, runVerificationGateForTargets, formatFailureContext, captureRuntimeErrors, runDependencyAudit, } from "./verification-gate.js";
|
|
14
14
|
import { writeVerificationJSON } from "./verification-evidence.js";
|
|
15
15
|
import { logWarning } from "./workflow-logger.js";
|
|
16
16
|
import { runPostExecutionChecks } from "./post-execution-checks.js";
|
|
@@ -18,8 +18,45 @@ import { join } from "node:path";
|
|
|
18
18
|
import { resolveUokFlags } from "./uok/flags.js";
|
|
19
19
|
import { UokGateRunner } from "./uok/gate-runner.js";
|
|
20
20
|
import { verificationRetryKey } from "./auto/verification-retry-policy.js";
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
import { decideVerificationVerdict } from "./verification-verdict.js";
|
|
22
|
+
import { createRepositoryRegistryFromPreferences } from "./repository-registry.js";
|
|
23
|
+
import { getSlice } from "./gsd-db.js";
|
|
24
|
+
function resolveVerificationTargets(basePath, prefs, task, slice) {
|
|
25
|
+
const registry = createRepositoryRegistryFromPreferences(basePath, prefs);
|
|
26
|
+
const explicitIds = task?.target_repositories?.length
|
|
27
|
+
? task.target_repositories
|
|
28
|
+
: slice?.target_repositories?.length
|
|
29
|
+
? slice.target_repositories
|
|
30
|
+
: null;
|
|
31
|
+
const requestedIds = explicitIds ?? ["project"];
|
|
32
|
+
const targets = [];
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
for (const id of requestedIds) {
|
|
35
|
+
if (seen.has(id))
|
|
36
|
+
continue;
|
|
37
|
+
seen.add(id);
|
|
38
|
+
const repo = registry.byId.get(id);
|
|
39
|
+
if (!repo) {
|
|
40
|
+
if (explicitIds) {
|
|
41
|
+
throw new Error(`unknown verification target repository: ${id}`);
|
|
42
|
+
}
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
targets.push({
|
|
46
|
+
id: repo.id,
|
|
47
|
+
cwd: repo.root,
|
|
48
|
+
// Top-level verification commands override per-repo defaults.
|
|
49
|
+
preferenceCommands: prefs?.verification_commands?.length
|
|
50
|
+
? undefined
|
|
51
|
+
: repo.verification,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (!explicitIds && targets.length === 0) {
|
|
55
|
+
const project = registry.byId.get("project");
|
|
56
|
+
if (project)
|
|
57
|
+
targets.push({ id: "project", cwd: project.root });
|
|
58
|
+
}
|
|
59
|
+
return targets;
|
|
23
60
|
}
|
|
24
61
|
/**
|
|
25
62
|
* Post-unit guard for `validate-milestone` units (#4094).
|
|
@@ -67,12 +104,25 @@ async function runValidateMilestonePostCheck(vctx, pauseAuto) {
|
|
|
67
104
|
const { milestone: mid } = parseUnitId(s.currentUnit.id);
|
|
68
105
|
if (!mid)
|
|
69
106
|
return "continue";
|
|
107
|
+
const setToolFailureRetry = (message) => {
|
|
108
|
+
const retryKey = verificationRetryKey(s.currentUnit.type, s.currentUnit.id);
|
|
109
|
+
const attempt = (s.verificationRetryCount.get(retryKey) ?? 0) + 1;
|
|
110
|
+
s.verificationRetryCount.set(retryKey, attempt);
|
|
111
|
+
s.pendingVerificationRetry = {
|
|
112
|
+
unitId: s.currentUnit.id,
|
|
113
|
+
failureContext: message,
|
|
114
|
+
attempt,
|
|
115
|
+
};
|
|
116
|
+
return "retry";
|
|
117
|
+
};
|
|
70
118
|
const validationFile = resolveMilestoneFile(s.basePath, mid, "VALIDATION");
|
|
71
|
-
if (!validationFile)
|
|
72
|
-
return "
|
|
119
|
+
if (!validationFile) {
|
|
120
|
+
return setToolFailureRetry("You must call gsd_validate_milestone to persist the validation results. No VALIDATION.md was created.");
|
|
121
|
+
}
|
|
73
122
|
const validationContent = await loadFile(validationFile);
|
|
74
|
-
if (!validationContent)
|
|
75
|
-
return "
|
|
123
|
+
if (!validationContent) {
|
|
124
|
+
return setToolFailureRetry("You must call gsd_validate_milestone to persist the validation results. VALIDATION.md exists but is empty.");
|
|
125
|
+
}
|
|
76
126
|
const verdict = extractVerdict(validationContent);
|
|
77
127
|
if (verdict !== "needs-remediation") {
|
|
78
128
|
await persistMilestoneValidationGate("pass", "none", `milestone validation verdict is ${verdict}; no remediation loop risk`, "", mid);
|
|
@@ -128,7 +178,7 @@ async function countIncompleteSlices(basePath, milestoneId) {
|
|
|
128
178
|
/**
|
|
129
179
|
* Run the verification gate for the current execute-task unit.
|
|
130
180
|
* Returns:
|
|
131
|
-
* - "continue" —
|
|
181
|
+
* - "continue" — host-owned verification passed, proceed normally
|
|
132
182
|
* - "retry" — gate failed with retries remaining, s.pendingVerificationRetry set for loop re-iteration
|
|
133
183
|
* - "pause" — gate failed with retries exhausted, pauseAuto already called
|
|
134
184
|
*/
|
|
@@ -150,17 +200,28 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
150
200
|
// Read task plan verify field
|
|
151
201
|
const { milestone: mid, slice: sid, task: tid } = parseUnitId(s.currentUnit.id);
|
|
152
202
|
let taskPlanVerify;
|
|
203
|
+
let taskRow = null;
|
|
204
|
+
let sliceRow = null;
|
|
153
205
|
if (mid && sid && tid) {
|
|
154
206
|
if (isDbAvailable()) {
|
|
155
|
-
|
|
207
|
+
taskRow = getTask(mid, sid, tid);
|
|
208
|
+
sliceRow = getSlice(mid, sid);
|
|
209
|
+
taskPlanVerify = taskRow?.verify;
|
|
156
210
|
}
|
|
157
211
|
// When DB unavailable, taskPlanVerify stays undefined — gate runs without task-specific checks
|
|
158
212
|
}
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
213
|
+
const verificationTargets = resolveVerificationTargets(s.basePath, prefs, taskRow, sliceRow);
|
|
214
|
+
const result = verificationTargets.length <= 1
|
|
215
|
+
? runVerificationGate({
|
|
216
|
+
cwd: verificationTargets[0]?.cwd ?? s.basePath,
|
|
217
|
+
preferenceCommands: prefs?.verification_commands ?? verificationTargets[0]?.preferenceCommands,
|
|
218
|
+
taskPlanVerify,
|
|
219
|
+
})
|
|
220
|
+
: runVerificationGateForTargets({
|
|
221
|
+
targets: verificationTargets,
|
|
222
|
+
preferenceCommands: prefs?.verification_commands,
|
|
223
|
+
taskPlanVerify,
|
|
224
|
+
});
|
|
164
225
|
// Capture runtime errors
|
|
165
226
|
const runtimeErrors = await captureRuntimeErrors();
|
|
166
227
|
if (runtimeErrors.length > 0) {
|
|
@@ -178,6 +239,10 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
178
239
|
process.stderr.write(` [${w.severity}] ${w.name}: ${w.title}\n`);
|
|
179
240
|
}
|
|
180
241
|
}
|
|
242
|
+
const verdict = decideVerificationVerdict(s.currentUnit.type, result);
|
|
243
|
+
if (!verdict.passed) {
|
|
244
|
+
result.passed = false;
|
|
245
|
+
}
|
|
181
246
|
if (uokFlags.gates) {
|
|
182
247
|
const gateRunner = new UokGateRunner();
|
|
183
248
|
gateRunner.register({
|
|
@@ -190,10 +255,12 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
190
255
|
: "verification",
|
|
191
256
|
rationale: result.passed
|
|
192
257
|
? "verification checks passed"
|
|
193
|
-
:
|
|
258
|
+
: verdict.reason === "no-host-checks"
|
|
259
|
+
? "no runnable host-owned verification checks discovered"
|
|
260
|
+
: "verification checks failed",
|
|
194
261
|
findings: result.passed
|
|
195
262
|
? ""
|
|
196
|
-
: formatFailureContext(result),
|
|
263
|
+
: verdict.failureContext || formatFailureContext(result),
|
|
197
264
|
}),
|
|
198
265
|
});
|
|
199
266
|
await gateRunner.run("verification-gate", {
|
|
@@ -251,7 +318,11 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
251
318
|
}
|
|
252
319
|
else {
|
|
253
320
|
const nextAttempt = attempt + 1;
|
|
254
|
-
|
|
321
|
+
const includeRetryMetadata = !result.passed &&
|
|
322
|
+
verdict.retryable &&
|
|
323
|
+
autoFixEnabled &&
|
|
324
|
+
nextAttempt <= maxRetries;
|
|
325
|
+
writeVerificationJSON(result, tasksDir, tid, s.currentUnit.id, includeRetryMetadata ? nextAttempt : undefined, includeRetryMetadata ? maxRetries : undefined);
|
|
255
326
|
}
|
|
256
327
|
}
|
|
257
328
|
}
|
|
@@ -259,18 +330,6 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
259
330
|
logWarning("engine", `verification-evidence write error: ${evidenceErr.message}`);
|
|
260
331
|
}
|
|
261
332
|
}
|
|
262
|
-
const advisoryFailure = !result.passed &&
|
|
263
|
-
(result.discoverySource === "package-json" ||
|
|
264
|
-
result.checks.some((check) => isInfraVerificationFailure(check.stderr)));
|
|
265
|
-
if (advisoryFailure) {
|
|
266
|
-
s.verificationRetryCount.delete(retryKey);
|
|
267
|
-
s.verificationRetryFailureHashes.delete(retryKey);
|
|
268
|
-
s.pendingVerificationRetry = null;
|
|
269
|
-
ctx.ui.notify(result.discoverySource === "package-json"
|
|
270
|
-
? "Verification failed in auto-discovered package.json checks — treating as advisory."
|
|
271
|
-
: "Verification failed due to infrastructure/runtime environment issues — treating as advisory.", "warning");
|
|
272
|
-
return "continue";
|
|
273
|
-
}
|
|
274
333
|
// ── Post-execution checks (run after main verification passes for execute-task units) ──
|
|
275
334
|
let postExecChecks;
|
|
276
335
|
let postExecBlockingFailure = false;
|
|
@@ -280,8 +339,7 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
280
339
|
const postEnabled = prefs?.enhanced_verification_post !== false; // default true
|
|
281
340
|
if (enhancedEnabled && postEnabled && isDbAvailable()) {
|
|
282
341
|
try {
|
|
283
|
-
//
|
|
284
|
-
const taskRow = getTask(mid, sid, tid);
|
|
342
|
+
// Reuse the already-loaded task row for post-execution checks.
|
|
285
343
|
if (taskRow && taskRow.key_files && taskRow.key_files.length > 0) {
|
|
286
344
|
// Get all tasks in the slice
|
|
287
345
|
const allTasks = getSliceTasks(mid, sid);
|
|
@@ -430,6 +488,15 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
430
488
|
s.pendingVerificationRetry = null;
|
|
431
489
|
return "continue";
|
|
432
490
|
}
|
|
491
|
+
else if (verdict.reason === "no-host-checks") {
|
|
492
|
+
s.verificationRetryCount.delete(retryKey);
|
|
493
|
+
s.verificationRetryFailureHashes.delete(retryKey);
|
|
494
|
+
s.pendingVerificationRetry = null;
|
|
495
|
+
ctx.ui.notify("Verification gate FAILED — no runnable host-owned verification checks were discovered. Pausing for human review.", "error");
|
|
496
|
+
process.stderr.write(`verification-gate: ${verdict.failureContext}\n`);
|
|
497
|
+
await pauseAuto(ctx, pi);
|
|
498
|
+
return "pause";
|
|
499
|
+
}
|
|
433
500
|
else if (postExecBlockingFailure) {
|
|
434
501
|
// Post-execution failures are cross-task consistency issues — retrying the same task won't fix them.
|
|
435
502
|
// Skip retry and pause immediately for human review.
|
|
@@ -445,7 +512,7 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
445
512
|
s.verificationRetryCount.set(retryKey, nextAttempt);
|
|
446
513
|
s.pendingVerificationRetry = {
|
|
447
514
|
unitId: s.currentUnit.id,
|
|
448
|
-
failureContext: formatFailureContext(result),
|
|
515
|
+
failureContext: verdict.failureContext || formatFailureContext(result),
|
|
449
516
|
attempt: nextAttempt,
|
|
450
517
|
};
|
|
451
518
|
const failedCmds = result.checks
|
|
@@ -475,9 +542,10 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
475
542
|
}
|
|
476
543
|
}
|
|
477
544
|
catch (err) {
|
|
478
|
-
// Gate errors are non-fatal
|
|
479
545
|
logWarning("engine", `verification-gate error: ${err.message}`);
|
|
480
|
-
|
|
546
|
+
ctx.ui.notify(`Verification gate errored before producing an authoritative verdict: ${err.message}`, "error");
|
|
547
|
+
await pauseAuto(ctx, pi);
|
|
548
|
+
return "pause";
|
|
481
549
|
}
|
|
482
550
|
}
|
|
483
551
|
/**
|