gsd-pi 2.82.0-dev.c22380fc3 → 2.82.0-dev.dfbc5f58f
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 +4 -3
- 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/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +5 -5
- package/dist/resources/extensions/gsd/auto/orchestrator.js +11 -0
- package/dist/resources/extensions/gsd/auto/phases.js +8 -1
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +13 -6
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +233 -127
- package/dist/resources/extensions/gsd/auto-prompts.js +2 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +31 -1
- package/dist/resources/extensions/gsd/auto-start.js +85 -12
- package/dist/resources/extensions/gsd/auto-verification.js +28 -22
- package/dist/resources/extensions/gsd/auto-worktree.js +111 -1
- package/dist/resources/extensions/gsd/auto.js +30 -3
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +9 -8
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +16 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +4 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +37 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +31 -5
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
- 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/git-service.js +39 -1
- package/dist/resources/extensions/gsd/gsd-db.js +1 -0
- package/dist/resources/extensions/gsd/guided-flow.js +6 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +48 -12
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -2
- package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
- package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/status-guards.js +4 -0
- package/dist/resources/extensions/gsd/templates/plan.md +8 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +4 -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 +89 -14
- package/dist/resources/extensions/gsd/unit-context-manifest.js +32 -10
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +68 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +33 -8
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- 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/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/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +12 -12
- 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 +3 -3
- 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/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 +12 -12
- 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.e059d86b255fce1c.js → 8359.7eb3bb8f8ecf4c01.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-9a4db269f9ed63ad.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +4 -4
- package/packages/mcp-server/src/workflow-tools.test.ts +1 -1
- package/packages/native/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- 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/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/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/tsconfig.tsbuildinfo +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/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +14 -6
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +8 -5
- package/src/resources/extensions/gsd/auto/orchestrator.ts +11 -0
- package/src/resources/extensions/gsd/auto/phases.ts +7 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +14 -6
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +266 -139
- package/src/resources/extensions/gsd/auto-prompts.ts +2 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -0
- package/src/resources/extensions/gsd/auto-start.ts +92 -9
- package/src/resources/extensions/gsd/auto-verification.ts +36 -34
- package/src/resources/extensions/gsd/auto-worktree.ts +119 -1
- package/src/resources/extensions/gsd/auto.ts +32 -3
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +6 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +9 -8
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +19 -3
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +4 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +40 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +30 -4
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/git-service.ts +45 -1
- package/src/resources/extensions/gsd/gsd-db.ts +3 -0
- package/src/resources/extensions/gsd/guided-flow.ts +6 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +54 -12
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -2
- package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/status-guards.ts +5 -0
- package/src/resources/extensions/gsd/templates/plan.md +8 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +4 -2
- 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 +54 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +80 -1
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +43 -2
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- 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/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +103 -1
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +63 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +225 -1
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
- 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 +86 -0
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +46 -2
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -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 +86 -7
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +1 -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/write-gate-planning-unit.test.ts +54 -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 +98 -12
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +47 -11
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +78 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +41 -8
- package/src/resources/extensions/shared/html-shell.ts +412 -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/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/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/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/{Wop3A7KRGyR06H3rla_1- → q0WYuDVbHeFFYbdd-fei2}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Wop3A7KRGyR06H3rla_1- → q0WYuDVbHeFFYbdd-fei2}/_ssgManifest.js +0 -0
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Split into two functions called sequentially by auto-loop with
|
|
9
9
|
* the verification gate between them:
|
|
10
|
-
* 1. postUnitPreVerification() —
|
|
11
|
-
* 2. postUnitPostVerification() — DB dual-write, hooks, triage, quick-tasks
|
|
10
|
+
* 1. postUnitPreVerification() — closeout git for non-task units, doctor, state rebuild, worktree sync, artifact verification
|
|
11
|
+
* 2. postUnitPostVerification() — post-verified task git, DB dual-write, hooks, triage, quick-tasks
|
|
12
12
|
*
|
|
13
13
|
* Extracted from the pre-loop agent_end handler in auto.ts.
|
|
14
14
|
*/
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
resolveExpectedArtifactPath,
|
|
42
42
|
writeBlockerPlaceholder,
|
|
43
43
|
diagnoseExpectedArtifact,
|
|
44
|
+
diagnoseWorktreeIntegrityFailure,
|
|
44
45
|
} from "./auto-recovery.js";
|
|
45
46
|
import { regenerateIfMissing } from "./workflow-projections.js";
|
|
46
47
|
import { WorktreeStateProjection } from "./worktree-state-projection.js";
|
|
@@ -62,8 +63,7 @@ import { runSafely } from "./auto-utils.js";
|
|
|
62
63
|
import type { AutoSession, SidecarItem } from "./auto/session.js";
|
|
63
64
|
import { getEvidence, clearEvidenceFromDisk } from "./safety/evidence-collector.js";
|
|
64
65
|
import { validateFileChanges } from "./safety/file-change-validator.js";
|
|
65
|
-
|
|
66
|
-
// import { crossReferenceEvidence, type ClaimedEvidence } from "./safety/evidence-cross-ref.js";
|
|
66
|
+
import { crossReferenceEvidence, type ClaimedEvidence } from "./safety/evidence-cross-ref.js";
|
|
67
67
|
import { validateContent } from "./safety/content-validator.js";
|
|
68
68
|
import { resolveSafetyHarnessConfig } from "./safety/safety-harness.js";
|
|
69
69
|
import { resolveExpectedArtifactPath as resolveArtifactForContent } from "./auto-artifact-paths.js";
|
|
@@ -164,7 +164,7 @@ async function buildTaskCommitContextForUnit(
|
|
|
164
164
|
sliceTitle: stripKnownIdPrefix(slice?.title, sid),
|
|
165
165
|
oneLiner: summary?.oneLiner || task?.one_liner || undefined,
|
|
166
166
|
keyFiles:
|
|
167
|
-
summary?.frontmatter.key_files?.filter(f => !f.includes("{{")) ??
|
|
167
|
+
summary?.frontmatter.key_files?.filter(f => !f.includes("{{") && f.trim() !== "(none)") ??
|
|
168
168
|
task?.key_files ??
|
|
169
169
|
undefined,
|
|
170
170
|
issueNumber: ghIssueNumber,
|
|
@@ -222,6 +222,10 @@ export function _shouldDispatchQuickTaskForTest(
|
|
|
222
222
|
state.currentUnit.type !== "quick-task";
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
export function shouldDeferCloseoutGitAction(unitType: string): boolean {
|
|
226
|
+
return unitType === "execute-task";
|
|
227
|
+
}
|
|
228
|
+
|
|
225
229
|
/** Unit types that only touch `.gsd/` internal state files (no code changes).
|
|
226
230
|
* Auto-commit is skipped for these — their state files are picked up by the
|
|
227
231
|
* next actual task commit via `smartStage()`. */
|
|
@@ -378,6 +382,23 @@ export function buildStepCompleteMessage(nextState: import("./types.js").GSDStat
|
|
|
378
382
|
+ `Run /clear, then /gsd to continue (or /gsd auto to run continuously).`;
|
|
379
383
|
}
|
|
380
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Decide whether step mode should stop at the step wizard after a unit finishes.
|
|
387
|
+
*
|
|
388
|
+
* @param currentUnitType The just-finished unit type, such as "execute-task" or
|
|
389
|
+
* "complete-milestone"; may be null/undefined when no current unit is known.
|
|
390
|
+
* @param phaseAfterUnit The freshly derived next phase, such as "executing" or
|
|
391
|
+
* "complete"; may be null/undefined if state derivation failed.
|
|
392
|
+
* @returns true to show the step wizard; false to keep the loop running so
|
|
393
|
+
* terminal milestone completion can reach the merge/finalization path.
|
|
394
|
+
*/
|
|
395
|
+
export function shouldReturnStepWizardAfterUnit(
|
|
396
|
+
currentUnitType: string | null | undefined,
|
|
397
|
+
phaseAfterUnit: string | null | undefined,
|
|
398
|
+
): boolean {
|
|
399
|
+
return currentUnitType !== "complete-milestone" && phaseAfterUnit !== "complete";
|
|
400
|
+
}
|
|
401
|
+
|
|
381
402
|
export interface PreVerificationOpts {
|
|
382
403
|
skipSettleDelay?: boolean;
|
|
383
404
|
skipWorktreeSync?: boolean;
|
|
@@ -410,6 +431,11 @@ function artifactValidationKind(unitType: string): "project" | "requirements" |
|
|
|
410
431
|
}
|
|
411
432
|
|
|
412
433
|
function describeArtifactVerificationFailure(unitType: string, unitId: string, basePath: string): string {
|
|
434
|
+
const worktreeFailure = diagnoseWorktreeIntegrityFailure(basePath);
|
|
435
|
+
if (worktreeFailure) {
|
|
436
|
+
return `${worktreeFailure} Unit: ${unitType} ${unitId}.`;
|
|
437
|
+
}
|
|
438
|
+
|
|
413
439
|
const artifactPath = resolveExpectedArtifactPath(unitType, unitId, basePath);
|
|
414
440
|
if (!artifactPath) {
|
|
415
441
|
return `Artifact verification failed: ${unitType} "${unitId}" has no resolvable artifact path.`;
|
|
@@ -466,6 +492,164 @@ export async function autoCommitUnit(
|
|
|
466
492
|
}
|
|
467
493
|
}
|
|
468
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Execute the turn-level git action (commit, snapshot, or status-only).
|
|
497
|
+
*
|
|
498
|
+
* @param opts.softFailure - Defaults to false. When true, retry git failures,
|
|
499
|
+
* warn, and continue without pausing auto-mode; use for best-effort deferred
|
|
500
|
+
* closeout work where a git failure should not block the run.
|
|
501
|
+
*/
|
|
502
|
+
async function runCloseoutGitAction(
|
|
503
|
+
pctx: PostUnitContext,
|
|
504
|
+
unit: NonNullable<AutoSession["currentUnit"]>,
|
|
505
|
+
opts?: { softFailure?: boolean },
|
|
506
|
+
): Promise<"continue" | "dispatched"> {
|
|
507
|
+
const { s, ctx, pi, pauseAuto } = pctx;
|
|
508
|
+
const prefs = loadEffectiveGSDPreferences()?.preferences;
|
|
509
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
510
|
+
const turnAction: TurnGitActionMode = uokFlags.gitops ? uokFlags.gitopsTurnAction : "commit";
|
|
511
|
+
const traceId = s.currentTraceId ?? `turn:${unit.startedAt}`;
|
|
512
|
+
const turnId = s.currentTurnId ?? `${unit.type}/${unit.id}/${unit.startedAt}`;
|
|
513
|
+
|
|
514
|
+
s.lastGitActionFailure = null;
|
|
515
|
+
s.lastGitActionStatus = null;
|
|
516
|
+
|
|
517
|
+
try {
|
|
518
|
+
let taskContext: TaskCommitContext | undefined;
|
|
519
|
+
|
|
520
|
+
if (turnAction === "commit" && unit.type === "execute-task") {
|
|
521
|
+
taskContext = await buildTaskCommitContextForUnit(s.basePath, unit.id);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Invalidate the nativeHasChanges cache before auto-commit (#1853).
|
|
525
|
+
// The cache has a 10-second TTL and is keyed by basePath. A stale
|
|
526
|
+
// `false` result causes autoCommit to skip staging entirely.
|
|
527
|
+
_resetHasChangesCache();
|
|
528
|
+
|
|
529
|
+
const skipLifecycleCommit =
|
|
530
|
+
turnAction === "commit" && LIFECYCLE_ONLY_UNITS.has(unit.type);
|
|
531
|
+
|
|
532
|
+
if (skipLifecycleCommit) {
|
|
533
|
+
debugLog("postUnit", {
|
|
534
|
+
phase: "git-action-skipped",
|
|
535
|
+
reason: "lifecycle-only-unit",
|
|
536
|
+
unitType: unit.type,
|
|
537
|
+
unitId: unit.id,
|
|
538
|
+
});
|
|
539
|
+
} else {
|
|
540
|
+
const maxAttempts = opts?.softFailure ? 3 : 1;
|
|
541
|
+
let gitResult = runTurnGitAction({
|
|
542
|
+
basePath: s.basePath,
|
|
543
|
+
action: turnAction,
|
|
544
|
+
unitType: unit.type,
|
|
545
|
+
unitId: unit.id,
|
|
546
|
+
taskContext,
|
|
547
|
+
});
|
|
548
|
+
for (let attempt = 1; gitResult.status === "failed" && attempt < maxAttempts; attempt++) {
|
|
549
|
+
await new Promise((resolve) => setTimeout(resolve, 250 * attempt));
|
|
550
|
+
gitResult = runTurnGitAction({
|
|
551
|
+
basePath: s.basePath,
|
|
552
|
+
action: turnAction,
|
|
553
|
+
unitType: unit.type,
|
|
554
|
+
unitId: unit.id,
|
|
555
|
+
taskContext,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (uokFlags.gitops) {
|
|
560
|
+
writeTurnGitTransaction({
|
|
561
|
+
basePath: s.basePath,
|
|
562
|
+
traceId,
|
|
563
|
+
turnId,
|
|
564
|
+
unitType: unit.type,
|
|
565
|
+
unitId: unit.id,
|
|
566
|
+
stage: "publish",
|
|
567
|
+
action: turnAction,
|
|
568
|
+
push: uokFlags.gitopsTurnPush,
|
|
569
|
+
status: gitResult.status,
|
|
570
|
+
error: gitResult.error,
|
|
571
|
+
metadata: {
|
|
572
|
+
dirty: gitResult.dirty,
|
|
573
|
+
commitMessage: gitResult.commitMessage,
|
|
574
|
+
snapshotLabel: gitResult.snapshotLabel,
|
|
575
|
+
},
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (gitResult.status === "failed") {
|
|
580
|
+
s.lastGitActionFailure = gitResult.error ?? `git ${turnAction} failed`;
|
|
581
|
+
s.lastGitActionStatus = "failed";
|
|
582
|
+
if (uokFlags.gitops && uokFlags.gates) {
|
|
583
|
+
const parsed = parseUnitId(unit.id);
|
|
584
|
+
const gateRunner = new UokGateRunner();
|
|
585
|
+
gateRunner.register({
|
|
586
|
+
id: "closeout-git-action",
|
|
587
|
+
type: "closeout",
|
|
588
|
+
execute: async () => ({
|
|
589
|
+
outcome: "fail",
|
|
590
|
+
failureClass: "git",
|
|
591
|
+
rationale: `turn git action "${turnAction}" failed`,
|
|
592
|
+
findings: gitResult.error ?? "unknown git failure",
|
|
593
|
+
}),
|
|
594
|
+
});
|
|
595
|
+
await gateRunner.run("closeout-git-action", {
|
|
596
|
+
basePath: s.basePath,
|
|
597
|
+
traceId,
|
|
598
|
+
turnId,
|
|
599
|
+
milestoneId: parsed.milestone ?? undefined,
|
|
600
|
+
sliceId: parsed.slice ?? undefined,
|
|
601
|
+
taskId: parsed.task ?? undefined,
|
|
602
|
+
unitType: unit.type,
|
|
603
|
+
unitId: unit.id,
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
const failureMsg = `Git ${turnAction} failed: ${(gitResult.error ?? "unknown error").split("\n")[0]}`;
|
|
608
|
+
ctx.ui.notify(failureMsg, opts?.softFailure ? "warning" : "error");
|
|
609
|
+
debugLog("postUnit", {
|
|
610
|
+
phase: opts?.softFailure ? "git-action-failed-soft" : "git-action-failed-blocking",
|
|
611
|
+
action: turnAction,
|
|
612
|
+
error: gitResult.error ?? "unknown error",
|
|
613
|
+
});
|
|
614
|
+
if (opts?.softFailure) {
|
|
615
|
+
return "continue";
|
|
616
|
+
}
|
|
617
|
+
await pauseAuto(ctx, pi);
|
|
618
|
+
return "dispatched";
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
s.lastGitActionStatus = "ok";
|
|
622
|
+
|
|
623
|
+
if (turnAction === "commit" && gitResult.commitMessage) {
|
|
624
|
+
ctx.ui.notify(`Committed: ${gitResult.commitMessage.split("\n")[0]}`, "info");
|
|
625
|
+
} else if (turnAction === "snapshot" && gitResult.snapshotLabel) {
|
|
626
|
+
ctx.ui.notify(`Snapshot recorded: ${gitResult.snapshotLabel}`, "info");
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
} catch (e) {
|
|
630
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
631
|
+
s.lastGitActionFailure = message;
|
|
632
|
+
s.lastGitActionStatus = "failed";
|
|
633
|
+
debugLog("postUnit", { phase: "git-action", error: message, action: turnAction });
|
|
634
|
+
ctx.ui.notify(`Git ${turnAction} failed: ${message.split("\n")[0]}`, opts?.softFailure ? "warning" : "error");
|
|
635
|
+
if (opts?.softFailure) {
|
|
636
|
+
return "continue";
|
|
637
|
+
}
|
|
638
|
+
if (uokFlags.gitops) {
|
|
639
|
+
await pauseAuto(ctx, pi);
|
|
640
|
+
return "dispatched";
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// GitHub sync (non-blocking, opt-in)
|
|
645
|
+
await runSafely("postUnit", "github-sync", async () => {
|
|
646
|
+
const { runGitHubSync } = await import("../github-sync/sync.js");
|
|
647
|
+
await runGitHubSync(s.basePath, unit.type, unit.id);
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
return "continue";
|
|
651
|
+
}
|
|
652
|
+
|
|
469
653
|
/**
|
|
470
654
|
* Pre-verification processing: parallel worker signal check, cache invalidation,
|
|
471
655
|
* auto-commit, doctor run, state rebuild, worktree sync, artifact verification.
|
|
@@ -476,7 +660,7 @@ export async function autoCommitUnit(
|
|
|
476
660
|
* - "retry" — artifact verification failed, s.pendingVerificationRetry set for loop re-iteration
|
|
477
661
|
*/
|
|
478
662
|
export async function postUnitPreVerification(pctx: PostUnitContext, opts?: PreVerificationOpts): Promise<"dispatched" | "continue" | "retry"> {
|
|
479
|
-
const { s, ctx, pi,
|
|
663
|
+
const { s, ctx, pi, stopAuto, pauseAuto } = pctx;
|
|
480
664
|
|
|
481
665
|
// ── Parallel worker signal check ──
|
|
482
666
|
const milestoneLock = process.env.GSD_MILESTONE_LOCK;
|
|
@@ -502,135 +686,22 @@ export async function postUnitPreVerification(pctx: PostUnitContext, opts?: PreV
|
|
|
502
686
|
await new Promise(r => setTimeout(r, 100));
|
|
503
687
|
}
|
|
504
688
|
|
|
505
|
-
const prefs = loadEffectiveGSDPreferences()?.preferences;
|
|
506
|
-
const uokFlags = resolveUokFlags(prefs);
|
|
507
|
-
|
|
508
689
|
// Turn-level git action (commit | snapshot | status-only)
|
|
509
690
|
if (s.currentUnit) {
|
|
510
691
|
const unit = s.currentUnit;
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
if (
|
|
520
|
-
taskContext = await buildTaskCommitContextForUnit(s.basePath, s.currentUnit.id);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
// Invalidate the nativeHasChanges cache before auto-commit (#1853).
|
|
524
|
-
// The cache has a 10-second TTL and is keyed by basePath. A stale
|
|
525
|
-
// `false` result causes autoCommit to skip staging entirely, leaving
|
|
526
|
-
// code files only in the working tree where they are destroyed by
|
|
527
|
-
// `git worktree remove --force` during teardown.
|
|
528
|
-
_resetHasChangesCache();
|
|
529
|
-
|
|
530
|
-
const skipLifecycleCommit =
|
|
531
|
-
turnAction === "commit" && LIFECYCLE_ONLY_UNITS.has(s.currentUnit.type);
|
|
532
|
-
|
|
533
|
-
if (skipLifecycleCommit) {
|
|
534
|
-
debugLog("postUnit", {
|
|
535
|
-
phase: "git-action-skipped",
|
|
536
|
-
reason: "lifecycle-only-unit",
|
|
537
|
-
unitType: s.currentUnit.type,
|
|
538
|
-
unitId: s.currentUnit.id,
|
|
539
|
-
});
|
|
540
|
-
} else {
|
|
541
|
-
const gitResult = runTurnGitAction({
|
|
542
|
-
basePath: s.basePath,
|
|
543
|
-
action: turnAction,
|
|
544
|
-
unitType: s.currentUnit.type,
|
|
545
|
-
unitId: s.currentUnit.id,
|
|
546
|
-
taskContext,
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
if (uokFlags.gitops) {
|
|
550
|
-
writeTurnGitTransaction({
|
|
551
|
-
basePath: s.basePath,
|
|
552
|
-
traceId,
|
|
553
|
-
turnId,
|
|
554
|
-
unitType: unit.type,
|
|
555
|
-
unitId: unit.id,
|
|
556
|
-
stage: "publish",
|
|
557
|
-
action: turnAction,
|
|
558
|
-
push: uokFlags.gitopsTurnPush,
|
|
559
|
-
status: gitResult.status,
|
|
560
|
-
error: gitResult.error,
|
|
561
|
-
metadata: {
|
|
562
|
-
dirty: gitResult.dirty,
|
|
563
|
-
commitMessage: gitResult.commitMessage,
|
|
564
|
-
snapshotLabel: gitResult.snapshotLabel,
|
|
565
|
-
},
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (gitResult.status === "failed") {
|
|
570
|
-
s.lastGitActionFailure = gitResult.error ?? `git ${turnAction} failed`;
|
|
571
|
-
s.lastGitActionStatus = "failed";
|
|
572
|
-
if (uokFlags.gitops && uokFlags.gates) {
|
|
573
|
-
const parsed = parseUnitId(unit.id);
|
|
574
|
-
const gateRunner = new UokGateRunner();
|
|
575
|
-
gateRunner.register({
|
|
576
|
-
id: "closeout-git-action",
|
|
577
|
-
type: "closeout",
|
|
578
|
-
execute: async () => ({
|
|
579
|
-
outcome: "fail",
|
|
580
|
-
failureClass: "git",
|
|
581
|
-
rationale: `turn git action "${turnAction}" failed`,
|
|
582
|
-
findings: gitResult.error ?? "unknown git failure",
|
|
583
|
-
}),
|
|
584
|
-
});
|
|
585
|
-
await gateRunner.run("closeout-git-action", {
|
|
586
|
-
basePath: s.basePath,
|
|
587
|
-
traceId,
|
|
588
|
-
turnId,
|
|
589
|
-
milestoneId: parsed.milestone ?? undefined,
|
|
590
|
-
sliceId: parsed.slice ?? undefined,
|
|
591
|
-
taskId: parsed.task ?? undefined,
|
|
592
|
-
unitType: unit.type,
|
|
593
|
-
unitId: unit.id,
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
const failureMsg = `Git ${turnAction} failed: ${(gitResult.error ?? "unknown error").split("\n")[0]}`;
|
|
598
|
-
ctx.ui.notify(failureMsg, "error");
|
|
599
|
-
debugLog("postUnit", {
|
|
600
|
-
phase: "git-action-failed-blocking",
|
|
601
|
-
action: turnAction,
|
|
602
|
-
error: gitResult.error ?? "unknown error",
|
|
603
|
-
});
|
|
604
|
-
await pauseAuto(ctx, pi);
|
|
605
|
-
return "dispatched";
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
s.lastGitActionStatus = "ok";
|
|
609
|
-
|
|
610
|
-
if (turnAction === "commit" && gitResult.commitMessage) {
|
|
611
|
-
ctx.ui.notify(`Committed: ${gitResult.commitMessage.split("\n")[0]}`, "info");
|
|
612
|
-
} else if (turnAction === "snapshot" && gitResult.snapshotLabel) {
|
|
613
|
-
ctx.ui.notify(`Snapshot recorded: ${gitResult.snapshotLabel}`, "info");
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
} catch (e) {
|
|
617
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
618
|
-
s.lastGitActionFailure = message;
|
|
619
|
-
s.lastGitActionStatus = "failed";
|
|
620
|
-
debugLog("postUnit", { phase: "git-action", error: message, action: turnAction });
|
|
621
|
-
ctx.ui.notify(`Git ${turnAction} failed: ${message.split("\n")[0]}`, uokFlags.gitops ? "error" : "warning");
|
|
622
|
-
if (uokFlags.gitops) {
|
|
623
|
-
await pauseAuto(ctx, pi);
|
|
692
|
+
if (shouldDeferCloseoutGitAction(unit.type)) {
|
|
693
|
+
debugLog("postUnit", {
|
|
694
|
+
phase: "git-action-deferred-until-verification",
|
|
695
|
+
unitType: unit.type,
|
|
696
|
+
unitId: unit.id,
|
|
697
|
+
});
|
|
698
|
+
} else {
|
|
699
|
+
const gitActionResult = await runCloseoutGitAction(pctx, unit);
|
|
700
|
+
if (gitActionResult === "dispatched") {
|
|
624
701
|
return "dispatched";
|
|
625
702
|
}
|
|
626
703
|
}
|
|
627
704
|
|
|
628
|
-
// GitHub sync (non-blocking, opt-in)
|
|
629
|
-
await runSafely("postUnit", "github-sync", async () => {
|
|
630
|
-
const { runGitHubSync } = await import("../github-sync/sync.js");
|
|
631
|
-
await runGitHubSync(s.basePath, unit.type, unit.id);
|
|
632
|
-
});
|
|
633
|
-
|
|
634
705
|
// Prune dead bg-shell processes
|
|
635
706
|
await runSafely("postUnit", "prune-bg-shell", async () => {
|
|
636
707
|
const { pruneDeadProcesses } = await import("../bg-shell/process-manager.js");
|
|
@@ -866,7 +937,7 @@ export async function postUnitPreVerification(pctx: PostUnitContext, opts?: PreV
|
|
|
866
937
|
if (safetyConfig.enabled) {
|
|
867
938
|
const { milestone: sMid, slice: sSid, task: sTid } = parseUnitId(s.currentUnit.id);
|
|
868
939
|
|
|
869
|
-
// File change validation (execute-task only, after
|
|
940
|
+
// File change validation (execute-task only, after unit execution)
|
|
870
941
|
if (safetyConfig.file_change_validation && s.currentUnit.type === "execute-task" && sMid && sSid && sTid && isDbAvailable()) {
|
|
871
942
|
try {
|
|
872
943
|
const taskRow = getTask(sMid, sSid, sTid);
|
|
@@ -902,15 +973,42 @@ export async function postUnitPreVerification(pctx: PostUnitContext, opts?: PreV
|
|
|
902
973
|
const bashCalls = actual.filter(e => e.kind === "bash");
|
|
903
974
|
if (sMid && sSid && sTid && isDbAvailable()) {
|
|
904
975
|
const taskRow = getTask(sMid, sSid, sTid);
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
"
|
|
913
|
-
);
|
|
976
|
+
if (taskRow?.status === "complete") {
|
|
977
|
+
const claimedEvidence: ClaimedEvidence[] = getVerificationEvidence(sMid, sSid, sTid)
|
|
978
|
+
.map((row) => ({
|
|
979
|
+
command: row.command,
|
|
980
|
+
exitCode: row.exit_code,
|
|
981
|
+
verdict: row.verdict,
|
|
982
|
+
}))
|
|
983
|
+
.filter((row) => typeof row.command === "string" && row.command.trim().length > 0);
|
|
984
|
+
const mismatches = crossReferenceEvidence(claimedEvidence, actual);
|
|
985
|
+
|
|
986
|
+
for (const mismatch of mismatches) {
|
|
987
|
+
const logMessage = `evidence-xref: ${mismatch.reason}`;
|
|
988
|
+
if (mismatch.severity === "error") {
|
|
989
|
+
logError("safety", logMessage);
|
|
990
|
+
} else {
|
|
991
|
+
logWarning("safety", logMessage);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
if (claimedEvidence.length > 0 && bashCalls.length === 0) {
|
|
996
|
+
logWarning("safety", "task claimed verification command evidence but no execution tool calls were recorded");
|
|
997
|
+
ctx.ui.notify(
|
|
998
|
+
`Safety: task ${sTid} claimed command evidence but no execution tool calls were recorded`,
|
|
999
|
+
"warning",
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
const blockingMismatch = mismatches.find((mismatch) => mismatch.severity === "error");
|
|
1004
|
+
if (blockingMismatch) {
|
|
1005
|
+
ctx.ui.notify(
|
|
1006
|
+
`Safety: task ${sTid} claimed passing verification that failed in recorded execution`,
|
|
1007
|
+
"error",
|
|
1008
|
+
);
|
|
1009
|
+
await pauseAuto(ctx, pi);
|
|
1010
|
+
return "dispatched";
|
|
1011
|
+
}
|
|
914
1012
|
}
|
|
915
1013
|
}
|
|
916
1014
|
} catch (e) {
|
|
@@ -1083,6 +1181,24 @@ export async function postUnitPreVerification(pctx: PostUnitContext, opts?: PreV
|
|
|
1083
1181
|
"warning",
|
|
1084
1182
|
);
|
|
1085
1183
|
// Fall through to "continue" — do NOT enter the retry or db-unavailable paths.
|
|
1184
|
+
} else if (!triggerArtifactVerified && diagnoseWorktreeIntegrityFailure(s.basePath)) {
|
|
1185
|
+
const retryKey = `${s.currentUnit.type}:${s.currentUnit.id}`;
|
|
1186
|
+
const worktreeFailure = diagnoseWorktreeIntegrityFailure(s.basePath)!;
|
|
1187
|
+
s.pendingVerificationRetry = null;
|
|
1188
|
+
s.verificationRetryCount.delete(retryKey);
|
|
1189
|
+
s.verificationRetryFailureHashes.delete(retryKey);
|
|
1190
|
+
debugLog("postUnit", {
|
|
1191
|
+
phase: "worktree-integrity-failure",
|
|
1192
|
+
unitType: s.currentUnit.type,
|
|
1193
|
+
unitId: s.currentUnit.id,
|
|
1194
|
+
basePath: s.basePath,
|
|
1195
|
+
});
|
|
1196
|
+
ctx.ui.notify(
|
|
1197
|
+
`${worktreeFailure} Retry ${s.currentUnit.id} after repair.`,
|
|
1198
|
+
"error",
|
|
1199
|
+
);
|
|
1200
|
+
await pauseAuto(ctx, pi);
|
|
1201
|
+
return "dispatched";
|
|
1086
1202
|
} else if (!triggerArtifactVerified && !isDbAvailable()) {
|
|
1087
1203
|
debugLog("postUnit", { phase: "artifact-verify-skip-db-unavailable", unitType: s.currentUnit.type, unitId: s.currentUnit.id });
|
|
1088
1204
|
const dbSkipDiag = diagnoseExpectedArtifact(s.currentUnit.type, s.currentUnit.id, s.basePath);
|
|
@@ -1169,6 +1285,13 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1169
1285
|
const { s, ctx, pi, buildSnapshotOpts, lockBase, stopAuto, pauseAuto, updateProgressWidget } = pctx;
|
|
1170
1286
|
|
|
1171
1287
|
if (s.currentUnit) {
|
|
1288
|
+
if (shouldDeferCloseoutGitAction(s.currentUnit.type)) {
|
|
1289
|
+
const gitActionResult = await runCloseoutGitAction(pctx, s.currentUnit, { softFailure: true });
|
|
1290
|
+
if (gitActionResult === "dispatched") {
|
|
1291
|
+
return "stopped";
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1172
1295
|
try {
|
|
1173
1296
|
const codebasePrefs = loadEffectiveGSDPreferences()?.preferences?.codebase;
|
|
1174
1297
|
const refresh = ensureCodebaseMapFresh(
|
|
@@ -1611,14 +1734,18 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1611
1734
|
// Without this notify(), /gsd in step mode finishes a unit and silently
|
|
1612
1735
|
// exits the loop, leaving the user with no hint to /clear and /gsd again.
|
|
1613
1736
|
if (s.stepMode) {
|
|
1737
|
+
let phaseAfterUnit: string | null = null;
|
|
1614
1738
|
try {
|
|
1615
1739
|
const nextState = await deriveState(s.canonicalProjectRoot);
|
|
1740
|
+
phaseAfterUnit = nextState.phase;
|
|
1616
1741
|
ctx.ui.notify(buildStepCompleteMessage(nextState), "info");
|
|
1617
1742
|
} catch (e) {
|
|
1618
1743
|
debugLog("postUnit", { phase: "step-wizard-notify", error: String(e) });
|
|
1619
1744
|
ctx.ui.notify(STEP_COMPLETE_FALLBACK_MESSAGE, "info");
|
|
1620
1745
|
}
|
|
1621
|
-
return
|
|
1746
|
+
return shouldReturnStepWizardAfterUnit(s.currentUnit?.type, phaseAfterUnit)
|
|
1747
|
+
? "step-wizard"
|
|
1748
|
+
: "continue";
|
|
1622
1749
|
}
|
|
1623
1750
|
|
|
1624
1751
|
return "continue";
|
|
@@ -3197,7 +3197,7 @@ export async function buildParallelResearchSlicesPrompt(
|
|
|
3197
3197
|
subagentSections.push([
|
|
3198
3198
|
`### ${slice.id}: ${slice.title}`,
|
|
3199
3199
|
"",
|
|
3200
|
-
`Use this as the prompt for a \`subagent\` call${modelSuffix} (agent: \`
|
|
3200
|
+
`Use this as the prompt for a \`subagent\` call${modelSuffix} (agent: \`scout\`):`,
|
|
3201
3201
|
"",
|
|
3202
3202
|
"```",
|
|
3203
3203
|
slicePrompt,
|
|
@@ -3279,7 +3279,7 @@ export async function buildGateEvaluatePrompt(
|
|
|
3279
3279
|
subagentSections.push([
|
|
3280
3280
|
`### ${def.id}: ${def.question}`,
|
|
3281
3281
|
"",
|
|
3282
|
-
`Use this as the prompt for a \`subagent\` call${modelSuffix}:`,
|
|
3282
|
+
`Use this as the prompt for a \`subagent\` call${modelSuffix} (agent: \`tester\`):`,
|
|
3283
3283
|
"",
|
|
3284
3284
|
"```",
|
|
3285
3285
|
subPrompt,
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
47
47
|
import { validateArtifact } from "./schemas/validate.js";
|
|
48
48
|
import { getProjectResearchStatus } from "./project-research-policy.js";
|
|
49
|
+
import { isGsdWorktreePath } from "./worktree-root.js";
|
|
49
50
|
|
|
50
51
|
// Re-export so existing consumers of auto-recovery.ts keep working.
|
|
51
52
|
export { resolveExpectedArtifactPath, diagnoseExpectedArtifact };
|
|
@@ -56,6 +57,29 @@ export {
|
|
|
56
57
|
|
|
57
58
|
// ─── Artifact Resolution & Verification ───────────────────────────────────────
|
|
58
59
|
|
|
60
|
+
export function diagnoseWorktreeIntegrityFailure(basePath: string): string | null {
|
|
61
|
+
if (!isGsdWorktreePath(basePath)) return null;
|
|
62
|
+
if (!existsSync(basePath)) {
|
|
63
|
+
return `Worktree integrity failure: ${basePath} does not exist. Repair or recreate the worktree before retrying.`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const gitPath = join(basePath, ".git");
|
|
67
|
+
if (!existsSync(gitPath)) {
|
|
68
|
+
return `Worktree integrity failure: ${basePath} is not a valid git worktree (.git missing). Repair or recreate the worktree before retrying.`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
execFileSync("git", ["rev-parse", "--git-dir"], {
|
|
73
|
+
cwd: basePath,
|
|
74
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
75
|
+
encoding: "utf-8",
|
|
76
|
+
});
|
|
77
|
+
return null;
|
|
78
|
+
} catch (err) {
|
|
79
|
+
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.`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
59
83
|
export type ArtifactRecoveryDbRefreshResult =
|
|
60
84
|
| { ok: true }
|
|
61
85
|
| { ok: false; fatal: boolean; message: string; reason: string };
|
|
@@ -752,6 +776,11 @@ export function verifyExpectedArtifact(
|
|
|
752
776
|
return false;
|
|
753
777
|
}
|
|
754
778
|
if (!existsSync(absPath)) {
|
|
779
|
+
const worktreeFailure = diagnoseWorktreeIntegrityFailure(base);
|
|
780
|
+
if (worktreeFailure) {
|
|
781
|
+
logError("recovery", `${worktreeFailure} Unit: ${unitType} ${unitId}.`);
|
|
782
|
+
return false;
|
|
783
|
+
}
|
|
755
784
|
logWarning("recovery", `verify-fail ${unitType} ${unitId}: existsSync false for ${absPath}`);
|
|
756
785
|
return false;
|
|
757
786
|
}
|