gsd-pi 2.44.0-dev.848dd4c → 2.44.0-dev.8dd0d8e
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/dist/resources/extensions/gsd/activity-log.js +7 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +3 -0
- package/dist/resources/extensions/gsd/auto/phases.js +37 -36
- package/dist/resources/extensions/gsd/auto-prompts.js +24 -1
- package/dist/resources/extensions/gsd/auto-start.js +21 -2
- package/dist/resources/extensions/gsd/auto-timers.js +57 -3
- package/dist/resources/extensions/gsd/auto-worktree-sync.js +4 -0
- package/dist/resources/extensions/gsd/auto-worktree.js +9 -6
- package/dist/resources/extensions/gsd/auto.js +30 -3
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +156 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +46 -12
- package/dist/resources/extensions/gsd/commands/catalog.js +7 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +2 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +10 -0
- package/dist/resources/extensions/gsd/commands-mcp-status.js +187 -0
- package/dist/resources/extensions/gsd/db-writer.js +34 -16
- package/dist/resources/extensions/gsd/doctor.js +8 -0
- package/dist/resources/extensions/gsd/git-service.js +8 -3
- package/dist/resources/extensions/gsd/gsd-db.js +12 -1
- package/dist/resources/extensions/gsd/markdown-renderer.js +1 -1
- package/dist/resources/extensions/gsd/preferences.js +9 -1
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -4
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +6 -6
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +3 -14
- package/dist/resources/extensions/gsd/prompts/rethink.md +78 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +7 -37
- package/dist/resources/extensions/gsd/provider-error-pause.js +7 -0
- package/dist/resources/extensions/gsd/repo-identity.js +45 -7
- package/dist/resources/extensions/gsd/rethink.js +115 -0
- package/dist/resources/extensions/gsd/state.js +41 -3
- package/dist/resources/extensions/gsd/tools/plan-slice.js +1 -0
- package/dist/resources/extensions/gsd/tools/plan-task.js +1 -0
- package/dist/resources/extensions/gsd/tools/replan-slice.js +2 -0
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +88 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +32 -2
- package/dist/resources/extensions/gsd/worktree-resolver.js +6 -0
- package/dist/resources/extensions/mcp-client/index.js +14 -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/react-loadable-manifest.json +2 -2
- 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 +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 +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 +2 -2
- 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 -2
- 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_client-reference-manifest.js +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_client-reference-manifest.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_client-reference-manifest.js +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_client-reference-manifest.js +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/export-data/route_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- 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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- 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_client-reference-manifest.js +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_client-reference-manifest.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_client-reference-manifest.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_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 +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/page.js +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 +15 -15
- 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/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/4024.11ca5c01938e5948.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{3721.bf31263de6d5fa46.js → 485.243af25f0cdf50d6.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/{page-b9367c5ae13b99c6.js → page-6654a8cca61a3d1c.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/webpack-0a4cd455ec4197d2.js +1 -0
- package/dist/web/standalone/.next/static/css/dd4ae3f58ac9b600.css +1 -0
- package/package.json +1 -1
- package/packages/native/dist/stream-process/index.js +2 -2
- package/packages/native/src/__tests__/stream-process.test.mjs +34 -0
- package/packages/native/src/stream-process/index.ts +2 -2
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +3 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +15 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/local-model-check.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/local-model-check.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/local-model-check.js +41 -0
- package/packages/pi-coding-agent/dist/core/local-model-check.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +11 -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 +20 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +3 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +6 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/main.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/main.js +17 -0
- package/packages/pi-coding-agent/dist/main.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.js +32 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +3 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +8 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.d.ts +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.js +40 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +4 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts +5 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +13 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +17 -8
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +7 -3
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/core/auth-storage.ts +15 -1
- package/packages/pi-coding-agent/src/core/local-model-check.ts +45 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +21 -1
- package/packages/pi-coding-agent/src/core/settings-manager.ts +9 -0
- package/packages/pi-coding-agent/src/main.ts +19 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/timestamp.test.ts +38 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +10 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +15 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/timestamp.ts +48 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +3 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +18 -3
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +16 -7
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +8 -1
- package/src/resources/extensions/gsd/activity-log.ts +1 -0
- package/src/resources/extensions/gsd/auto/infra-errors.ts +3 -0
- package/src/resources/extensions/gsd/auto/phases.ts +46 -48
- package/src/resources/extensions/gsd/auto-prompts.ts +24 -1
- package/src/resources/extensions/gsd/auto-start.ts +25 -2
- package/src/resources/extensions/gsd/auto-timers.ts +64 -3
- package/src/resources/extensions/gsd/auto-worktree-sync.ts +5 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +9 -6
- package/src/resources/extensions/gsd/auto.ts +37 -3
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +148 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +48 -11
- package/src/resources/extensions/gsd/commands/catalog.ts +7 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +2 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +10 -0
- package/src/resources/extensions/gsd/commands-mcp-status.ts +247 -0
- package/src/resources/extensions/gsd/db-writer.ts +39 -17
- package/src/resources/extensions/gsd/doctor.ts +7 -1
- package/src/resources/extensions/gsd/git-service.ts +6 -2
- package/src/resources/extensions/gsd/gsd-db.ts +16 -1
- package/src/resources/extensions/gsd/markdown-renderer.ts +1 -1
- package/src/resources/extensions/gsd/preferences.ts +11 -1
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -4
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +6 -6
- package/src/resources/extensions/gsd/prompts/replan-slice.md +3 -14
- package/src/resources/extensions/gsd/prompts/rethink.md +78 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +7 -37
- package/src/resources/extensions/gsd/provider-error-pause.ts +9 -0
- package/src/resources/extensions/gsd/repo-identity.ts +46 -7
- package/src/resources/extensions/gsd/rethink.ts +154 -0
- package/src/resources/extensions/gsd/state.ts +41 -1
- package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts +114 -0
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/derive-state-db-disk-reconcile.test.ts +121 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +60 -0
- package/src/resources/extensions/gsd/tests/est-annotation-timeout.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +20 -2
- package/src/resources/extensions/gsd/tests/inherited-repo-home-dir.test.ts +121 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +11 -7
- package/src/resources/extensions/gsd/tests/recovery-attempts-reset.test.ts +176 -0
- package/src/resources/extensions/gsd/tests/stop-auto-merge-back.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/survivor-branch-complete.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/terminated-transient.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +65 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +2 -0
- package/src/resources/extensions/gsd/tools/plan-task.ts +2 -0
- package/src/resources/extensions/gsd/tools/replan-slice.ts +3 -0
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +127 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +43 -2
- package/src/resources/extensions/gsd/worktree-resolver.ts +7 -0
- package/src/resources/extensions/mcp-client/index.ts +20 -0
- package/dist/web/standalone/.next/static/chunks/4024.0de81b543b28b9fe.js +0 -9
- package/dist/web/standalone/.next/static/chunks/webpack-9014b5adb127a98a.js +0 -1
- package/dist/web/standalone/.next/static/css/8a727f372cf53002.css +0 -1
- /package/dist/web/standalone/.next/static/{-zps1Q9mQmioAKLcQiCr8 → enTIm32JJtw--VTtLPSC3}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{-zps1Q9mQmioAKLcQiCr8 → enTIm32JJtw--VTtLPSC3}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* merge-conflict-stops-loop.test.ts — #2330
|
|
3
|
+
*
|
|
4
|
+
* When a squash merge has real code conflicts (not just .gsd/ files),
|
|
5
|
+
* the merge retries forever because MergeConflictError is caught
|
|
6
|
+
* silently in mergeAndExit. This test verifies that:
|
|
7
|
+
* 1. worktree-resolver re-throws MergeConflictError for code conflicts
|
|
8
|
+
* 2. auto/phases.ts wraps mergeAndExit calls to stop the loop on conflict
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
14
|
+
|
|
15
|
+
const { assertTrue, report } = createTestContext();
|
|
16
|
+
|
|
17
|
+
const resolverPath = join(import.meta.dirname, "..", "worktree-resolver.ts");
|
|
18
|
+
const resolverSrc = readFileSync(resolverPath, "utf-8");
|
|
19
|
+
|
|
20
|
+
const phasesPath = join(import.meta.dirname, "..", "auto", "phases.ts");
|
|
21
|
+
const phasesSrc = readFileSync(phasesPath, "utf-8");
|
|
22
|
+
|
|
23
|
+
console.log("\n=== #2330: Merge conflict stops auto loop ===");
|
|
24
|
+
|
|
25
|
+
// ── Test 1: worktree-resolver re-throws MergeConflictError ──────────────
|
|
26
|
+
|
|
27
|
+
const methodStart = resolverSrc.indexOf("Worktree-mode merge:");
|
|
28
|
+
assertTrue(methodStart > 0, "worktree-resolver has _mergeWorktreeMode method");
|
|
29
|
+
|
|
30
|
+
const methodBody = resolverSrc.slice(methodStart, methodStart + 5000);
|
|
31
|
+
const rethrowsConflict =
|
|
32
|
+
methodBody.includes("MergeConflictError") &&
|
|
33
|
+
methodBody.includes("throw err");
|
|
34
|
+
|
|
35
|
+
assertTrue(
|
|
36
|
+
rethrowsConflict,
|
|
37
|
+
"worktree-resolver._mergeWorktreeMode re-throws MergeConflictError (#2330)",
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// ── Test 2: auto/phases.ts imports and uses MergeConflictError ──────────
|
|
41
|
+
|
|
42
|
+
assertTrue(
|
|
43
|
+
phasesSrc.includes("MergeConflictError") && phasesSrc.includes("mergeAndExit"),
|
|
44
|
+
"auto/phases.ts handles MergeConflictError from mergeAndExit (#2330)",
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// ── Test 3: The handler stops the loop (doesn't just warn) ──────────────
|
|
48
|
+
|
|
49
|
+
// Find the instanceof MergeConflictError check (not the import line)
|
|
50
|
+
const instanceofIdx = phasesSrc.indexOf("instanceof MergeConflictError");
|
|
51
|
+
assertTrue(instanceofIdx > 0, "auto/phases.ts has instanceof MergeConflictError check");
|
|
52
|
+
|
|
53
|
+
if (instanceofIdx > 0) {
|
|
54
|
+
const afterHandler = phasesSrc.slice(instanceofIdx, instanceofIdx + 500);
|
|
55
|
+
const stopsLoop =
|
|
56
|
+
afterHandler.includes("stopAuto") ||
|
|
57
|
+
afterHandler.includes('action: "break"') ||
|
|
58
|
+
afterHandler.includes("reason: \"merge-conflict\"");
|
|
59
|
+
|
|
60
|
+
assertTrue(
|
|
61
|
+
stopsLoop,
|
|
62
|
+
"auto/phases.ts stops the loop when merge conflict is detected (#2330)",
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
report();
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
applyModeDefaults,
|
|
16
16
|
getIsolationMode,
|
|
17
17
|
parsePreferencesMarkdown,
|
|
18
|
+
_resetParseWarningFlag,
|
|
18
19
|
} from "../preferences.ts";
|
|
19
20
|
import type { GSDPreferences, GSDModelConfigV2, GSDPhaseModelConfig } from "../preferences.ts";
|
|
20
21
|
|
|
@@ -352,3 +353,29 @@ test("handles empty models config", () => {
|
|
|
352
353
|
assert.notEqual(prefs, null);
|
|
353
354
|
assert.equal(prefs!.models, undefined);
|
|
354
355
|
});
|
|
356
|
+
|
|
357
|
+
// ── Warn-once for unrecognized format (#2373) ────────────────────────────────
|
|
358
|
+
|
|
359
|
+
test("unrecognized format warning is emitted at most once (#2373)", () => {
|
|
360
|
+
const warnings: string[] = [];
|
|
361
|
+
const origWarn = console.warn;
|
|
362
|
+
console.warn = (...args: unknown[]) => warnings.push(args.join(" "));
|
|
363
|
+
try {
|
|
364
|
+
// Reset internal warned flag so the test starts clean
|
|
365
|
+
_resetParseWarningFlag();
|
|
366
|
+
|
|
367
|
+
const unrecognized = "This is just plain text with no frontmatter or headings.";
|
|
368
|
+
|
|
369
|
+
// Call multiple times — simulates repeated preference loads
|
|
370
|
+
parsePreferencesMarkdown(unrecognized);
|
|
371
|
+
parsePreferencesMarkdown(unrecognized);
|
|
372
|
+
parsePreferencesMarkdown(unrecognized);
|
|
373
|
+
|
|
374
|
+
const relevant = warnings.filter(w => w.includes("unrecognized format"));
|
|
375
|
+
assert.equal(relevant.length, 1, `expected exactly 1 warning, got ${relevant.length}: ${JSON.stringify(relevant)}`);
|
|
376
|
+
} finally {
|
|
377
|
+
console.warn = origWarn;
|
|
378
|
+
// Reset so other tests aren't affected by the flag state
|
|
379
|
+
_resetParseWarningFlag();
|
|
380
|
+
}
|
|
381
|
+
});
|
|
@@ -147,12 +147,12 @@ test("plan-slice prompt no longer frames direct PLAN writes as the source of tru
|
|
|
147
147
|
assert.match(prompt, /Do \*\*not\*\* rely on direct `PLAN\.md` writes as the source of truth/i);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
test("plan-slice prompt explicitly names gsd_plan_slice
|
|
150
|
+
test("plan-slice prompt explicitly names gsd_plan_slice as DB-backed planning tool", () => {
|
|
151
151
|
const prompt = readPrompt("plan-slice");
|
|
152
152
|
assert.match(prompt, /gsd_plan_slice/);
|
|
153
153
|
assert.match(prompt, /gsd_plan_task/);
|
|
154
|
-
// The prompt should describe
|
|
155
|
-
assert.match(prompt, /DB-backed
|
|
154
|
+
// The prompt should describe the DB-backed tool as the canonical write path
|
|
155
|
+
assert.match(prompt, /DB-backed tool is the canonical write path/i);
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
test("plan-slice prompt does not instruct direct file writes as a primary step", () => {
|
|
@@ -161,14 +161,18 @@ test("plan-slice prompt does not instruct direct file writes as a primary step",
|
|
|
161
161
|
assert.doesNotMatch(prompt, /^\d+\.\s+Write `?\{\{outputPath\}\}`?\s*$/m);
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
test("plan-slice prompt
|
|
164
|
+
test("plan-slice prompt clarifies gsd_plan_slice handles task persistence", () => {
|
|
165
165
|
const prompt = readPrompt("plan-slice");
|
|
166
|
-
|
|
166
|
+
// gsd_plan_slice persists tasks in its transaction — no separate gsd_plan_task calls needed
|
|
167
|
+
assert.match(prompt, /gsd_plan_task/);
|
|
168
|
+
assert.match(prompt, /gsd_plan_slice` handles task persistence/i);
|
|
167
169
|
});
|
|
168
170
|
|
|
169
|
-
test("replan-slice prompt
|
|
171
|
+
test("replan-slice prompt uses gsd_replan_slice as canonical DB-backed tool", () => {
|
|
170
172
|
const prompt = readPrompt("replan-slice");
|
|
171
|
-
assert.match(prompt, /
|
|
173
|
+
assert.match(prompt, /gsd_replan_slice/);
|
|
174
|
+
// Degraded fallback (direct file writes) was removed — DB tools are always available
|
|
175
|
+
assert.doesNotMatch(prompt, /Degraded fallback/i);
|
|
172
176
|
});
|
|
173
177
|
|
|
174
178
|
test("reassess-roadmap prompt references gsd_reassess_roadmap tool", () => {
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test for #2322: recoveryAttempts persists across re-dispatches,
|
|
3
|
+
* causing instant task skip.
|
|
4
|
+
*
|
|
5
|
+
* When a unit hits recovery limits and is later re-dispatched, the
|
|
6
|
+
* recoveryAttempts counter from the prior execution carries over because
|
|
7
|
+
* the dispatch-time writeUnitRuntimeRecord call does not reset it.
|
|
8
|
+
* This causes the next execution to be instantly skipped with no steering
|
|
9
|
+
* message or second chance.
|
|
10
|
+
*
|
|
11
|
+
* The fix: include `recoveryAttempts: 0` in the dispatch-time runtime
|
|
12
|
+
* record write in runUnitPhase.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mkdtempSync, mkdirSync, rmSync } from "node:fs";
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import {
|
|
19
|
+
writeUnitRuntimeRecord,
|
|
20
|
+
readUnitRuntimeRecord,
|
|
21
|
+
} from "../unit-runtime.ts";
|
|
22
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
23
|
+
|
|
24
|
+
const { assertEq, assertTrue, report } = createTestContext();
|
|
25
|
+
|
|
26
|
+
// ═══ Setup ════════════════════════════════════════════════════════════════════
|
|
27
|
+
|
|
28
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-recovery-reset-test-"));
|
|
29
|
+
mkdirSync(join(base, ".gsd", "runtime", "units"), { recursive: true });
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
// ═══ #2322: recoveryAttempts should reset on re-dispatch ═══════════════════
|
|
33
|
+
|
|
34
|
+
{
|
|
35
|
+
console.log("\n=== #2322: recoveryAttempts should reset on re-dispatch ===");
|
|
36
|
+
|
|
37
|
+
const unitType = "execute-task";
|
|
38
|
+
const unitId = "M001/S01/T01";
|
|
39
|
+
const startedAt1 = Date.now() - 10000;
|
|
40
|
+
|
|
41
|
+
// Simulate first dispatch — clean state
|
|
42
|
+
writeUnitRuntimeRecord(base, unitType, unitId, startedAt1, {
|
|
43
|
+
phase: "dispatched",
|
|
44
|
+
wrapupWarningSent: false,
|
|
45
|
+
timeoutAt: null,
|
|
46
|
+
lastProgressAt: startedAt1,
|
|
47
|
+
progressCount: 0,
|
|
48
|
+
lastProgressKind: "dispatch",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Simulate timeout recovery incrementing recoveryAttempts
|
|
52
|
+
writeUnitRuntimeRecord(base, unitType, unitId, startedAt1, {
|
|
53
|
+
phase: "recovered",
|
|
54
|
+
recoveryAttempts: 1,
|
|
55
|
+
lastRecoveryReason: "hard",
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const afterRecovery = readUnitRuntimeRecord(base, unitType, unitId);
|
|
59
|
+
assertEq(afterRecovery?.recoveryAttempts, 1, "recoveryAttempts should be 1 after recovery");
|
|
60
|
+
assertEq(afterRecovery?.lastRecoveryReason, "hard", "lastRecoveryReason should be 'hard'");
|
|
61
|
+
|
|
62
|
+
// Simulate re-dispatch (second execution of same unit).
|
|
63
|
+
// This is what runUnitPhase should do at dispatch time — explicitly reset
|
|
64
|
+
// recoveryAttempts so the new execution gets its full recovery budget.
|
|
65
|
+
const startedAt2 = Date.now();
|
|
66
|
+
writeUnitRuntimeRecord(base, unitType, unitId, startedAt2, {
|
|
67
|
+
phase: "dispatched",
|
|
68
|
+
wrapupWarningSent: false,
|
|
69
|
+
timeoutAt: null,
|
|
70
|
+
lastProgressAt: startedAt2,
|
|
71
|
+
progressCount: 0,
|
|
72
|
+
lastProgressKind: "dispatch",
|
|
73
|
+
recoveryAttempts: 0, // FIX: must be explicitly reset
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const afterRedispatch = readUnitRuntimeRecord(base, unitType, unitId);
|
|
77
|
+
assertEq(
|
|
78
|
+
afterRedispatch?.recoveryAttempts,
|
|
79
|
+
0,
|
|
80
|
+
"recoveryAttempts should be 0 after re-dispatch (was carried over from prior execution)",
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ═══ Verify the BUG scenario: omitting recoveryAttempts carries it over ═══
|
|
85
|
+
|
|
86
|
+
{
|
|
87
|
+
console.log("\n=== #2322: demonstrates bug — omitting recoveryAttempts carries it over ===");
|
|
88
|
+
|
|
89
|
+
const unitType = "execute-task";
|
|
90
|
+
const unitId = "M001/S01/T02";
|
|
91
|
+
const startedAt1 = Date.now() - 10000;
|
|
92
|
+
|
|
93
|
+
// First dispatch
|
|
94
|
+
writeUnitRuntimeRecord(base, unitType, unitId, startedAt1, {
|
|
95
|
+
phase: "dispatched",
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Timeout bumps recoveryAttempts to 1
|
|
99
|
+
writeUnitRuntimeRecord(base, unitType, unitId, startedAt1, {
|
|
100
|
+
recoveryAttempts: 1,
|
|
101
|
+
lastRecoveryReason: "hard",
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Re-dispatch WITHOUT resetting recoveryAttempts (the bug)
|
|
105
|
+
const startedAt2 = Date.now();
|
|
106
|
+
writeUnitRuntimeRecord(base, unitType, unitId, startedAt2, {
|
|
107
|
+
phase: "dispatched",
|
|
108
|
+
wrapupWarningSent: false,
|
|
109
|
+
timeoutAt: null,
|
|
110
|
+
lastProgressAt: startedAt2,
|
|
111
|
+
progressCount: 0,
|
|
112
|
+
lastProgressKind: "dispatch",
|
|
113
|
+
// recoveryAttempts: NOT included — this is the bug
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const afterBuggyRedispatch = readUnitRuntimeRecord(base, unitType, unitId);
|
|
117
|
+
// This DEMONSTRATES the bug: recoveryAttempts is still 1
|
|
118
|
+
assertEq(
|
|
119
|
+
afterBuggyRedispatch?.recoveryAttempts,
|
|
120
|
+
1,
|
|
121
|
+
"BUG DEMO: recoveryAttempts carries over when not explicitly reset",
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ═══ Hard timeout maxRecoveryAttempts=1 — second dispatch must get full budget ═══
|
|
126
|
+
|
|
127
|
+
{
|
|
128
|
+
console.log("\n=== #2322: second dispatch gets full hard-timeout budget after reset ===");
|
|
129
|
+
|
|
130
|
+
const unitType = "execute-task";
|
|
131
|
+
const unitId = "M001/S01/T03";
|
|
132
|
+
|
|
133
|
+
// First dispatch
|
|
134
|
+
const start1 = Date.now() - 20000;
|
|
135
|
+
writeUnitRuntimeRecord(base, unitType, unitId, start1, {
|
|
136
|
+
phase: "dispatched",
|
|
137
|
+
recoveryAttempts: 0,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Hard timeout recovery — exhausts the budget (maxRecoveryAttempts=1 for hard)
|
|
141
|
+
writeUnitRuntimeRecord(base, unitType, unitId, start1, {
|
|
142
|
+
phase: "recovered",
|
|
143
|
+
recoveryAttempts: 1,
|
|
144
|
+
lastRecoveryReason: "hard",
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const afterExhausted = readUnitRuntimeRecord(base, unitType, unitId);
|
|
148
|
+
assertEq(afterExhausted?.recoveryAttempts, 1, "budget exhausted after hard recovery");
|
|
149
|
+
|
|
150
|
+
// Second dispatch with fix: reset recoveryAttempts
|
|
151
|
+
const start2 = Date.now();
|
|
152
|
+
writeUnitRuntimeRecord(base, unitType, unitId, start2, {
|
|
153
|
+
phase: "dispatched",
|
|
154
|
+
wrapupWarningSent: false,
|
|
155
|
+
timeoutAt: null,
|
|
156
|
+
lastProgressAt: start2,
|
|
157
|
+
progressCount: 0,
|
|
158
|
+
lastProgressKind: "dispatch",
|
|
159
|
+
recoveryAttempts: 0,
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const afterReset = readUnitRuntimeRecord(base, unitType, unitId);
|
|
163
|
+
assertEq(afterReset?.recoveryAttempts, 0, "second dispatch has full recovery budget");
|
|
164
|
+
|
|
165
|
+
// Now a hard timeout should be recoverable (0 < 1)
|
|
166
|
+
assertTrue(
|
|
167
|
+
(afterReset?.recoveryAttempts ?? 0) < 1,
|
|
168
|
+
"hard recovery should be allowed (recoveryAttempts < maxRecoveryAttempts)",
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
} finally {
|
|
173
|
+
rmSync(base, { recursive: true, force: true });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
report();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* stop-auto-merge-back.test.ts — Regression test for #2317.
|
|
3
|
+
*
|
|
4
|
+
* When auto-mode stops after a milestone is complete, stopAuto should trigger
|
|
5
|
+
* merge-back (mergeAndExit) instead of just exiting the worktree with
|
|
6
|
+
* preserveBranch: true. Otherwise milestone code stays stranded on the
|
|
7
|
+
* worktree branch and never reaches main.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import test from "node:test";
|
|
11
|
+
import assert from "node:assert/strict";
|
|
12
|
+
import { readFileSync } from "node:fs";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
|
|
15
|
+
// ─── Source analysis: stopAuto calls mergeAndExit for complete milestones ────
|
|
16
|
+
|
|
17
|
+
const autoSrcPath = join(import.meta.dirname, "..", "auto.ts");
|
|
18
|
+
const autoSrc = readFileSync(autoSrcPath, "utf-8");
|
|
19
|
+
|
|
20
|
+
test("#2317: stopAuto should check milestone completion status before choosing exit strategy", () => {
|
|
21
|
+
// stopAuto Step 4 should NOT unconditionally call exitMilestone(preserveBranch: true).
|
|
22
|
+
// It should check if the milestone is complete and call mergeAndExit instead.
|
|
23
|
+
|
|
24
|
+
// Find the Step 4 section
|
|
25
|
+
const step4Idx = autoSrc.indexOf("Step 4: Auto-worktree exit");
|
|
26
|
+
assert.ok(step4Idx !== -1, "Step 4 comment exists in stopAuto");
|
|
27
|
+
|
|
28
|
+
// Extract a reasonable window around Step 4 (up to Step 5)
|
|
29
|
+
const step5Idx = autoSrc.indexOf("Step 5:", step4Idx);
|
|
30
|
+
const step4Block = autoSrc.slice(step4Idx, step5Idx);
|
|
31
|
+
|
|
32
|
+
// The fix: Step 4 should call mergeAndExit when milestone is complete
|
|
33
|
+
assert.ok(
|
|
34
|
+
step4Block.includes("mergeAndExit"),
|
|
35
|
+
"Step 4 should call mergeAndExit for completed milestones",
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("#2317: stopAuto should detect milestone completion via SUMMARY file or DB", () => {
|
|
40
|
+
const step4Idx = autoSrc.indexOf("Step 4: Auto-worktree exit");
|
|
41
|
+
const step5Idx = autoSrc.indexOf("Step 5:", step4Idx);
|
|
42
|
+
const step4Block = autoSrc.slice(step4Idx, step5Idx);
|
|
43
|
+
|
|
44
|
+
// Should check completion status — either via SUMMARY file, DB getMilestone, or phase
|
|
45
|
+
const checksCompletion =
|
|
46
|
+
step4Block.includes("SUMMARY") ||
|
|
47
|
+
step4Block.includes("getMilestone") ||
|
|
48
|
+
step4Block.includes("complete") ||
|
|
49
|
+
step4Block.includes("isMilestoneComplete");
|
|
50
|
+
|
|
51
|
+
assert.ok(
|
|
52
|
+
checksCompletion,
|
|
53
|
+
"Step 4 should check if milestone is complete before deciding exit strategy",
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("#2317: stopAuto still preserves branch for incomplete milestones", () => {
|
|
58
|
+
const step4Idx = autoSrc.indexOf("Step 4: Auto-worktree exit");
|
|
59
|
+
const step5Idx = autoSrc.indexOf("Step 5:", step4Idx);
|
|
60
|
+
const step4Block = autoSrc.slice(step4Idx, step5Idx);
|
|
61
|
+
|
|
62
|
+
// preserveBranch should still be used as fallback for non-complete milestones
|
|
63
|
+
assert.ok(
|
|
64
|
+
step4Block.includes("preserveBranch"),
|
|
65
|
+
"Step 4 should still preserve branch for incomplete milestones (fallback path)",
|
|
66
|
+
);
|
|
67
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test for #2358: Survivor branch recovery skipped in phase=complete.
|
|
3
|
+
*
|
|
4
|
+
* When bootstrapAutoSession finds a survivor milestone branch and the derived
|
|
5
|
+
* state phase is "complete", recovery/finalization is skipped entirely because
|
|
6
|
+
* the survivor branch detection only triggers when phase === "pre-planning".
|
|
7
|
+
* The milestone finalization (merge, cleanup) never runs, leaving the worktree
|
|
8
|
+
* and branch alive.
|
|
9
|
+
*
|
|
10
|
+
* The fix broadens the survivor branch detection to also check phase === "complete",
|
|
11
|
+
* and adds a finalization path that runs mergeAndExit before falling through to
|
|
12
|
+
* the normal "complete" handling.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
16
|
+
|
|
17
|
+
const { assertTrue, assertEq, report } = createTestContext();
|
|
18
|
+
|
|
19
|
+
// ═══ Test: survivor branch detection conditions ══════════════════════════════
|
|
20
|
+
|
|
21
|
+
// The survivor branch detection block in auto-start.ts checks:
|
|
22
|
+
// state.activeMilestone &&
|
|
23
|
+
// state.phase === "pre-planning" && // <-- BUG: too restrictive
|
|
24
|
+
// shouldUseWorktreeIsolation() &&
|
|
25
|
+
// !detectWorktreeName(base) &&
|
|
26
|
+
// !base.includes(...)
|
|
27
|
+
//
|
|
28
|
+
// The fix should also include state.phase === "complete".
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
console.log("\n=== #2358: survivor branch should be detected in phase=complete ===");
|
|
32
|
+
|
|
33
|
+
// Simulate the condition check before the fix (only pre-planning)
|
|
34
|
+
const phasesBeforeFix = ["pre-planning"];
|
|
35
|
+
const phasesAfterFix = ["pre-planning", "complete"];
|
|
36
|
+
|
|
37
|
+
const testPhase = "complete";
|
|
38
|
+
|
|
39
|
+
const detectedBefore = phasesBeforeFix.includes(testPhase);
|
|
40
|
+
assertEq(detectedBefore, false, "before fix: phase=complete should NOT trigger survivor detection");
|
|
41
|
+
|
|
42
|
+
const detectedAfter = phasesAfterFix.includes(testPhase);
|
|
43
|
+
assertEq(detectedAfter, true, "after fix: phase=complete SHOULD trigger survivor detection");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ═══ Test: pre-planning survivor detection still works ═══════════════════════
|
|
47
|
+
|
|
48
|
+
{
|
|
49
|
+
console.log("\n=== #2358: pre-planning survivor detection is not broken ===");
|
|
50
|
+
|
|
51
|
+
const phasesAfterFix = ["pre-planning", "complete"];
|
|
52
|
+
const testPhase = "pre-planning";
|
|
53
|
+
|
|
54
|
+
const detected = phasesAfterFix.includes(testPhase);
|
|
55
|
+
assertEq(detected, true, "pre-planning should still trigger survivor detection after fix");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ═══ Test: other phases do NOT trigger survivor detection ════════════════════
|
|
59
|
+
|
|
60
|
+
{
|
|
61
|
+
console.log("\n=== #2358: other phases should NOT trigger survivor detection ===");
|
|
62
|
+
|
|
63
|
+
const phasesAfterFix = ["pre-planning", "complete"];
|
|
64
|
+
|
|
65
|
+
for (const phase of ["planning", "executing", "blocked", "needs-discussion"]) {
|
|
66
|
+
const detected = phasesAfterFix.includes(phase);
|
|
67
|
+
assertEq(detected, false, `phase=${phase} should NOT trigger survivor detection`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ═══ Test: phase=complete + hasSurvivorBranch should trigger finalization ═════
|
|
72
|
+
|
|
73
|
+
{
|
|
74
|
+
console.log("\n=== #2358: phase=complete + survivor branch triggers finalization path ===");
|
|
75
|
+
|
|
76
|
+
// Simulate the decision logic after the fix:
|
|
77
|
+
// if (hasSurvivorBranch && state.phase === "complete") -> finalize
|
|
78
|
+
// if (hasSurvivorBranch && state.phase === "needs-discussion") -> discuss
|
|
79
|
+
// if (!hasSurvivorBranch && state.phase === "complete") -> showSmartEntry
|
|
80
|
+
|
|
81
|
+
const scenarios = [
|
|
82
|
+
{ hasSurvivorBranch: true, phase: "complete", expected: "finalize" },
|
|
83
|
+
{ hasSurvivorBranch: true, phase: "needs-discussion", expected: "discuss" },
|
|
84
|
+
{ hasSurvivorBranch: true, phase: "pre-planning", expected: "continue" },
|
|
85
|
+
{ hasSurvivorBranch: false, phase: "complete", expected: "showSmartEntry" },
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
for (const { hasSurvivorBranch, phase, expected } of scenarios) {
|
|
89
|
+
let result: string;
|
|
90
|
+
if (hasSurvivorBranch && phase === "complete") {
|
|
91
|
+
result = "finalize";
|
|
92
|
+
} else if (hasSurvivorBranch && phase === "needs-discussion") {
|
|
93
|
+
result = "discuss";
|
|
94
|
+
} else if (!hasSurvivorBranch && (!phase || phase === "complete")) {
|
|
95
|
+
result = "showSmartEntry";
|
|
96
|
+
} else {
|
|
97
|
+
result = "continue";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
assertEq(
|
|
101
|
+
result,
|
|
102
|
+
expected,
|
|
103
|
+
`hasSurvivorBranch=${hasSurvivorBranch}, phase=${phase} -> expected ${expected}, got ${result}`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
report();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* terminated-transient.test.ts — Regression test for #2309.
|
|
3
|
+
*
|
|
4
|
+
* classifyProviderError should treat 'terminated' errors (process killed,
|
|
5
|
+
* connection reset) as transient with auto-resume, not permanent.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import test from "node:test";
|
|
9
|
+
import assert from "node:assert/strict";
|
|
10
|
+
import { classifyProviderError } from "../provider-error-pause.ts";
|
|
11
|
+
|
|
12
|
+
test("#2309: 'terminated' errors should be classified as transient", () => {
|
|
13
|
+
const result = classifyProviderError("terminated");
|
|
14
|
+
assert.equal(result.isTransient, true, "'terminated' should be transient");
|
|
15
|
+
assert.equal(result.isRateLimit, false, "'terminated' is not a rate limit");
|
|
16
|
+
assert.ok(result.suggestedDelayMs > 0, "'terminated' should have a retry delay");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("#2309: 'connection reset' errors should be classified as transient", () => {
|
|
20
|
+
const result = classifyProviderError("connection reset by peer");
|
|
21
|
+
assert.equal(result.isTransient, true, "'connection reset' should be transient");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("#2309: 'other side closed' errors should be classified as transient", () => {
|
|
25
|
+
const result = classifyProviderError("other side closed the connection");
|
|
26
|
+
assert.equal(result.isTransient, true, "'other side closed' should be transient");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("#2309: 'fetch failed' errors should be classified as transient", () => {
|
|
30
|
+
const result = classifyProviderError("fetch failed: network error");
|
|
31
|
+
assert.equal(result.isTransient, true, "'fetch failed' should be transient");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("#2309: 'connection refused' errors should be classified as transient", () => {
|
|
35
|
+
const result = classifyProviderError("ECONNREFUSED: connection refused");
|
|
36
|
+
assert.equal(result.isTransient, true, "'connection refused' should be transient");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("#2309: permanent errors are still permanent", () => {
|
|
40
|
+
const authResult = classifyProviderError("unauthorized: invalid API key");
|
|
41
|
+
assert.equal(authResult.isTransient, false, "auth errors should stay permanent");
|
|
42
|
+
assert.equal(authResult.suggestedDelayMs, 0, "permanent errors have no delay");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("#2309: rate limits are still transient", () => {
|
|
46
|
+
const rlResult = classifyProviderError("rate limit exceeded (429)");
|
|
47
|
+
assert.equal(rlResult.isTransient, true, "rate limits are still transient");
|
|
48
|
+
assert.equal(rlResult.isRateLimit, true, "rate limits are flagged as rate limits");
|
|
49
|
+
});
|
|
@@ -34,6 +34,7 @@ const RENAME_MAP: Array<{ canonical: string; alias: string }> = [
|
|
|
34
34
|
{ canonical: "gsd_replan_slice", alias: "gsd_slice_replan" },
|
|
35
35
|
{ canonical: "gsd_reassess_roadmap", alias: "gsd_roadmap_reassess" },
|
|
36
36
|
{ canonical: "gsd_complete_milestone", alias: "gsd_milestone_complete" },
|
|
37
|
+
{ canonical: "gsd_validate_milestone", alias: "gsd_milestone_validate" },
|
|
37
38
|
];
|
|
38
39
|
|
|
39
40
|
// ─── Registration count ──────────────────────────────────────────────────────
|
|
@@ -43,7 +44,7 @@ console.log('\n── Tool naming: registration count ──');
|
|
|
43
44
|
const pi = makeMockPi();
|
|
44
45
|
registerDbTools(pi);
|
|
45
46
|
|
|
46
|
-
assert.deepStrictEqual(pi.tools.length,
|
|
47
|
+
assert.deepStrictEqual(pi.tools.length, 26, 'Should register exactly 26 tools (13 canonical + 13 aliases)');
|
|
47
48
|
|
|
48
49
|
// ─── Both names exist for each pair ──────────────────────────────────────────
|
|
49
50
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* worktree-submodule-safety.test.ts — #2337
|
|
3
|
+
*
|
|
4
|
+
* Worktree teardown (removeWorktree) uses --force which destroys
|
|
5
|
+
* uncommitted changes in submodule directories. This test verifies
|
|
6
|
+
* that the removal logic detects submodules and preserves their state.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
12
|
+
|
|
13
|
+
const { assertTrue, report } = createTestContext();
|
|
14
|
+
|
|
15
|
+
const srcPath = join(import.meta.dirname, "..", "worktree-manager.ts");
|
|
16
|
+
const src = readFileSync(srcPath, "utf-8");
|
|
17
|
+
|
|
18
|
+
console.log("\n=== #2337: Worktree teardown preserves submodule state ===");
|
|
19
|
+
|
|
20
|
+
// ── Test 1: removeWorktree function exists ──────────────────────────────
|
|
21
|
+
|
|
22
|
+
const removeWorktreeIdx = src.indexOf("export function removeWorktree");
|
|
23
|
+
assertTrue(removeWorktreeIdx > 0, "worktree-manager.ts exports removeWorktree");
|
|
24
|
+
|
|
25
|
+
const fnBody = src.slice(removeWorktreeIdx, removeWorktreeIdx + 3000);
|
|
26
|
+
|
|
27
|
+
// ── Test 2: The function checks for submodules before force removal ─────
|
|
28
|
+
|
|
29
|
+
const checksSubmodules =
|
|
30
|
+
fnBody.includes("submodule") ||
|
|
31
|
+
fnBody.includes(".gitmodules");
|
|
32
|
+
|
|
33
|
+
assertTrue(
|
|
34
|
+
checksSubmodules,
|
|
35
|
+
"removeWorktree checks for submodules before force removal (#2337)",
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// ── Test 3: Submodule changes are stashed or warned about ───────────────
|
|
39
|
+
|
|
40
|
+
const preservesSubmoduleState =
|
|
41
|
+
fnBody.includes("stash") ||
|
|
42
|
+
fnBody.includes("uncommitted") ||
|
|
43
|
+
fnBody.includes("dirty") ||
|
|
44
|
+
fnBody.includes("submodule") && (fnBody.includes("warn") || fnBody.includes("preserv"));
|
|
45
|
+
|
|
46
|
+
assertTrue(
|
|
47
|
+
preservesSubmoduleState,
|
|
48
|
+
"removeWorktree preserves or warns about submodule uncommitted changes (#2337)",
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// ── Test 4: Force removal is skipped when submodules have changes ───────
|
|
52
|
+
|
|
53
|
+
// The key fix: when submodules have dirty state, we should NOT use force
|
|
54
|
+
// removal. Instead, use non-force first and fall back to force only after
|
|
55
|
+
// submodule state is preserved.
|
|
56
|
+
const hasConditionalForce =
|
|
57
|
+
fnBody.includes("submodule") &&
|
|
58
|
+
(fnBody.includes("force") || fnBody.includes("--force"));
|
|
59
|
+
|
|
60
|
+
assertTrue(
|
|
61
|
+
hasConditionalForce,
|
|
62
|
+
"removeWorktree has conditional force logic around submodules (#2337)",
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
report();
|
|
@@ -20,6 +20,7 @@ export interface PlanSliceTaskInput {
|
|
|
20
20
|
inputs: string[];
|
|
21
21
|
expectedOutput: string[];
|
|
22
22
|
observabilityImpact?: string;
|
|
23
|
+
fullPlanMd?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export interface PlanSliceParams {
|
|
@@ -167,6 +168,7 @@ export async function handlePlanSlice(
|
|
|
167
168
|
inputs: task.inputs,
|
|
168
169
|
expectedOutput: task.expectedOutput,
|
|
169
170
|
observabilityImpact: task.observabilityImpact ?? "",
|
|
171
|
+
fullPlanMd: task.fullPlanMd,
|
|
170
172
|
});
|
|
171
173
|
}
|
|
172
174
|
});
|
|
@@ -15,6 +15,7 @@ export interface PlanTaskParams {
|
|
|
15
15
|
inputs: string[];
|
|
16
16
|
expectedOutput: string[];
|
|
17
17
|
observabilityImpact?: string;
|
|
18
|
+
fullPlanMd?: string;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export interface PlanTaskResult {
|
|
@@ -94,6 +95,7 @@ export async function handlePlanTask(
|
|
|
94
95
|
inputs: params.inputs,
|
|
95
96
|
expectedOutput: params.expectedOutput,
|
|
96
97
|
observabilityImpact: params.observabilityImpact ?? "",
|
|
98
|
+
fullPlanMd: params.fullPlanMd,
|
|
97
99
|
});
|
|
98
100
|
});
|
|
99
101
|
} catch (err) {
|