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
|
@@ -21,7 +21,7 @@ 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, nativeCheckoutBranch, nativeBranchList, nativeBranchListMerged, nativeBranchDelete, nativeWorktreeRemove, nativeCommitCountBetween, } from "./native-git-bridge.js";
|
|
24
|
+
import { nativeIsRepo, nativeInit, nativeAddAll, nativeCommit, nativeGetCurrentBranch, nativeDetectMainBranch, nativeCheckoutBranch, 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
27
|
import { getAutoWorktreePath } from "./auto-worktree.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
|
|
@@ -18,9 +18,7 @@ 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
|
-
return /\b(ENOENT|ENOTFOUND|ETIMEDOUT|ECONNRESET|EAI_AGAIN|spawn\s+\S+\s+ENOENT|command not found)\b/i.test(stderr);
|
|
23
|
-
}
|
|
21
|
+
import { decideVerificationVerdict } from "./verification-verdict.js";
|
|
24
22
|
/**
|
|
25
23
|
* Post-unit guard for `validate-milestone` units (#4094).
|
|
26
24
|
*
|
|
@@ -128,7 +126,7 @@ async function countIncompleteSlices(basePath, milestoneId) {
|
|
|
128
126
|
/**
|
|
129
127
|
* Run the verification gate for the current execute-task unit.
|
|
130
128
|
* Returns:
|
|
131
|
-
* - "continue" —
|
|
129
|
+
* - "continue" — host-owned verification passed, proceed normally
|
|
132
130
|
* - "retry" — gate failed with retries remaining, s.pendingVerificationRetry set for loop re-iteration
|
|
133
131
|
* - "pause" — gate failed with retries exhausted, pauseAuto already called
|
|
134
132
|
*/
|
|
@@ -178,6 +176,10 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
178
176
|
process.stderr.write(` [${w.severity}] ${w.name}: ${w.title}\n`);
|
|
179
177
|
}
|
|
180
178
|
}
|
|
179
|
+
const verdict = decideVerificationVerdict(s.currentUnit.type, result);
|
|
180
|
+
if (!verdict.passed) {
|
|
181
|
+
result.passed = false;
|
|
182
|
+
}
|
|
181
183
|
if (uokFlags.gates) {
|
|
182
184
|
const gateRunner = new UokGateRunner();
|
|
183
185
|
gateRunner.register({
|
|
@@ -190,10 +192,12 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
190
192
|
: "verification",
|
|
191
193
|
rationale: result.passed
|
|
192
194
|
? "verification checks passed"
|
|
193
|
-
:
|
|
195
|
+
: verdict.reason === "no-host-checks"
|
|
196
|
+
? "no runnable host-owned verification checks discovered"
|
|
197
|
+
: "verification checks failed",
|
|
194
198
|
findings: result.passed
|
|
195
199
|
? ""
|
|
196
|
-
: formatFailureContext(result),
|
|
200
|
+
: verdict.failureContext || formatFailureContext(result),
|
|
197
201
|
}),
|
|
198
202
|
});
|
|
199
203
|
await gateRunner.run("verification-gate", {
|
|
@@ -251,7 +255,11 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
251
255
|
}
|
|
252
256
|
else {
|
|
253
257
|
const nextAttempt = attempt + 1;
|
|
254
|
-
|
|
258
|
+
const includeRetryMetadata = !result.passed &&
|
|
259
|
+
verdict.retryable &&
|
|
260
|
+
autoFixEnabled &&
|
|
261
|
+
nextAttempt <= maxRetries;
|
|
262
|
+
writeVerificationJSON(result, tasksDir, tid, s.currentUnit.id, includeRetryMetadata ? nextAttempt : undefined, includeRetryMetadata ? maxRetries : undefined);
|
|
255
263
|
}
|
|
256
264
|
}
|
|
257
265
|
}
|
|
@@ -259,18 +267,6 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
259
267
|
logWarning("engine", `verification-evidence write error: ${evidenceErr.message}`);
|
|
260
268
|
}
|
|
261
269
|
}
|
|
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
270
|
// ── Post-execution checks (run after main verification passes for execute-task units) ──
|
|
275
271
|
let postExecChecks;
|
|
276
272
|
let postExecBlockingFailure = false;
|
|
@@ -430,6 +426,15 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
430
426
|
s.pendingVerificationRetry = null;
|
|
431
427
|
return "continue";
|
|
432
428
|
}
|
|
429
|
+
else if (verdict.reason === "no-host-checks") {
|
|
430
|
+
s.verificationRetryCount.delete(retryKey);
|
|
431
|
+
s.verificationRetryFailureHashes.delete(retryKey);
|
|
432
|
+
s.pendingVerificationRetry = null;
|
|
433
|
+
ctx.ui.notify("Verification gate FAILED — no runnable host-owned verification checks were discovered. Pausing for human review.", "error");
|
|
434
|
+
process.stderr.write(`verification-gate: ${verdict.failureContext}\n`);
|
|
435
|
+
await pauseAuto(ctx, pi);
|
|
436
|
+
return "pause";
|
|
437
|
+
}
|
|
433
438
|
else if (postExecBlockingFailure) {
|
|
434
439
|
// Post-execution failures are cross-task consistency issues — retrying the same task won't fix them.
|
|
435
440
|
// Skip retry and pause immediately for human review.
|
|
@@ -445,7 +450,7 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
445
450
|
s.verificationRetryCount.set(retryKey, nextAttempt);
|
|
446
451
|
s.pendingVerificationRetry = {
|
|
447
452
|
unitId: s.currentUnit.id,
|
|
448
|
-
failureContext: formatFailureContext(result),
|
|
453
|
+
failureContext: verdict.failureContext || formatFailureContext(result),
|
|
449
454
|
attempt: nextAttempt,
|
|
450
455
|
};
|
|
451
456
|
const failedCmds = result.checks
|
|
@@ -475,9 +480,10 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
475
480
|
}
|
|
476
481
|
}
|
|
477
482
|
catch (err) {
|
|
478
|
-
// Gate errors are non-fatal
|
|
479
483
|
logWarning("engine", `verification-gate error: ${err.message}`);
|
|
480
|
-
|
|
484
|
+
ctx.ui.notify(`Verification gate errored before producing an authoritative verdict: ${err.message}`, "error");
|
|
485
|
+
await pauseAuto(ctx, pi);
|
|
486
|
+
return "pause";
|
|
481
487
|
}
|
|
482
488
|
}
|
|
483
489
|
/**
|
|
@@ -173,7 +173,18 @@ function gitPathspecForWorktreePath(basePath, targetPath) {
|
|
|
173
173
|
let base = basePath;
|
|
174
174
|
let target = targetPath;
|
|
175
175
|
try {
|
|
176
|
-
base =
|
|
176
|
+
base = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
177
|
+
cwd: basePath,
|
|
178
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
179
|
+
encoding: "utf-8",
|
|
180
|
+
}).trim() || basePath;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
/* keep original */
|
|
184
|
+
void base;
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
base = realpathSync.native(base);
|
|
177
188
|
}
|
|
178
189
|
catch {
|
|
179
190
|
/* keep original */
|
|
@@ -191,6 +202,9 @@ function gitPathspecForWorktreePath(basePath, targetPath) {
|
|
|
191
202
|
return null;
|
|
192
203
|
return rel.replaceAll("\\", "/");
|
|
193
204
|
}
|
|
205
|
+
export function _gitPathspecForWorktreePath(basePath, targetPath) {
|
|
206
|
+
return gitPathspecForWorktreePath(basePath, targetPath);
|
|
207
|
+
}
|
|
194
208
|
function gitRemoteExists(basePath, remote) {
|
|
195
209
|
try {
|
|
196
210
|
execFileSync("git", ["remote", "get-url", remote], {
|
|
@@ -204,6 +218,52 @@ function gitRemoteExists(basePath, remote) {
|
|
|
204
218
|
return false;
|
|
205
219
|
}
|
|
206
220
|
}
|
|
221
|
+
function findRegularMergeChangedPaths(basePath, milestoneBranch, mainBranch) {
|
|
222
|
+
const changedPaths = new Set();
|
|
223
|
+
let mergeLog = "";
|
|
224
|
+
try {
|
|
225
|
+
mergeLog = execFileSync("git", ["rev-list", "--merges", "--parents", mainBranch], {
|
|
226
|
+
cwd: basePath,
|
|
227
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
228
|
+
encoding: "utf-8",
|
|
229
|
+
}).trim();
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
logWarning("worktree", `regular merge lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
233
|
+
return changedPaths;
|
|
234
|
+
}
|
|
235
|
+
for (const line of mergeLog.split("\n").filter(Boolean)) {
|
|
236
|
+
const [mergeCommit, firstParent, ...otherParents] = line.split(" ");
|
|
237
|
+
if (!mergeCommit || !firstParent || otherParents.length === 0)
|
|
238
|
+
continue;
|
|
239
|
+
const mergedMilestone = otherParents.some((parent) => {
|
|
240
|
+
try {
|
|
241
|
+
return nativeIsAncestor(basePath, milestoneBranch, parent);
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
if (!mergedMilestone)
|
|
248
|
+
continue;
|
|
249
|
+
try {
|
|
250
|
+
const output = execFileSync("git", ["diff", "--name-only", firstParent, mergeCommit], {
|
|
251
|
+
cwd: basePath,
|
|
252
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
253
|
+
encoding: "utf-8",
|
|
254
|
+
}).trim();
|
|
255
|
+
for (const path of output.split("\n").filter(Boolean)) {
|
|
256
|
+
if (!path.startsWith(".gsd/"))
|
|
257
|
+
changedPaths.add(path);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
logWarning("worktree", `regular merge diff lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
262
|
+
}
|
|
263
|
+
return changedPaths;
|
|
264
|
+
}
|
|
265
|
+
return changedPaths;
|
|
266
|
+
}
|
|
207
267
|
function clearProjectRootStateFiles(basePath, milestoneId) {
|
|
208
268
|
const gsdDir = gsdRoot(basePath);
|
|
209
269
|
// Phase C pt 2: auto.lock removed from this list — the file is gone
|
|
@@ -1482,6 +1542,56 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1482
1542
|
});
|
|
1483
1543
|
}
|
|
1484
1544
|
}
|
|
1545
|
+
// Already regular-merged milestones can skip the squash path and proceed to cleanup (#5831).
|
|
1546
|
+
if (nativeIsAncestor(originalBasePath_, milestoneBranch, mainBranch)) {
|
|
1547
|
+
const codeChanges = nativeDiffNumstat(originalBasePath_, mainBranch, milestoneBranch).filter((entry) => !entry.path.startsWith(".gsd/"));
|
|
1548
|
+
if (codeChanges.length > 0) {
|
|
1549
|
+
const regularMergeChangedPaths = findRegularMergeChangedPaths(originalBasePath_, milestoneBranch, mainBranch);
|
|
1550
|
+
const unanchoredCodeChanges = codeChanges.filter((entry) => regularMergeChangedPaths.has(entry.path));
|
|
1551
|
+
if (unanchoredCodeChanges.length > 0) {
|
|
1552
|
+
process.chdir(previousCwd);
|
|
1553
|
+
throw new GSDError(GSD_GIT_ERROR, `Milestone branch "${milestoneBranch}" is reachable from "${mainBranch}" ` +
|
|
1554
|
+
`but has ${unanchoredCodeChanges.length} milestone-touched code file(s) not on current "${mainBranch}". ` +
|
|
1555
|
+
`Aborting worktree teardown to prevent data loss.`);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
debugLog("mergeMilestoneToMain", {
|
|
1559
|
+
action: "skip-squash-already-merged",
|
|
1560
|
+
milestoneId,
|
|
1561
|
+
milestoneBranch,
|
|
1562
|
+
mainBranch,
|
|
1563
|
+
});
|
|
1564
|
+
try {
|
|
1565
|
+
clearProjectRootStateFiles(originalBasePath_, milestoneId);
|
|
1566
|
+
}
|
|
1567
|
+
catch (err) {
|
|
1568
|
+
logWarning("worktree", `clearProjectRootStateFiles failed during already-merged cleanup: ${err instanceof Error ? err.message : String(err)}`);
|
|
1569
|
+
}
|
|
1570
|
+
try {
|
|
1571
|
+
removeWorktree(originalBasePath_, milestoneId, {
|
|
1572
|
+
branch: milestoneBranch,
|
|
1573
|
+
deleteBranch: false,
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
catch (err) {
|
|
1577
|
+
logWarning("worktree", `worktree removal failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1578
|
+
}
|
|
1579
|
+
try {
|
|
1580
|
+
nativeBranchDelete(originalBasePath_, milestoneBranch);
|
|
1581
|
+
}
|
|
1582
|
+
catch (err) {
|
|
1583
|
+
logWarning("worktree", `git branch-delete failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1584
|
+
}
|
|
1585
|
+
setActiveWorkspace(null);
|
|
1586
|
+
nudgeGitBranchCache(previousCwd);
|
|
1587
|
+
try {
|
|
1588
|
+
process.chdir(originalBasePath_);
|
|
1589
|
+
}
|
|
1590
|
+
catch (err) {
|
|
1591
|
+
logWarning("worktree", `chdir to project root after already-merged cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1592
|
+
}
|
|
1593
|
+
return { commitMessage, pushed: false, prCreated: false, codeFilesChanged: true };
|
|
1594
|
+
}
|
|
1485
1595
|
// 7. Shelter queued milestone directories before the squash merge (#2505).
|
|
1486
1596
|
// The milestone branch may contain copies of queued milestone dirs (via
|
|
1487
1597
|
// copyPlanningArtifacts), so `git merge --squash` rejects when those same
|
|
@@ -22,7 +22,7 @@ import { gsdRoot, resolveMilestoneFile, resolveMilestonePath, resolveDir, milest
|
|
|
22
22
|
import { invalidateAllCaches } from "./cache.js";
|
|
23
23
|
import { clearActivityLogState } from "./activity-log.js";
|
|
24
24
|
import { synthesizeCrashRecovery, getDeepDiagnostic, readActiveMilestoneId, } from "./session-forensics.js";
|
|
25
|
-
import { writeLock, clearLock, readCrashLock, isLockProcessAlive, formatCrashInfo, emitCrashRecoveredUnitEnd, emitOpenUnitEndForUnit, } from "./crash-recovery.js";
|
|
25
|
+
import { writeLock, clearLock, clearStaleWorkerLock, readCrashLock, isLockProcessAlive, formatCrashInfo, emitCrashRecoveredUnitEnd, emitOpenUnitEndForUnit, } from "./crash-recovery.js";
|
|
26
26
|
import { acquireSessionLock, getSessionLockStatus, releaseSessionLock, updateSessionLock, } from "./session-lock.js";
|
|
27
27
|
import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences, getIsolationMode, } from "./preferences.js";
|
|
28
28
|
import { sendDesktopNotification } from "./notifications.js";
|
|
@@ -707,6 +707,7 @@ export async function cleanupAfterLoopExit(ctx) {
|
|
|
707
707
|
// visible so the user still has a resumable auto-mode signal on screen.
|
|
708
708
|
if (!s.paused) {
|
|
709
709
|
ctx.ui.setStatus("gsd-auto", undefined);
|
|
710
|
+
ctx.ui.setWidget("gsd-progress", undefined);
|
|
710
711
|
if (s.completionStopInProgress) {
|
|
711
712
|
s.completionStopInProgress = false;
|
|
712
713
|
}
|
|
@@ -1420,6 +1421,13 @@ export function createWiredDispatchAdapter(ctx, pi, dispatchBasePath) {
|
|
|
1420
1421
|
sessionProvider,
|
|
1421
1422
|
modelRegistry,
|
|
1422
1423
|
});
|
|
1424
|
+
if (action.action === "stop") {
|
|
1425
|
+
return {
|
|
1426
|
+
kind: "blocked",
|
|
1427
|
+
reason: action.reason,
|
|
1428
|
+
action: action.level === "warning" ? "pause" : "stop",
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1423
1431
|
if (action.action !== "dispatch")
|
|
1424
1432
|
return null;
|
|
1425
1433
|
return {
|
|
@@ -1640,6 +1648,17 @@ export function createWiredAutoOrchestrationModule(ctx, pi, dispatchBasePath, ru
|
|
|
1640
1648
|
};
|
|
1641
1649
|
return createAutoOrchestrator(deps);
|
|
1642
1650
|
}
|
|
1651
|
+
function notifyResumeBlocked(ctx, result) {
|
|
1652
|
+
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
1653
|
+
ctx.ui.notify(`Auto-mode blocked: ${result.reason}. Fix and run ${resumeCmd} to resume.`, "warning");
|
|
1654
|
+
setLifecycleOutcome(ctx, {
|
|
1655
|
+
status: "blocked",
|
|
1656
|
+
title: "Auto-mode blocked",
|
|
1657
|
+
detail: result.reason,
|
|
1658
|
+
nextAction: `Fix the blocker, then run ${resumeCmd} to resume.`,
|
|
1659
|
+
commands: ["/gsd status for overview", `${resumeCmd} to resume`, "/gsd doctor to diagnose"],
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1643
1662
|
function ensureOrchestrationModule(ctx, pi, basePath) {
|
|
1644
1663
|
s.orchestration = createWiredAutoOrchestrationModule(ctx, pi, basePath, lockBase());
|
|
1645
1664
|
}
|
|
@@ -1924,7 +1943,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1924
1943
|
// This closes the journal gap reported in #3348 where the worker wrote side
|
|
1925
1944
|
// effects (SUMMARY.md, DB updates) but died before emitting unit-end.
|
|
1926
1945
|
emitCrashRecoveredUnitEnd(base, freshStartAssessment.lock);
|
|
1927
|
-
|
|
1946
|
+
clearStaleWorkerLock(base);
|
|
1928
1947
|
}
|
|
1929
1948
|
if (!s.paused) {
|
|
1930
1949
|
s.pendingCrashRecovery =
|
|
@@ -1987,6 +2006,8 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1987
2006
|
initMetrics(base);
|
|
1988
2007
|
if (s.currentMilestoneId)
|
|
1989
2008
|
setActiveMilestoneId(base, s.currentMilestoneId);
|
|
2009
|
+
await openProjectDbIfPresent(base);
|
|
2010
|
+
registerAutoWorkerForSession(s, base);
|
|
1990
2011
|
// Re-register health level notification callback lost across process restart
|
|
1991
2012
|
setLevelChangeCallback((_from, to, summary) => {
|
|
1992
2013
|
const level = to === "red" ? "error" : to === "yellow" ? "warning" : "info";
|
|
@@ -2062,7 +2083,12 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
2062
2083
|
}
|
|
2063
2084
|
pi.events.emit(CMUX_CHANNELS.LOG, { preferences: loadEffectiveGSDPreferences(s.basePath || undefined)?.preferences, message: s.stepMode ? "Step-mode resumed." : "Auto-mode resumed.", level: "progress" });
|
|
2064
2085
|
try {
|
|
2065
|
-
await s.orchestration?.resume();
|
|
2086
|
+
const resumeResult = await s.orchestration?.resume();
|
|
2087
|
+
if (resumeResult?.kind === "blocked") {
|
|
2088
|
+
notifyResumeBlocked(ctx, resumeResult);
|
|
2089
|
+
await cleanupAfterLoopExit(ctx);
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2066
2092
|
}
|
|
2067
2093
|
catch (err) {
|
|
2068
2094
|
debugLog("resume-orchestration-resume", { error: err instanceof Error ? err.message : String(err) });
|
|
@@ -2083,6 +2109,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
2083
2109
|
const bootstrapDeps = {
|
|
2084
2110
|
shouldUseWorktreeIsolation,
|
|
2085
2111
|
registerSigtermHandler,
|
|
2112
|
+
registerAutoWorkerForSession: (projectRoot) => registerAutoWorkerForSession(s, projectRoot),
|
|
2086
2113
|
lockBase,
|
|
2087
2114
|
buildLifecycle,
|
|
2088
2115
|
};
|
|
@@ -18,6 +18,9 @@ const MAX_NETWORK_RETRIES = 2;
|
|
|
18
18
|
function isObjectRecord(value) {
|
|
19
19
|
return !!value && typeof value === "object";
|
|
20
20
|
}
|
|
21
|
+
export function _hasEmptyAgentEndContent(content) {
|
|
22
|
+
return content == null || (Array.isArray(content) && content.length === 0);
|
|
23
|
+
}
|
|
21
24
|
/**
|
|
22
25
|
* Cap on auto-resume attempts for sustained transient-provider errors.
|
|
23
26
|
*
|
|
@@ -246,7 +249,7 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
246
249
|
// that carry error context — e.g. errorMessage field or non-empty content
|
|
247
250
|
// indicating a mid-stream failure. (#2695)
|
|
248
251
|
const content = "content" in lastMsg ? lastMsg.content : undefined;
|
|
249
|
-
const hasEmptyContent =
|
|
252
|
+
const hasEmptyContent = _hasEmptyAgentEndContent(content);
|
|
250
253
|
const hasErrorMessage = "errorMessage" in lastMsg && !!lastMsg.errorMessage;
|
|
251
254
|
if (hasEmptyContent && !hasErrorMessage) {
|
|
252
255
|
// Non-fatal: treat as a normal agent end so the loop can continue
|
|
@@ -468,17 +468,18 @@ export function registerDbTools(pi) {
|
|
|
468
468
|
promptGuidelines: [
|
|
469
469
|
"Use gsd_plan_milestone for milestone planning instead of writing ROADMAP.md directly.",
|
|
470
470
|
"Keep parameters flat and provide the full milestone planning payload, including slices.",
|
|
471
|
+
"Milestone and slice titles must not contain forward slash (/), en dash, or em dash characters.",
|
|
471
472
|
"The tool validates input, writes milestone and slice planning data transactionally, renders ROADMAP.md from DB, and clears both state and parse caches after success.",
|
|
472
473
|
"Use the canonical name gsd_plan_milestone; gsd_milestone_plan is only an alias.",
|
|
473
474
|
],
|
|
474
475
|
parameters: Type.Object({
|
|
475
476
|
// ── Core identification + content (required) ──────────────────────
|
|
476
477
|
milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
|
|
477
|
-
title: Type.String({ description: "Milestone title" }),
|
|
478
|
+
title: Type.String({ description: "Milestone title; must not contain forward slash (/), en dash, or em dash characters" }),
|
|
478
479
|
vision: Type.String({ description: "Milestone vision" }),
|
|
479
480
|
slices: Type.Array(Type.Object({
|
|
480
481
|
sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
|
|
481
|
-
title: Type.String({ description: "Slice title" }),
|
|
482
|
+
title: Type.String({ description: "Slice title; must not contain forward slash (/), en dash, or em dash characters" }),
|
|
482
483
|
risk: Type.String({ description: "Slice risk" }),
|
|
483
484
|
depends: Type.Array(Type.String(), { description: "Slice dependency IDs" }),
|
|
484
485
|
demo: Type.String({ description: "Roadmap demo text / After this" }),
|
|
@@ -546,10 +547,10 @@ export function registerDbTools(pi) {
|
|
|
546
547
|
title: Type.String({ description: "Task title" }),
|
|
547
548
|
description: Type.String({ description: "Task description / steps block" }),
|
|
548
549
|
estimate: Type.String({ description: "Task estimate string" }),
|
|
549
|
-
files: Type.Array(Type.String(), { description: "
|
|
550
|
+
files: Type.Array(Type.String(), { description: "Array<string> of files likely touched; pass [\"path\"] or [], never a single string" }),
|
|
550
551
|
verify: Type.String({ description: "Verification command or block" }),
|
|
551
|
-
inputs: Type.Array(Type.String(), { description: "
|
|
552
|
-
expectedOutput: Type.Array(Type.String(), { description: "
|
|
552
|
+
inputs: Type.Array(Type.String(), { description: "Array<string> of input files or references; pass [\"path\"] or [], never a single string" }),
|
|
553
|
+
expectedOutput: Type.Array(Type.String(), { description: "Array<string> of expected output files or artifacts; pass [\"path\"] or [], never a single string" }),
|
|
553
554
|
observabilityImpact: Type.Optional(Type.String({ description: "Task observability impact" })),
|
|
554
555
|
}), { description: "Planned tasks for the slice" }),
|
|
555
556
|
// ── Enrichment metadata (optional — defaults to empty) ────────────
|
|
@@ -622,10 +623,10 @@ export function registerDbTools(pi) {
|
|
|
622
623
|
title: Type.String({ description: "Task title" }),
|
|
623
624
|
description: Type.String({ description: "Task description / steps block" }),
|
|
624
625
|
estimate: Type.String({ description: "Task estimate string" }),
|
|
625
|
-
files: Type.Array(Type.String(), { description: "
|
|
626
|
+
files: Type.Array(Type.String(), { description: "Array<string> of files likely touched; pass [\"path\"] or [], never a single string" }),
|
|
626
627
|
verify: Type.String({ description: "Verification command or block" }),
|
|
627
|
-
inputs: Type.Array(Type.String(), { description: "
|
|
628
|
-
expectedOutput: Type.Array(Type.String(), { description: "
|
|
628
|
+
inputs: Type.Array(Type.String(), { description: "Array<string> of input files or references; pass [\"path\"] or [], never a single string" }),
|
|
629
|
+
expectedOutput: Type.Array(Type.String(), { description: "Array<string> of expected output files or artifacts; pass [\"path\"] or [], never a single string" }),
|
|
629
630
|
observabilityImpact: Type.Optional(Type.String({ description: "Task observability impact" })),
|
|
630
631
|
// Single-writer v3 audit trail (Stream 2): caller-provided actor identity + causation.
|
|
631
632
|
actorName: Type.Optional(Type.String({ description: "Caller-provided actor identity for the audit trail (e.g. 'executor-01', 'gsd-orchestrator')" })),
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
export function extractSubagentAgentClasses(input) {
|
|
2
2
|
if (!input || typeof input !== "object")
|
|
3
3
|
return [];
|
|
4
|
-
const record = input;
|
|
5
4
|
const agentClasses = [];
|
|
5
|
+
const visited = new WeakSet();
|
|
6
6
|
const addAgentClass = (value) => {
|
|
7
|
-
if (typeof value
|
|
8
|
-
|
|
7
|
+
if (typeof value !== "string")
|
|
8
|
+
return;
|
|
9
|
+
const normalized = value.trim().replace(/\.md$/i, "");
|
|
10
|
+
if (normalized.length > 0)
|
|
11
|
+
agentClasses.push(normalized);
|
|
9
12
|
};
|
|
10
|
-
const
|
|
13
|
+
const visitItems = (value) => {
|
|
11
14
|
if (!Array.isArray(value))
|
|
12
15
|
return;
|
|
13
16
|
for (const item of value) {
|
|
14
|
-
|
|
15
|
-
addAgentClass(item.agent);
|
|
17
|
+
visit(item);
|
|
16
18
|
}
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const visit = (value) => {
|
|
21
|
+
if (!value || typeof value !== "object")
|
|
22
|
+
return;
|
|
23
|
+
if (visited.has(value))
|
|
24
|
+
return;
|
|
25
|
+
visited.add(value);
|
|
26
|
+
const record = value;
|
|
27
|
+
addAgentClass(record.agent);
|
|
28
|
+
visitItems(record.tasks);
|
|
29
|
+
visitItems(record.chain);
|
|
30
|
+
visitItems(record.parallel);
|
|
31
|
+
};
|
|
32
|
+
visit(input);
|
|
21
33
|
return agentClasses;
|
|
22
34
|
}
|