gsd-pi 2.62.1 → 2.63.0-dev.351157b
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 +46 -134
- package/dist/cli.js +44 -6
- package/dist/help-text.js +4 -1
- package/dist/onboarding.js +15 -8
- package/dist/resource-loader.js +18 -3
- package/dist/resources/extensions/cmux/index.js +21 -12
- package/dist/resources/extensions/gsd/auto/finalize-timeout.js +40 -0
- package/dist/resources/extensions/gsd/auto/loop.js +12 -1
- package/dist/resources/extensions/gsd/auto/phases.js +133 -25
- package/dist/resources/extensions/gsd/auto/session.js +8 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +9 -3
- package/dist/resources/extensions/gsd/auto-post-unit.js +47 -10
- package/dist/resources/extensions/gsd/auto-prompts.js +25 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +15 -7
- package/dist/resources/extensions/gsd/auto-start.js +10 -21
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +17 -0
- package/dist/resources/extensions/gsd/auto-verification.js +14 -3
- package/dist/resources/extensions/gsd/auto-worktree.js +13 -7
- package/dist/resources/extensions/gsd/auto.js +19 -2
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +73 -60
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +13 -0
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +85 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +3 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +9 -1
- package/dist/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.js +54 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +9 -4
- package/dist/resources/extensions/gsd/constants.js +42 -0
- package/dist/resources/extensions/gsd/db-writer.js +72 -4
- package/dist/resources/extensions/gsd/forensics.js +20 -4
- package/dist/resources/extensions/gsd/gsd-db.js +64 -17
- package/dist/resources/extensions/gsd/guided-flow.js +19 -0
- package/dist/resources/extensions/gsd/metrics.js +27 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +5 -3
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences.js +7 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -0
- package/dist/resources/extensions/gsd/prompts/doctor-heal.md +1 -0
- package/dist/resources/extensions/gsd/prompts/forensics.md +2 -0
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +2 -0
- package/dist/resources/extensions/gsd/prompts/system.md +1 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/dist/resources/extensions/gsd/roadmap-mutations.js +1 -1
- package/dist/resources/extensions/gsd/roadmap-slices.js +9 -5
- package/dist/resources/extensions/gsd/slice-parallel-conflict.js +67 -0
- package/dist/resources/extensions/gsd/slice-parallel-eligibility.js +51 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +378 -0
- package/dist/resources/extensions/gsd/state.js +75 -14
- package/dist/resources/extensions/gsd/status-guards.js +11 -0
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +17 -12
- package/dist/resources/extensions/gsd/tools/complete-slice.js +43 -29
- package/dist/resources/extensions/gsd/tools/complete-task.js +12 -12
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +33 -25
- package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -8
- package/dist/resources/extensions/gsd/workflow-logger.js +13 -8
- package/dist/resources/extensions/gsd/workflow-projections.js +21 -5
- package/dist/resources/extensions/gsd/workflow-reconcile.js +3 -1
- package/dist/resources/extensions/gsd/worktree-manager.js +82 -29
- package/dist/resources/extensions/gsd/worktree-resolver.js +4 -3
- package/dist/resources/extensions/mcp-client/auth.js +101 -0
- package/dist/resources/extensions/mcp-client/index.js +10 -1
- package/dist/resources/extensions/ollama/index.js +6 -12
- package/dist/resources/extensions/ollama/model-capabilities.js +37 -34
- package/dist/resources/extensions/ollama/ndjson-stream.js +54 -0
- package/dist/resources/extensions/ollama/ollama-chat-provider.js +380 -0
- package/dist/resources/extensions/ollama/ollama-client.js +23 -32
- package/dist/resources/extensions/ollama/ollama-discovery.js +2 -7
- package/dist/resources/extensions/ollama/ollama-tool.js +62 -0
- package/dist/resources/extensions/ollama/thinking-parser.js +104 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
- 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/required-server-files.json +4 -4
- package/dist/web/standalone/.next/server/app/_global-error/page.js +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 +2 -2
- 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_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 +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- 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 +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- 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 +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
- package/dist/web/standalone/.next/server/chunks/6897.js +12 -0
- package/dist/web/standalone/.next/server/chunks/7471.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +2 -2
- 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 +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-0c485498795110d6.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.d.ts +8 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +50 -0
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +221 -5
- package/packages/pi-agent-core/src/agent-loop.ts +53 -0
- package/packages/pi-ai/dist/types.d.ts +16 -1
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/src/types.ts +18 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +50 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js +41 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +31 -4
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.js +28 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -3
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +23 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +80 -56
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +10 -0
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/auth-storage.test.ts +53 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +66 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.test.ts +39 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +34 -4
- package/packages/pi-coding-agent/src/core/extensions/types.ts +2 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +2 -0
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -3
- package/packages/pi-coding-agent/src/core/resource-loader.ts +89 -56
- package/packages/pi-coding-agent/src/core/sdk.ts +11 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/cmux/index.ts +18 -12
- package/src/resources/extensions/gsd/auto/finalize-timeout.ts +46 -0
- package/src/resources/extensions/gsd/auto/loop.ts +13 -1
- package/src/resources/extensions/gsd/auto/phases.ts +164 -40
- package/src/resources/extensions/gsd/auto/session.ts +9 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +11 -3
- package/src/resources/extensions/gsd/auto-post-unit.ts +56 -12
- package/src/resources/extensions/gsd/auto-prompts.ts +21 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +9 -8
- package/src/resources/extensions/gsd/auto-start.ts +11 -20
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +19 -0
- package/src/resources/extensions/gsd/auto-verification.ts +14 -3
- package/src/resources/extensions/gsd/auto-worktree.ts +14 -6
- package/src/resources/extensions/gsd/auto.ts +22 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +74 -60
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +15 -0
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +98 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +4 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +9 -1
- package/src/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.ts +57 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +10 -4
- package/src/resources/extensions/gsd/constants.ts +44 -0
- package/src/resources/extensions/gsd/db-writer.ts +78 -4
- package/src/resources/extensions/gsd/forensics.ts +21 -5
- package/src/resources/extensions/gsd/gsd-db.ts +64 -17
- package/src/resources/extensions/gsd/guided-flow.ts +22 -0
- package/src/resources/extensions/gsd/metrics.ts +28 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +5 -3
- package/src/resources/extensions/gsd/preferences-types.ts +3 -0
- package/src/resources/extensions/gsd/preferences.ts +9 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -0
- package/src/resources/extensions/gsd/prompts/doctor-heal.md +1 -0
- package/src/resources/extensions/gsd/prompts/forensics.md +2 -0
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +2 -0
- package/src/resources/extensions/gsd/prompts/system.md +1 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/src/resources/extensions/gsd/roadmap-mutations.ts +1 -1
- package/src/resources/extensions/gsd/roadmap-slices.ts +10 -5
- package/src/resources/extensions/gsd/slice-parallel-conflict.ts +86 -0
- package/src/resources/extensions/gsd/slice-parallel-eligibility.ts +73 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +477 -0
- package/src/resources/extensions/gsd/state.ts +68 -12
- package/src/resources/extensions/gsd/status-guards.ts +13 -0
- package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +288 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +34 -13
- package/src/resources/extensions/gsd/tests/cmux.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/dashboard-model-label-ordering.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/db-access-guardrails.test.ts +109 -0
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +13 -9
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/deferred-slice-dispatch.test.ts +203 -0
- package/src/resources/extensions/gsd/tests/discuss-tool-scoping.test.ts +130 -0
- package/src/resources/extensions/gsd/tests/doctor-fix-flag.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/insert-slice-no-wipe.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +27 -7
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/metrics.test.ts +116 -1
- package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +201 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-title.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +82 -18
- package/src/resources/extensions/gsd/tests/preferences.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/shared-wal.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-conflict.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-eligibility.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +349 -0
- package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +17 -41
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +35 -2
- package/src/resources/extensions/gsd/tests/worktree-health-monorepo.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +148 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +34 -20
- package/src/resources/extensions/gsd/tools/complete-slice.ts +44 -31
- package/src/resources/extensions/gsd/tools/complete-task.ts +12 -12
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +55 -30
- package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -8
- package/src/resources/extensions/gsd/types.ts +44 -22
- package/src/resources/extensions/gsd/workflow-logger.ts +13 -8
- package/src/resources/extensions/gsd/workflow-projections.ts +23 -5
- package/src/resources/extensions/gsd/workflow-reconcile.ts +3 -1
- package/src/resources/extensions/gsd/worktree-manager.ts +76 -28
- package/src/resources/extensions/gsd/worktree-resolver.ts +4 -3
- package/src/resources/extensions/mcp-client/auth.ts +149 -0
- package/src/resources/extensions/mcp-client/index.ts +16 -1
- package/src/resources/extensions/ollama/index.ts +6 -14
- package/src/resources/extensions/ollama/model-capabilities.ts +41 -34
- package/src/resources/extensions/ollama/ndjson-stream.ts +63 -0
- package/src/resources/extensions/ollama/ollama-chat-provider.ts +459 -0
- package/src/resources/extensions/ollama/ollama-client.ts +30 -30
- package/src/resources/extensions/ollama/ollama-discovery.ts +5 -8
- package/src/resources/extensions/ollama/ollama-tool.ts +69 -0
- package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +0 -27
- package/src/resources/extensions/ollama/thinking-parser.ts +116 -0
- package/src/resources/extensions/ollama/types.ts +23 -0
- package/dist/web/standalone/.next/server/chunks/2229.js +0 -12
- package/dist/web/standalone/.next/static/chunks/app/page-62be3b5fa91e4c8f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- /package/dist/web/standalone/.next/static/{86gWhNPP3233lZ7KPwda7 → QmuF-eAbuU_2MQ03t38qr}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{86gWhNPP3233lZ7KPwda7 → QmuF-eAbuU_2MQ03t38qr}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* discuss-tool-scoping.test.ts — Tests for #2949.
|
|
3
|
+
*
|
|
4
|
+
* xAI/Grok returns "Grammar is too complex" (400) when the combined tool
|
|
5
|
+
* schemas exceed the provider's grammar limit. The GSD discuss flow only
|
|
6
|
+
* needs a small subset of tools (summary_save, decision_save, etc.), but
|
|
7
|
+
* was sending ALL ~30+ tools to the provider.
|
|
8
|
+
*
|
|
9
|
+
* These tests verify:
|
|
10
|
+
* 1. DISCUSS_TOOLS_ALLOWLIST is exported and contains only the tools
|
|
11
|
+
* needed during discuss flows (no heavy planning/execution/completion tools).
|
|
12
|
+
* 2. Heavy execution tools are NOT in the allowlist.
|
|
13
|
+
* 3. The allowlist includes the tools actually referenced by discuss prompts.
|
|
14
|
+
* 4. dispatchWorkflow scopes tools when unitType is a discuss variant.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, test } from "node:test";
|
|
18
|
+
import assert from "node:assert/strict";
|
|
19
|
+
import { readFileSync } from "node:fs";
|
|
20
|
+
import { join, dirname } from "node:path";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
|
|
23
|
+
import { DISCUSS_TOOLS_ALLOWLIST } from "../constants.ts";
|
|
24
|
+
|
|
25
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const promptsDir = join(__dirname, "..", "prompts");
|
|
27
|
+
const guidedFlowPath = join(__dirname, "..", "guided-flow.ts");
|
|
28
|
+
|
|
29
|
+
// ─── Heavy tools that should NOT be in discuss scope ─────────────────────────
|
|
30
|
+
|
|
31
|
+
/** Tools that are only needed during planning, execution, or completion phases */
|
|
32
|
+
const HEAVY_TOOLS = [
|
|
33
|
+
"gsd_plan_slice",
|
|
34
|
+
"gsd_slice_plan",
|
|
35
|
+
"gsd_plan_task",
|
|
36
|
+
"gsd_task_plan",
|
|
37
|
+
"gsd_task_complete",
|
|
38
|
+
"gsd_complete_task",
|
|
39
|
+
"gsd_slice_complete",
|
|
40
|
+
"gsd_complete_slice",
|
|
41
|
+
"gsd_complete_milestone",
|
|
42
|
+
"gsd_milestone_complete",
|
|
43
|
+
"gsd_validate_milestone",
|
|
44
|
+
"gsd_milestone_validate",
|
|
45
|
+
"gsd_replan_slice",
|
|
46
|
+
"gsd_slice_replan",
|
|
47
|
+
"gsd_reassess_roadmap",
|
|
48
|
+
"gsd_roadmap_reassess",
|
|
49
|
+
"gsd_save_gate_result",
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
// ─── Tools that discuss prompts reference ────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
/** Tools explicitly called by discuss prompt templates */
|
|
55
|
+
const DISCUSS_REQUIRED_TOOLS = [
|
|
56
|
+
"gsd_summary_save", // guided-discuss-slice.md, guided-discuss-milestone.md, discuss.md
|
|
57
|
+
"gsd_decision_save", // discuss.md output phase
|
|
58
|
+
"gsd_plan_milestone", // discuss.md output phase (single + multi milestone)
|
|
59
|
+
"gsd_milestone_generate_id", // discuss.md multi-milestone Phase 1
|
|
60
|
+
"gsd_requirement_update", // used during discuss for requirement updates
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
// ─── Tests ───────────────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
describe("discuss tool scoping (#2949)", () => {
|
|
66
|
+
test("DISCUSS_TOOLS_ALLOWLIST is exported and non-empty", () => {
|
|
67
|
+
assert.ok(Array.isArray(DISCUSS_TOOLS_ALLOWLIST), "should be an array");
|
|
68
|
+
assert.ok(DISCUSS_TOOLS_ALLOWLIST.length > 0, "should not be empty");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("DISCUSS_TOOLS_ALLOWLIST excludes heavy execution/completion tools", () => {
|
|
72
|
+
for (const heavy of HEAVY_TOOLS) {
|
|
73
|
+
assert.ok(
|
|
74
|
+
!DISCUSS_TOOLS_ALLOWLIST.includes(heavy),
|
|
75
|
+
`allowlist should NOT include heavy tool "${heavy}"`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test("DISCUSS_TOOLS_ALLOWLIST includes tools referenced by discuss prompts", () => {
|
|
81
|
+
for (const required of DISCUSS_REQUIRED_TOOLS) {
|
|
82
|
+
assert.ok(
|
|
83
|
+
DISCUSS_TOOLS_ALLOWLIST.includes(required),
|
|
84
|
+
`allowlist should include "${required}" (used by discuss prompts)`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("DISCUSS_TOOLS_ALLOWLIST is significantly smaller than full tool set", () => {
|
|
90
|
+
// Full set is 27 DB tools + dynamic + journal = 33+
|
|
91
|
+
// Discuss set should be roughly 10 GSD tools (5 canonical + 5 aliases)
|
|
92
|
+
assert.ok(
|
|
93
|
+
DISCUSS_TOOLS_ALLOWLIST.length <= 12,
|
|
94
|
+
`allowlist should have at most 12 GSD tools, got ${DISCUSS_TOOLS_ALLOWLIST.length}`,
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("guided-discuss-slice.md references gsd_summary_save", () => {
|
|
99
|
+
const prompt = readFileSync(join(promptsDir, "guided-discuss-slice.md"), "utf-8");
|
|
100
|
+
assert.ok(
|
|
101
|
+
prompt.includes("gsd_summary_save"),
|
|
102
|
+
"guided-discuss-slice.md should reference gsd_summary_save",
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("discuss.md references gsd_plan_milestone and gsd_decision_save", () => {
|
|
107
|
+
const prompt = readFileSync(join(promptsDir, "discuss.md"), "utf-8");
|
|
108
|
+
assert.ok(
|
|
109
|
+
prompt.includes("gsd_plan_milestone"),
|
|
110
|
+
"discuss.md should reference gsd_plan_milestone",
|
|
111
|
+
);
|
|
112
|
+
assert.ok(
|
|
113
|
+
prompt.includes("gsd_decision_save"),
|
|
114
|
+
"discuss.md should reference gsd_decision_save",
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test("dispatchWorkflow source code scopes tools for discuss unit types", () => {
|
|
119
|
+
const source = readFileSync(guidedFlowPath, "utf-8");
|
|
120
|
+
// Verify that dispatchWorkflow references the allowlist for tool scoping
|
|
121
|
+
assert.ok(
|
|
122
|
+
source.includes("DISCUSS_TOOLS_ALLOWLIST"),
|
|
123
|
+
"guided-flow.ts should reference DISCUSS_TOOLS_ALLOWLIST for tool scoping",
|
|
124
|
+
);
|
|
125
|
+
assert.ok(
|
|
126
|
+
source.includes("setActiveTools"),
|
|
127
|
+
"guided-flow.ts should call setActiveTools to scope tools during discuss",
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test for #1919: --fix flag not stripped before positional parse.
|
|
3
|
+
*
|
|
4
|
+
* parseDoctorArgs("--fix") must:
|
|
5
|
+
* 1. Set fixFlag = true
|
|
6
|
+
* 2. Not leak "--fix" into requestedScope
|
|
7
|
+
* 3. Keep mode as "doctor" (the flag is not a positional subcommand)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { parseDoctorArgs } from "../commands-handlers.js";
|
|
11
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
12
|
+
|
|
13
|
+
const { assertEq, assertTrue, report } = createTestContext();
|
|
14
|
+
|
|
15
|
+
async function main(): Promise<void> {
|
|
16
|
+
// ── 1. Bare --fix flag ──────────────────────────────────────────────────────
|
|
17
|
+
console.log("\n=== bare --fix flag (#1919) ===");
|
|
18
|
+
{
|
|
19
|
+
const r = parseDoctorArgs("--fix");
|
|
20
|
+
assertTrue(r.fixFlag, "--fix sets fixFlag to true");
|
|
21
|
+
assertEq(r.mode, "doctor", "--fix does not change mode from doctor");
|
|
22
|
+
assertEq(r.requestedScope, undefined, "--fix is stripped and does not become requestedScope");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ── 2. --fix with a scope ──────────────────────────────────────────────────
|
|
26
|
+
console.log("\n=== --fix with scope ===");
|
|
27
|
+
{
|
|
28
|
+
const r = parseDoctorArgs("--fix M001/S01");
|
|
29
|
+
assertTrue(r.fixFlag, "--fix M001/S01 sets fixFlag to true");
|
|
30
|
+
assertEq(r.mode, "doctor", "--fix M001/S01 keeps mode as doctor");
|
|
31
|
+
assertEq(r.requestedScope, "M001/S01", "scope is M001/S01 after stripping --fix");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ── 3. Positional fix still works ──────────────────────────────────────────
|
|
35
|
+
console.log("\n=== positional fix subcommand ===");
|
|
36
|
+
{
|
|
37
|
+
const r = parseDoctorArgs("fix");
|
|
38
|
+
assertEq(r.fixFlag, false, "positional fix does not set fixFlag");
|
|
39
|
+
assertEq(r.mode, "fix", "positional fix sets mode to fix");
|
|
40
|
+
assertEq(r.requestedScope, undefined, "no scope with bare positional fix");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ── 4. Positional fix with scope ───────────────────────────────────────────
|
|
44
|
+
console.log("\n=== positional fix with scope ===");
|
|
45
|
+
{
|
|
46
|
+
const r = parseDoctorArgs("fix M001");
|
|
47
|
+
assertEq(r.mode, "fix", "fix M001 sets mode to fix");
|
|
48
|
+
assertEq(r.requestedScope, "M001", "fix M001 parses scope as M001");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── 5. --fix combined with other flags ─────────────────────────────────────
|
|
52
|
+
console.log("\n=== --fix combined with --dry-run ===");
|
|
53
|
+
{
|
|
54
|
+
const r = parseDoctorArgs("--fix --dry-run");
|
|
55
|
+
assertTrue(r.fixFlag, "--fix --dry-run sets fixFlag");
|
|
56
|
+
assertTrue(r.dryRun, "--fix --dry-run sets dryRun");
|
|
57
|
+
assertEq(r.requestedScope, undefined, "no scope leaked from combined flags");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ── 6. --fix combined with --json ──────────────────────────────────────────
|
|
61
|
+
console.log("\n=== --fix with --json ===");
|
|
62
|
+
{
|
|
63
|
+
const r = parseDoctorArgs("--fix --json");
|
|
64
|
+
assertTrue(r.fixFlag, "--fix --json sets fixFlag");
|
|
65
|
+
assertTrue(r.jsonMode, "--fix --json sets jsonMode");
|
|
66
|
+
assertEq(r.requestedScope, undefined, "no scope leaked from --fix --json");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ── 7. Empty args (baseline) ───────────────────────────────────────────────
|
|
70
|
+
console.log("\n=== empty args baseline ===");
|
|
71
|
+
{
|
|
72
|
+
const r = parseDoctorArgs("");
|
|
73
|
+
assertEq(r.fixFlag, false, "empty args: fixFlag false");
|
|
74
|
+
assertEq(r.mode, "doctor", "empty args: mode is doctor");
|
|
75
|
+
assertEq(r.requestedScope, undefined, "empty args: no scope");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ── 8. heal and audit modes unaffected ─────────────────────────────────────
|
|
79
|
+
console.log("\n=== heal and audit modes ===");
|
|
80
|
+
{
|
|
81
|
+
const rh = parseDoctorArgs("heal M001/S01");
|
|
82
|
+
assertEq(rh.mode, "heal", "heal mode parsed correctly");
|
|
83
|
+
assertEq(rh.requestedScope, "M001/S01", "heal scope parsed correctly");
|
|
84
|
+
|
|
85
|
+
const ra = parseDoctorArgs("audit");
|
|
86
|
+
assertEq(ra.mode, "audit", "audit mode parsed correctly");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
report();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main();
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test for #2344: Auto-loop hangs after plan-slice completes
|
|
3
|
+
* because postUnitPostVerification() never resolves.
|
|
4
|
+
*
|
|
5
|
+
* When postUnitPostVerification() hangs (e.g., due to a module import
|
|
6
|
+
* deadlock or SQLite transaction hang), the auto-loop blocks forever
|
|
7
|
+
* with no error message, no notification, and no recovery.
|
|
8
|
+
*
|
|
9
|
+
* The fix adds a timeout guard around postUnitPostVerification() in
|
|
10
|
+
* runFinalize(). If it doesn't resolve within the timeout, the function
|
|
11
|
+
* force-returns "continue" and logs an error, allowing the loop to
|
|
12
|
+
* proceed to the next iteration.
|
|
13
|
+
*
|
|
14
|
+
* This test verifies the timeout utility used by the fix, since the
|
|
15
|
+
* full runFinalize function has too many transitive dependencies for
|
|
16
|
+
* isolated unit testing.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
20
|
+
import {
|
|
21
|
+
withTimeout,
|
|
22
|
+
FINALIZE_POST_TIMEOUT_MS,
|
|
23
|
+
} from "../auto/finalize-timeout.ts";
|
|
24
|
+
|
|
25
|
+
const { assertTrue, assertEq, report } = createTestContext();
|
|
26
|
+
|
|
27
|
+
// ═══ Test: withTimeout resolves when inner promise resolves promptly ══════════
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
console.log("\n=== #2344: withTimeout passes through when promise resolves ===");
|
|
31
|
+
|
|
32
|
+
const result = await withTimeout(
|
|
33
|
+
Promise.resolve("ok"),
|
|
34
|
+
1000,
|
|
35
|
+
"test-timeout",
|
|
36
|
+
);
|
|
37
|
+
assertEq(result.value, "ok", "should return inner value");
|
|
38
|
+
assertEq(result.timedOut, false, "should not be timed out");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ═══ Test: withTimeout returns fallback when inner promise hangs ══════════════
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
console.log("\n=== #2344: withTimeout returns fallback on hang ===");
|
|
45
|
+
|
|
46
|
+
const startTime = Date.now();
|
|
47
|
+
const result = await withTimeout(
|
|
48
|
+
new Promise<string>(() => {
|
|
49
|
+
// Never resolves
|
|
50
|
+
}),
|
|
51
|
+
100, // short timeout for testing
|
|
52
|
+
"test-timeout",
|
|
53
|
+
);
|
|
54
|
+
const elapsed = Date.now() - startTime;
|
|
55
|
+
|
|
56
|
+
assertEq(result.timedOut, true, "should report timeout");
|
|
57
|
+
assertEq(result.value, undefined, "value should be undefined on timeout");
|
|
58
|
+
assertTrue(elapsed >= 90, `should wait at least 90ms (took ${elapsed}ms)`);
|
|
59
|
+
assertTrue(elapsed < 500, `should not wait too long (took ${elapsed}ms)`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ═══ Test: withTimeout handles rejection gracefully ═══════════════════════════
|
|
63
|
+
|
|
64
|
+
{
|
|
65
|
+
console.log("\n=== #2344: withTimeout propagates rejection ===");
|
|
66
|
+
|
|
67
|
+
let caught = false;
|
|
68
|
+
try {
|
|
69
|
+
await withTimeout(
|
|
70
|
+
Promise.reject(new Error("boom")),
|
|
71
|
+
1000,
|
|
72
|
+
"test-timeout",
|
|
73
|
+
);
|
|
74
|
+
} catch (err: any) {
|
|
75
|
+
caught = true;
|
|
76
|
+
assertEq(err.message, "boom", "should propagate the error");
|
|
77
|
+
}
|
|
78
|
+
assertTrue(caught, "rejection should propagate");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ═══ Test: FINALIZE_POST_TIMEOUT_MS is defined and reasonable ═════════════════
|
|
82
|
+
|
|
83
|
+
{
|
|
84
|
+
console.log("\n=== #2344: timeout constant is defined and reasonable ===");
|
|
85
|
+
|
|
86
|
+
assertTrue(
|
|
87
|
+
typeof FINALIZE_POST_TIMEOUT_MS === "number",
|
|
88
|
+
"FINALIZE_POST_TIMEOUT_MS should be a number",
|
|
89
|
+
);
|
|
90
|
+
assertTrue(
|
|
91
|
+
FINALIZE_POST_TIMEOUT_MS >= 30_000,
|
|
92
|
+
`timeout should be >= 30s (got ${FINALIZE_POST_TIMEOUT_MS}ms)`,
|
|
93
|
+
);
|
|
94
|
+
assertTrue(
|
|
95
|
+
FINALIZE_POST_TIMEOUT_MS <= 120_000,
|
|
96
|
+
`timeout should be <= 120s (got ${FINALIZE_POST_TIMEOUT_MS}ms)`,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ═══ Test: withTimeout cleans up timer on success ════════════════════════════
|
|
101
|
+
|
|
102
|
+
{
|
|
103
|
+
console.log("\n=== #2344: withTimeout cleans up timer on success ===");
|
|
104
|
+
|
|
105
|
+
// If the timer isn't cleaned up, this test would keep the process alive.
|
|
106
|
+
// Relying on process.exit behavior — if test completes, timers were cleaned.
|
|
107
|
+
const result = await withTimeout(
|
|
108
|
+
new Promise<string>((r) => setTimeout(() => r("delayed"), 50)),
|
|
109
|
+
5000,
|
|
110
|
+
"cleanup-test",
|
|
111
|
+
);
|
|
112
|
+
assertEq(result.value, "delayed", "should resolve with delayed value");
|
|
113
|
+
assertEq(result.timedOut, false, "should not time out");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
report();
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forensics detectStuckLoops tests — #1943
|
|
3
|
+
*
|
|
4
|
+
* Verifies that detectStuckLoops counts distinct dispatches (unique startedAt
|
|
5
|
+
* values per type/id) instead of raw entry count, which produces false-positive
|
|
6
|
+
* stuck-loop anomalies when idle-watchdog duplicate metrics entries exist.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import test from "node:test";
|
|
10
|
+
import assert from "node:assert/strict";
|
|
11
|
+
import type { UnitMetrics } from "../metrics.js";
|
|
12
|
+
import { detectStuckLoops, type ForensicAnomaly } from "../forensics.js";
|
|
13
|
+
|
|
14
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
function makeUnit(overrides: Partial<UnitMetrics> = {}): UnitMetrics {
|
|
17
|
+
return {
|
|
18
|
+
type: "execute-task",
|
|
19
|
+
id: "M001/S01/T01",
|
|
20
|
+
model: "claude-sonnet-4-20250514",
|
|
21
|
+
startedAt: 1000,
|
|
22
|
+
finishedAt: 2000,
|
|
23
|
+
tokens: { input: 1000, output: 500, cacheRead: 200, cacheWrite: 100, total: 1800 },
|
|
24
|
+
cost: 0.05,
|
|
25
|
+
toolCalls: 3,
|
|
26
|
+
assistantMessages: 2,
|
|
27
|
+
userMessages: 1,
|
|
28
|
+
...overrides,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// ── Tests ────────────────────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
test("#1943 detectStuckLoops does not flag idle-watchdog duplicates as stuck loops", () => {
|
|
36
|
+
const anomalies: ForensicAnomaly[] = [];
|
|
37
|
+
const startedAt = 1774011016218;
|
|
38
|
+
|
|
39
|
+
// 20 entries with the SAME startedAt — these are idle-watchdog duplicates,
|
|
40
|
+
// not real re-dispatches. They should count as 1 dispatch.
|
|
41
|
+
const units: UnitMetrics[] = [];
|
|
42
|
+
for (let i = 0; i < 20; i++) {
|
|
43
|
+
units.push(makeUnit({
|
|
44
|
+
type: "research-slice",
|
|
45
|
+
id: "M009/S02",
|
|
46
|
+
startedAt,
|
|
47
|
+
finishedAt: startedAt + (i + 1) * 15000,
|
|
48
|
+
cost: 1.50 + i * 0.05,
|
|
49
|
+
toolCalls: 0,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
detectStuckLoops(units, anomalies);
|
|
54
|
+
|
|
55
|
+
// A single dispatch (same startedAt) should NOT trigger a stuck-loop anomaly
|
|
56
|
+
assert.equal(
|
|
57
|
+
anomalies.length, 0,
|
|
58
|
+
`expected 0 anomalies for 20 watchdog snapshots of the same dispatch, got ${anomalies.length}: ${anomalies.map(a => a.summary).join(", ")}`,
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("#1943 detectStuckLoops correctly flags real re-dispatches", () => {
|
|
63
|
+
const anomalies: ForensicAnomaly[] = [];
|
|
64
|
+
|
|
65
|
+
// 3 entries with DIFFERENT startedAt values — these are real re-dispatches
|
|
66
|
+
const units: UnitMetrics[] = [
|
|
67
|
+
makeUnit({ type: "execute-task", id: "M001/S01/T01", startedAt: 1000, finishedAt: 2000, cost: 0.05 }),
|
|
68
|
+
makeUnit({ type: "execute-task", id: "M001/S01/T01", startedAt: 3000, finishedAt: 4000, cost: 0.06 }),
|
|
69
|
+
makeUnit({ type: "execute-task", id: "M001/S01/T01", startedAt: 5000, finishedAt: 6000, cost: 0.07 }),
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
detectStuckLoops(units, anomalies);
|
|
73
|
+
|
|
74
|
+
assert.equal(anomalies.length, 1, "3 distinct dispatches of the same unit should flag 1 anomaly");
|
|
75
|
+
assert.equal(anomalies[0].type, "stuck-loop");
|
|
76
|
+
assert.ok(anomalies[0].summary.includes("3 times"), `summary should mention 3 dispatches: ${anomalies[0].summary}`);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test("#1943 detectStuckLoops ignores watchdog duplicates but flags real re-dispatches in mixed data", () => {
|
|
80
|
+
const anomalies: ForensicAnomaly[] = [];
|
|
81
|
+
|
|
82
|
+
const units: UnitMetrics[] = [
|
|
83
|
+
// 5 watchdog duplicates for dispatch 1 (same startedAt = 1000)
|
|
84
|
+
...Array.from({ length: 5 }, (_, i) =>
|
|
85
|
+
makeUnit({ type: "execute-task", id: "M001/S01/T01", startedAt: 1000, finishedAt: 1000 + (i + 1) * 15000, cost: 0.05 + i * 0.01 }),
|
|
86
|
+
),
|
|
87
|
+
// 3 watchdog duplicates for dispatch 2 (same startedAt = 100000)
|
|
88
|
+
...Array.from({ length: 3 }, (_, i) =>
|
|
89
|
+
makeUnit({ type: "execute-task", id: "M001/S01/T01", startedAt: 100000, finishedAt: 100000 + (i + 1) * 15000, cost: 0.08 + i * 0.01 }),
|
|
90
|
+
),
|
|
91
|
+
// 1 entry for dispatch 3 (startedAt = 200000)
|
|
92
|
+
makeUnit({ type: "execute-task", id: "M001/S01/T01", startedAt: 200000, finishedAt: 260000, cost: 0.10 }),
|
|
93
|
+
// Different unit — only 1 dispatch, should NOT be flagged
|
|
94
|
+
makeUnit({ type: "plan-slice", id: "M001/S01", startedAt: 500, finishedAt: 1500, cost: 0.02 }),
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
detectStuckLoops(units, anomalies);
|
|
98
|
+
|
|
99
|
+
// M001/S01/T01 has 3 distinct dispatches (startedAt: 1000, 100000, 200000) — should be flagged
|
|
100
|
+
// M001/S01 has 1 dispatch — should NOT be flagged
|
|
101
|
+
assert.equal(anomalies.length, 1, `expected 1 anomaly (for the 3x dispatched task), got ${anomalies.length}`);
|
|
102
|
+
assert.ok(anomalies[0].summary.includes("3 times"));
|
|
103
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { openDatabase, closeDatabase, insertMilestone, insertSlice, getSlice } from '../gsd-db.ts';
|
|
5
|
+
|
|
6
|
+
test('insertSlice with minimal args does not wipe populated fields', (t) => {
|
|
7
|
+
t.after(() => { try { closeDatabase(); } catch { /* noop */ } });
|
|
8
|
+
openDatabase(":memory:");
|
|
9
|
+
|
|
10
|
+
insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
|
|
11
|
+
|
|
12
|
+
// First insert: full data
|
|
13
|
+
insertSlice({
|
|
14
|
+
id: 'S01',
|
|
15
|
+
milestoneId: 'M001',
|
|
16
|
+
title: 'Auth flow',
|
|
17
|
+
status: 'in-progress',
|
|
18
|
+
risk: 'high',
|
|
19
|
+
demo: 'Login page renders.',
|
|
20
|
+
sequence: 3,
|
|
21
|
+
planning: {
|
|
22
|
+
goal: 'Secure authentication',
|
|
23
|
+
successCriteria: 'All tests pass',
|
|
24
|
+
proofLevel: 'integration',
|
|
25
|
+
integrationClosure: 'Fully integrated',
|
|
26
|
+
observabilityImpact: 'Metrics available',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const before = getSlice('M001', 'S01');
|
|
31
|
+
assert.ok(before, 'slice should exist after first insert');
|
|
32
|
+
assert.equal(before.title, 'Auth flow');
|
|
33
|
+
assert.equal(before.demo, 'Login page renders.');
|
|
34
|
+
assert.equal(before.risk, 'high');
|
|
35
|
+
|
|
36
|
+
// Second insert: minimal "ensure exists" call (mirrors complete-task.ts usage)
|
|
37
|
+
insertSlice({ id: 'S01', milestoneId: 'M001' });
|
|
38
|
+
|
|
39
|
+
const after = getSlice('M001', 'S01');
|
|
40
|
+
assert.ok(after, 'slice should still exist after second insert');
|
|
41
|
+
|
|
42
|
+
// These must NOT be wiped to empty strings
|
|
43
|
+
assert.equal(after.title, 'Auth flow', 'title must survive minimal re-insert');
|
|
44
|
+
assert.equal(after.demo, 'Login page renders.', 'demo must survive minimal re-insert');
|
|
45
|
+
assert.equal(after.risk, 'high', 'risk must survive minimal re-insert');
|
|
46
|
+
assert.equal(after.sequence, 3, 'sequence must survive minimal re-insert');
|
|
47
|
+
|
|
48
|
+
// Planning fields must also survive
|
|
49
|
+
assert.equal(after.goal, 'Secure authentication', 'goal must survive minimal re-insert');
|
|
50
|
+
assert.equal(after.success_criteria, 'All tests pass', 'success_criteria must survive');
|
|
51
|
+
assert.equal(after.proof_level, 'integration', 'proof_level must survive');
|
|
52
|
+
assert.equal(after.integration_closure, 'Fully integrated', 'integration_closure must survive');
|
|
53
|
+
assert.equal(after.observability_impact, 'Metrics available', 'observability_impact must survive');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('insertSlice ON CONFLICT preserves completed status', (t) => {
|
|
57
|
+
t.after(() => { try { closeDatabase(); } catch { /* noop */ } });
|
|
58
|
+
openDatabase(":memory:");
|
|
59
|
+
|
|
60
|
+
insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
|
|
61
|
+
|
|
62
|
+
insertSlice({ id: 'S01', milestoneId: 'M001', title: 'Done slice', status: 'complete' });
|
|
63
|
+
|
|
64
|
+
// Re-insert with pending status (default) should NOT overwrite complete
|
|
65
|
+
insertSlice({ id: 'S01', milestoneId: 'M001' });
|
|
66
|
+
|
|
67
|
+
const after = getSlice('M001', 'S01');
|
|
68
|
+
assert.ok(after);
|
|
69
|
+
assert.equal(after.status, 'complete', 'completed status must not be overwritten');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('insertSlice ON CONFLICT allows explicit updates to non-empty values', (t) => {
|
|
73
|
+
t.after(() => { try { closeDatabase(); } catch { /* noop */ } });
|
|
74
|
+
openDatabase(":memory:");
|
|
75
|
+
|
|
76
|
+
insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
|
|
77
|
+
|
|
78
|
+
insertSlice({ id: 'S01', milestoneId: 'M001', title: 'Original', demo: 'Old demo', risk: 'low' });
|
|
79
|
+
|
|
80
|
+
// Explicit update with real values should overwrite
|
|
81
|
+
insertSlice({ id: 'S01', milestoneId: 'M001', title: 'Updated', demo: 'New demo', risk: 'high' });
|
|
82
|
+
|
|
83
|
+
const after = getSlice('M001', 'S01');
|
|
84
|
+
assert.ok(after);
|
|
85
|
+
assert.equal(after.title, 'Updated', 'explicit title update should apply');
|
|
86
|
+
assert.equal(after.demo, 'New demo', 'explicit demo update should apply');
|
|
87
|
+
assert.equal(after.risk, 'high', 'explicit risk update should apply');
|
|
88
|
+
});
|
|
@@ -1246,7 +1246,7 @@ describe('git-service', async () => {
|
|
|
1246
1246
|
test('nativeAddAllWithExclusions: symlinked .gsd fallback', () => {
|
|
1247
1247
|
// When .gsd is a symlink, git rejects `:!.gsd/...` pathspecs with
|
|
1248
1248
|
// "fatal: pathspec '...' is beyond a symbolic link". The fix falls
|
|
1249
|
-
// back to
|
|
1249
|
+
// back to `git add -u` (tracked files only), NOT `git add -A`.
|
|
1250
1250
|
const repo = initTempRepo();
|
|
1251
1251
|
|
|
1252
1252
|
// Create the real .gsd directory outside the repo, then symlink it
|
|
@@ -1258,11 +1258,18 @@ describe('git-service', async () => {
|
|
|
1258
1258
|
// Symlink .gsd -> external directory
|
|
1259
1259
|
symlinkSync(externalGsd, join(repo, ".gsd"));
|
|
1260
1260
|
|
|
1261
|
-
// Add .gitignore so
|
|
1261
|
+
// Add .gitignore so .gsd/ is ignored
|
|
1262
1262
|
writeFileSync(join(repo, ".gitignore"), ".gsd\n");
|
|
1263
1263
|
|
|
1264
|
-
// Create a
|
|
1264
|
+
// Create a tracked file and commit it, then modify it
|
|
1265
1265
|
createFile(repo, "src/app.ts", "export const x = 1;");
|
|
1266
|
+
run("git add -A", repo);
|
|
1267
|
+
run('git commit -m "add app"', repo);
|
|
1268
|
+
writeFileSync(join(repo, "src/app.ts"), "export const x = 2;");
|
|
1269
|
+
|
|
1270
|
+
// Create an untracked file simulating large data (NOT in .gitignore)
|
|
1271
|
+
// This is the key scenario: large untracked dirs that git add -A would traverse
|
|
1272
|
+
createFile(repo, "data/large-model.bin", "pretend this is 10GB");
|
|
1266
1273
|
|
|
1267
1274
|
// nativeAddAllWithExclusions should NOT throw despite .gsd being a symlink
|
|
1268
1275
|
let threw = false;
|
|
@@ -1274,9 +1281,15 @@ describe('git-service', async () => {
|
|
|
1274
1281
|
}
|
|
1275
1282
|
assert.ok(!threw, "nativeAddAllWithExclusions does not throw with symlinked .gsd");
|
|
1276
1283
|
|
|
1277
|
-
// Verify the
|
|
1284
|
+
// Verify the tracked modified file was staged
|
|
1278
1285
|
const staged = run("git diff --cached --name-only", repo);
|
|
1279
|
-
assert.ok(staged.includes("src/app.ts"), "
|
|
1286
|
+
assert.ok(staged.includes("src/app.ts"), "modified tracked file staged despite symlinked .gsd");
|
|
1287
|
+
|
|
1288
|
+
// CRITICAL: untracked files must NOT be staged — the symlink fallback
|
|
1289
|
+
// should use `git add -u` (tracked only), not `git add -A` (all files).
|
|
1290
|
+
// Using `git add -A` on a repo with large untracked data dirs hangs. (#1977)
|
|
1291
|
+
assert.ok(!staged.includes("data/large-model.bin"),
|
|
1292
|
+
"symlink fallback must not stage untracked files (would hang on large repos)");
|
|
1280
1293
|
assert.ok(!staged.includes(".gsd"), ".gsd content not staged");
|
|
1281
1294
|
|
|
1282
1295
|
rmSync(repo, { recursive: true, force: true });
|
|
@@ -1435,13 +1448,20 @@ describe('git-service', async () => {
|
|
|
1435
1448
|
run('git add .gitignore', repo);
|
|
1436
1449
|
run('git commit -m "add gitignore"', repo);
|
|
1437
1450
|
|
|
1451
|
+
// Pre-commit a tracked source file so git add -u can stage modifications.
|
|
1452
|
+
// The symlink fallback uses git add -u (tracked files only), so the file
|
|
1453
|
+
// must be tracked before the autoCommit scenario runs.
|
|
1454
|
+
createFile(repo, "src/feature.ts", "export const feature = true;");
|
|
1455
|
+
run('git add src/feature.ts', repo);
|
|
1456
|
+
run('git commit -m "add feature"', repo);
|
|
1457
|
+
|
|
1438
1458
|
// Simulate new milestone artifacts created during execution
|
|
1439
1459
|
writeFileSync(join(externalGsd, "milestones", "M009", "M009-SUMMARY.md"), "# M009 Summary");
|
|
1440
1460
|
writeFileSync(join(externalGsd, "milestones", "M009", "S01-SUMMARY.md"), "# S01 Summary");
|
|
1441
1461
|
writeFileSync(join(externalGsd, "milestones", "M009", "T01-VERIFY.json"), '{"passed":true}');
|
|
1442
1462
|
|
|
1443
|
-
//
|
|
1444
|
-
|
|
1463
|
+
// Modify the tracked source file — git add -u will stage this change
|
|
1464
|
+
writeFileSync(join(repo, "src/feature.ts"), "export const feature = false; // updated");
|
|
1445
1465
|
|
|
1446
1466
|
const svc = new GitServiceImpl(repo);
|
|
1447
1467
|
const msg = svc.autoCommit("complete-milestone", "M009");
|
|
@@ -357,3 +357,37 @@ test('writeBlockerPlaceholder: does NOT update DB for non-execute-task types', a
|
|
|
357
357
|
cleanup(base);
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
|
+
|
|
361
|
+
test('writeBlockerPlaceholder: updates DB slice status for complete-slice (#2653)', async () => {
|
|
362
|
+
const base = createFixtureBase();
|
|
363
|
+
try {
|
|
364
|
+
const { openDatabase, closeDatabase, insertMilestone, insertSlice, getSlice, isDbAvailable } =
|
|
365
|
+
await import("../../gsd-db.ts");
|
|
366
|
+
|
|
367
|
+
const dbPath = join(base, ".gsd", "gsd.db");
|
|
368
|
+
mkdirSync(join(base, ".gsd", "milestones", "M001", "slices", "S01"), { recursive: true });
|
|
369
|
+
|
|
370
|
+
openDatabase(dbPath);
|
|
371
|
+
try {
|
|
372
|
+
insertMilestone({ id: "M001", title: "Test", status: "active" });
|
|
373
|
+
insertSlice({ id: "S01", milestoneId: "M001", title: "Slice", status: "active" });
|
|
374
|
+
|
|
375
|
+
// complete-slice blocker should update slice DB status to "complete"
|
|
376
|
+
writeBlockerPlaceholder("complete-slice", "M001/S01", base, "context exhaustion recovery");
|
|
377
|
+
|
|
378
|
+
const slice = getSlice("M001", "S01");
|
|
379
|
+
assert.equal(slice?.status, "complete",
|
|
380
|
+
"writeBlockerPlaceholder must update DB slice status to 'complete' for complete-slice so dispatch guard unblocks downstream (#2653)");
|
|
381
|
+
|
|
382
|
+
// Verify the full chain works: verifyExpectedArtifact should return true
|
|
383
|
+
// (requires both UAT file and DB status = complete)
|
|
384
|
+
// Note: the placeholder writes a SUMMARY file, but complete-slice also needs UAT.
|
|
385
|
+
// The placeholder itself doesn't write UAT, so artifact verification may still fail
|
|
386
|
+
// for complete-slice — but the DB status is now correct, breaking the circular dep.
|
|
387
|
+
} finally {
|
|
388
|
+
if (isDbAvailable()) closeDatabase();
|
|
389
|
+
}
|
|
390
|
+
} finally {
|
|
391
|
+
cleanup(base);
|
|
392
|
+
}
|
|
393
|
+
});
|