Commit graph

3535 commits

Author SHA1 Message Date
Tom Boucher
2ea668ee09 fix: handle pause_turn stop reason to prevent 400 errors with native web search (#2869) (#3248)
Map pause_turn to "pauseTurn" instead of "stop" so the agent loop
continues when Anthropic's server pauses a long-running turn (e.g.
native web search hitting its iteration limit). Previously the
incomplete server_tool_use block was saved to history, causing a
400 invalid_request_error on the next API call.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:51:18 -06:00
Tom Boucher
341a211be2 fix: use authoritative milestone status in web roadmap (#2807) (#3258)
* fix: use authoritative milestone status in web roadmap instead of slice heuristics (#2807)

The roadmap view was deriving milestone status from slice completion
flags, which disagrees with the actual GSD state model when milestones
have lifecycle states (complete/active/pending/parked) or validation
verdicts that differ from what slice progress implies.

Add status and validationVerdict fields to WorkspaceMilestoneTarget,
populate them from the state registry and VALIDATION files, and update
getMilestoneStatus() to prefer the authoritative status with a fallback
to the old heuristic for backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add .js import extension and slice type annotations in workspace-status

Fixes TS2835 (missing .js extension for NodeNext resolution) and TS7006
(implicit any on slice callback parameters) that caused CI build failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: extract workspace types to .ts file to avoid jsx resolution error

Move WorkspaceTaskTarget, WorkspaceSliceTarget, WorkspaceMilestoneTarget,
and RiskLevel to workspace-types.ts so that workspace-status.ts (a plain
.ts file) can import them without requiring --jsx. The .tsx store file
re-exports the types for backward compatibility.

Fixes TS6142 in CI for PR #3258.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:50:57 -06:00
Tom Boucher
a725fa2d9d fix: classify long-context entitlement 429 as quota_exhausted, not rate_limit (#2803) (#3257)
The "Extra usage is required for long context requests" error from
Anthropic is a billing gate, not a transient rate limit. Classify it as
quota_exhausted so the handler enters the fallback path instead of an
infinite backoff loop. When no cross-provider fallback exists, attempt a
[1m] to base model downgrade before stopping cleanly.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:50:36 -06:00
Tom Boucher
50fbd0a837 fix(docs): use ~/.pi/agent/extensions/ for community extension install path (#3131) (#3259)
Community extensions must be placed in ~/.pi/agent/extensions/, not
~/.gsd/agent/extensions/ which is reserved for bundled extensions synced
from the gsd-pi package. Extensions placed in the wrong path are silently
ignored by the loader.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:50:25 -06:00
Tom Boucher
d25dbb15fd fix: add disk→DB slice reconciliation in deriveStateFromDb (#2533) (#3262)
Slices defined in ROADMAP.md but missing from the SQLite database caused
permanent "No slice eligible — check dependency ordering" blocks. The
dependency resolver only considered DB rows, so disk-only slices were
invisible. This adds a reconciliation step (mirroring the existing
milestone reconciliation) that parses each milestone's ROADMAP.md,
compares against getMilestoneSlices(), and inserts missing slices with
correct status based on SUMMARY file presence.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:50:13 -06:00
Tom Boucher
0964c97931 fix: run forensics duplicate detection before investigation (#2704) (#3260)
Move the dedup check from after the Investigation Protocol to before it,
so already-known bugs are caught before spending tokens on deep source
analysis. The DEDUP_PROMPT_SECTION now acts as a pre-investigation gate
with a decision to skip full investigation when a match is found.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:50:06 -06:00
Tom Boucher
3d896eee8a fix: skip TUI render loop on non-TTY stdout to prevent CPU burn (#3095) (#3263)
When gsd is spawned as an RPC bridge child process, stdout is a pipe
(process.stdout.isTTY === undefined). The TUI render loop would run at
~4,600 renders/sec writing ANSI escape codes to the pipe, consuming
500%+ CPU per process while idle.

Add isTTY guard to Terminal interface, ProcessTerminal.start(), TUI.start(),
and requestRender() so the entire render pipeline is skipped on non-TTY stdout.
RemoteTerminal (browser-backed) correctly reports isTTY=true.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:49:55 -06:00
Tom Boucher
da135e9334 fix: persist forensics report context across follow-up turns (#2941) (#3261)
The forensics prompt was sent as a one-shot message via sendMessage()
with triggerTurn: true, causing context loss on follow-up turns. Now
writes an active-forensics.json marker to .gsd/runtime/ so that
buildBeforeAgentStartResult() can re-inject the forensics prompt on
subsequent turns, mirroring how guided task execution context works.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:49:50 -06:00
Tom Boucher
155df22e9e fix: invalidate workspace state on turn_end so milestones list stays current (#2706) (#3266)
The milestones list only refreshed on agent_end events, causing stale
milestone state during multi-turn agent execution. Add turn_end as a
workspace cache invalidation trigger so the UI reflects milestone
changes after each turn boundary.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:48:40 -06:00
Tom Boucher
603839d7f8 fix: eliminate 3 recurring doctor audit false positives (#3105) (#3264)
Bug 1: orphaned worktree check now skips directories that only contain
doctor artifacts (.gsd/doctor-history.jsonl), preventing the circular
false positive where appendDoctorHistory recreates the dir it reports.

Bug 2: blocker_discovered_no_replan check now skips when all tasks are
done, treating the blocker as implicitly resolved and breaking the
deadlock with stale_replan_file.

Bug 3: parsePlan now scans the full body for task checkboxes after the
Tasks section, finding T02+ entries that appear after interleaved
detail headings (## Steps, ## Must-Haves).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:48:26 -06:00
Tom Boucher
03a479858d fix(web): reconcile auto-mode state with on-disk lock in dashboard (#2705) (#3265)
The subprocess spawned by collectAuthoritativeAutoDashboardData always
starts with fresh module state (s.active === false), so the web UI
always showed "Start auto" even while auto mode was running. After
obtaining the subprocess result, reconcile active/paused state with
the on-disk session lock (.gsd/auto.lock) and paused-session metadata
(.gsd/runtime/paused-session.json).

Closes #2705

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:48:21 -06:00
Tom Boucher
795e160cc3 fix: treat ghost milestones as ineligible for parallel execution (#2501) (#3268)
Milestones with no registry entry (ghost directories with no planning
files) were falling through to eligible status due to the fallback
`entry?.status ?? "pending"` combined with empty deps. Now explicitly
classified as ineligible with "no planning data" reason before any
status/dep checks run.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:48:15 -06:00
Tom Boucher
3ec96fd992 fix: redirect auto-mode to headless when stdout is piped (#2732) (#3269)
When `gsd auto` is run with piped stdout (e.g. `gsd auto | cat` or
`gsd auto > file`), the TUI cannot render on a non-terminal output
stream, causing the process to hang indefinitely.

This fix:
- Detects piped stdout before entering interactive mode and redirects
  `gsd auto` to headless mode automatically
- Extends the interactive mode TTY gate to also check process.stdout.isTTY
  (previously only checked stdin), with a descriptive error message
- Adds `gsd headless` to the non-interactive alternatives hint

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:48:07 -06:00
Tom Boucher
81e303a483 fix: attempt VACUUM recovery when initSchema fails with corrupt freelist (#2519) (#3270)
When a file-backed database has a corrupted freelist, DDL operations
fail with "database disk image is malformed" even though integrity_check
passes. This adds VACUUM recovery to openDatabase() before re-throwing,
matching SQLite's documented recovery strategy for freelist corruption.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:47:13 -06:00
Tom Boucher
eab13c0ef5 fix: resolve db_unavailable loop in worktree/symlink layouts (#2517) (#3271)
Three fixes for the auto-mode regression where db_unavailable causes
infinite artifact-retry re-dispatch loops:

1. resolveProjectRootDbPath now handles /.gsd/projects/<hash>/worktrees/
   paths (symlink-resolved layout) in addition to /.gsd/worktrees/
2. ensureDbOpen emits structured diagnostics (resolvedPath, cwd, error)
   instead of silently returning false
3. Post-unit artifact retry skips when isDbAvailable() is false, treating
   DB infra failure as fatal instead of entering a retry loop

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:47:01 -06:00
Tom Boucher
7b72e1132c fix: correct OAuth fallback request shape for google_search (#2963) (#3272)
The searchWithOAuth() function sent a request body that the Cloud Code
Assist API rejected with 400 INVALID_ARGUMENT. Two issues:

1. URL was missing ?alt=sse query parameter (endpoint returns SSE format)
2. Request body was missing the required userAgent field

Also adds regression tests that capture the fetch call and assert the
request URL and body match the Cloud Code Assist wire contract.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:46:38 -06:00
Tom Boucher
37ec08d23c fix: prevent UAT stuck-loop and orphaned worktree after milestone completion (#3065)
Bug 1 -- UAT stuck-loop: syncProjectRootToWorktree used force:false for
all milestone files, which preserved stale ASSESSMENT files in the
worktree. When the project root had a passing verdict but the worktree
retained a FAIL copy (or lost it during DB rebuild), checkNeedsRunUat
found no passing verdict and re-dispatched run-uat indefinitely (x9).

Fix: after the additive-only safeCopyRecursive, walk ASSESSMENT files in
the project root and force-overwrite the worktree copy when the source
contains a verdict field. This is safe because ASSESSMENT verdicts are
only ever overwritten in a forward direction (FAIL -> PASS on retry).

Bug 2 -- Orphaned worktree: removeWorktree silently swallowed failures
from git worktree remove when untracked files (UAT-RESULT, ASSESSMENT)
blocked removal. The .git/worktrees/<name> internal directory held a
lock that also prevented the rmSync fallback from working.

Fix: after both native removal attempts fail, explicitly remove the git
internal .git/worktrees/<name> directory first, then retry rmSync on
the worktree filesystem directory. Log a warning with manual cleanup
instructions if the final attempt also fails.

Closes #2821

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:36:01 -06:00
Tom Boucher
47c1b9cd7f fix(mcp): handle server names with spaces in mcp_discover (#3037)
getServerConfig now trims whitespace and performs case-insensitive
matching so that names like "langgraph Code" resolve correctly.
getOrConnect uses config.name as the canonical cache key to prevent
duplicate connections from variant casing.

Closes #3029

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:29:14 -06:00
Tom Boucher
74c585074f fix(gsd): detect markdown body verdicts and guard plan-milestone against completed slices (#2960) (#3035)
Two fixes for the state corruption chain reported in #2960:

1. extractVerdict() now detects verdicts in markdown body patterns
   (e.g., **Verdict:** PASS) when YAML frontmatter is absent, preventing
   the state machine from looping on validating-milestone when LLMs write
   VALIDATION.md manually.

2. handlePlanMilestone() now refuses to re-plan a milestone that has
   completed slices, preventing INSERT OR IGNORE from shadowing completed
   work after worktree recreation or DB resync.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:28:51 -06:00
Jeremy
977e6bf963 chore(gitignore): exclude src/ build artifacts, scratch files, and .plans/
Compiled .js/.d.ts/.map files from dev builds were leaking into src/.
Also ignores preflight-script.ts (scratch WIP) and .plans/ directory.
2026-03-30 07:12:57 -05:00
Jeremy
0d8e6c26bb fix(error-classifier): replace STREAM_RE whack-a-mole with catch-all V8 JSON.parse pattern
The old STREAM_RE enumerated specific JSON error messages individually,
missing variants like "No number after minus sign", "Bad control character",
and "Expected ',' or '}' after property value" — causing auto-mode to
permanently pause instead of retrying.

Replace with a catch-all: all V8 JSON.parse errors end with
"in JSON at position \d+", so one pattern covers every current and
future variant. Keeps "Unexpected end of JSON" and "SyntaxError.*JSON"
for older runtimes.

Supersedes PR #3134. Refs #2882.
2026-03-30 06:58:47 -05:00
Jeremy
92a3460b66 fix(pi-ai): cast test tool fixtures to any for TSchema compatibility
The Tool interface requires TSchema parameters (TypeBox), but test
fixtures use plain objects. Cast makeTool return as any to satisfy tsc.
2026-03-29 23:06:44 -05:00
Jeremy
aa6dce948c test(pi-ai): add tests for convertTools cache_control breakpoint 2026-03-29 22:27:51 -05:00
Jeremy
49c05eaaa7 perf(pi-ai): add cache_control breakpoints to tool definitions
Tool definitions are large and static across turns but had no cache
breakpoint. Add a 3rd breakpoint (system → tools → last user message)
for Anthropic direct, Bedrock, and OpenRouter Anthropic providers.

Closes gsd-build/gsd-2#3176
2026-03-29 22:25:36 -05:00
Jeremy
ea088f498d feat(gsd): add /gsd show-config command
Adds a read-only command to display the current effective GSD
configuration — token profile, model assignments per phase, dynamic
routing tiers, git settings, budget, supervisor, workflow toggles,
parallel config, hooks, and preference file sources.

Renders as a themed TUI overlay (scrollable, esc/q to close) with
plain-text fallback for headless/RPC mode.
2026-03-29 15:17:04 -05:00
Jeremy
59d80e200a feat(vscode): sidebar redesign, SCM provider, checkpoints, diagnostics [3/3]
Comprehensive vscode extension redesign with sidebar reorganization,
new features, and enhanced agent integration:

- Redesign sidebar UI: reduce 6 panels to 3, declutter layout
- SCM provider for tracking agent-modified files
- Checkpoint system for saving/restoring agent state
- Diagnostic integration for surfacing errors in editor
- Line-level editor decorations for agent-modified lines
- Git integration for visualizing agent changes
- Execution plan viewer for live agent step visualization
- Approval/permissions mode system
- Auto-inject editor selection and diagnostics in chat
- Route workflow buttons through Chat panel
- Handle extension UI requests from agent (select, confirm, input)
- Session persistence, ISO timestamp support, descriptive checkpoints
- Bump to v0.3.0
2026-03-29 09:25:07 -05:00
Jeremy McSpadden
92ef605fef fix: type _borderColorKey as 'dim' | 'bashMode' to match ThemeColor
Fixes TypeScript error: Argument of type 'string' is not assignable to parameter of type 'ThemeColor'
2026-03-29 09:04:56 -05:00
Jeremy McSpadden
8d19f195d4 fix(tui): comprehensive TUI review — layout, flow, rendering, and state fixes
Addresses 30+ issues found in a full review of the interactive TUI spanning
layout/visual, user flow, message rendering, and state management dimensions.

Critical (state/memory):
- Fix onBranchChange unsubscribe function being discarded; store and call in stop()
- Add onThemeChange cleanup in stop() to prevent stale callback retention
- Resolve getUserInput() Promise on shutdown so run() while-loop exits cleanly
- Serialize concurrent message_update event handlers via Promise chain to prevent
  duplicate ToolExecutionComponent creation under rapid streaming
- Add cleanup of customFooter, customHeader, autocompleteProvider, and extension
  widgets in stop() to prevent timer/watcher leaks

Major (UX/flow):
- Add two-step confirmation for provider auth removal (r key) — matches session
  delete pattern; first press shows confirm hint, second press executes
- Normalize list navigation wrapping: oauth-selector and session-selector now
  wrap at boundaries, consistent with all other selectors
- Ctrl+C in scoped-models-selector now always cancels modal immediately instead
  of clearing search first
- Config-selector position indicator now counts only selectable items, excluding
  non-selectable group headers from both numerator and denominator
- user-message-selector auto-dismiss replaced setTimeout(100) with
  Promise.resolve().then() to eliminate 100ms flicker
- Add "Unknown command: /foo. Type /help for available commands." feedback for
  unrecognized slash commands instead of silently submitting as chat
- Fix dead-end input path: submitPromptsDirectly=false now dispatches prompt
- Wrap session.prompt in isCompacting path with try/catch (was missing, other
  path had it)
- Add Esc-to-close hint to provider-manager footer (was undocumented)

Rendering bugs:
- Remove identical dead-code else branch in assistant-message spacing logic
- Add 20-line truncation to generic/unknown tool JSON rendering (was unbounded)
- bash-execution updateDisplay() now uses stored _borderColorKey so
  excludeFromContext dim styling is preserved on re-render
- Fix countdown-timer dispose race: _disposed flag prevents extra tick after
  clearInterval
- extension-selector nextSelectable() guard prevents cursor landing on separator
- extension-input now rejects empty/whitespace-only submissions
- Normalize bordered-loader spacing: non-cancellable variant no longer adds
  orphaned spacer before bottom border

Visual/theme:
- daxnuts.ts center() replaced naive ANSI regex with visibleWidth() from
  @gsd/pi-tui for correct true-color sequence handling
- Remove incorrect mistral.ai URL from daxnuts component
- armin.ts now centers art using same visibleWidth approach as daxnuts
- Dark theme warning color: #ffff00 → #e6b800 (muted amber, less harsh)
- dynamic-border default color function wrapped in try/catch to guard against
  undefined theme in jiti-loaded extension contexts
- Footer stats grouped with · separator; cache labels changed from R/W to cr:/cw:
- Replace raw \x1b[1m ANSI codes in custom-message, branch-summary-message,
  compaction-summary-message, skill-invocation-message with theme.bold()
- welcome-screen visLen now uses strip-ansi instead of hand-rolled regex

Performance:
- diff.ts parseDiffLine regex: [+-\s] → [+\- ] (space only, not all whitespace)
- tab replacement width: 3 spaces → 4 spaces (standard) in both diff.ts and
  tool-execution.ts
- chat-controller message_update: skip already-processed content blocks using
  lastProcessedContentIndex to reduce O(n) scan per event
2026-03-29 09:04:56 -05:00
Jeremy
c46a116fca test(commands): add GSDNoProjectError handling tests
Verify GSDNoProjectError is thrown for blocked directories and
the dispatcher catches it with a friendly cd suggestion.
2026-03-29 08:43:08 -05:00
Jeremy
d7e850c509 test(prompts): update validate-milestone test for parallel reviewer structure
The validate-milestone prompt was rewritten to use 3 parallel reviewers.
Update the prompt contract test to verify the new structure instead of
the old gsd_validate_milestone tool approach.
2026-03-29 06:02:13 -05:00
Jeremy
db8a8b4ffb test(dispatch): add parallel research slices dispatch tests
Structural tests verifying dispatch rule, prompt builder, template
variables, and parallel milestone validation reviewers.
2026-03-29 05:58:01 -05:00
Jeremy
d862a2a7f0 test(parallel): add worker_model override validation tests
Add tests verifying ParallelConfig type, preferences validation,
and resolveParallelConfig pass-through for worker_model.
2026-03-29 05:57:16 -05:00
Jeremy
3c7ec7a8da feat(reactive): graph diagnostics and subagent_model config
Add getMissingAnnotationTasks() to surface which tasks lack IO
annotations and prevent parallel dispatch. Also add subagent_model
to ReactiveExecutionConfig for overriding the model used by
subagents during parallel task execution.

- getMissingAnnotationTasks() with 4 tests
- subagent_model field on ReactiveExecutionConfig type
- Validation for reactive_execution.subagent_model preference
2026-03-29 05:45:10 -05:00
Jeremy
aa5c3085e0 feat(dispatch): parallel research slices and parallel milestone validation
Add dispatch rule that detects when multiple slices need research
simultaneously and dispatches them in parallel via subagents. Also
rewrite validate-milestone prompt to use 3 parallel reviewers
(requirements, integration, UAT) for faster validation.

- New dispatch rule: planning → parallel-research-slices (2+ ready)
- buildParallelResearchSlicesPrompt with per-slice subagent prompts
- Parallel research slices prompt template
- Validate-milestone rewritten for 3 parallel reviewers
2026-03-29 05:42:11 -05:00
Jeremy
5cf86ff490 feat(parallel): worker model override for parallel milestone workers
Add parallel.worker_model preference so coordinators can assign a
cheaper model to parallel workers (e.g. Haiku for execution) instead
of inheriting the coordinator's model. The override is applied via
GSD_WORKER_MODEL env var during worker bootstrap.

- Add worker_model to ParallelConfig type and validation
- Inject GSD_WORKER_MODEL env in spawnWorker when configured
- Apply override in bootstrapAutoSession for parallel workers
- Document in preferences-reference.md
2026-03-29 05:37:48 -05:00
Jeremy
167832e105 refactor(complexity): reclassify planning phases from standard to heavy tier
Move plan-milestone and plan-slice from standard to heavy tier so
planning uses the best configured model (e.g. Opus) and is not
downgraded by dynamic routing. Milestone-level planning analysis
also returns heavy instead of standard.
2026-03-29 05:35:11 -05:00
Jeremy
567f5242ca fix(commands): use specific validation reason in blocked-directory warning
Show the actual reason from validateDirectory (e.g. "Refusing to run in your
home directory" or "Refusing to run in system directory: /usr") instead of a
generic "No project found" message.
2026-03-28 18:17:59 -05:00
Jeremy
cb6b9c38d6 fix(commands): show friendly message when /gsd runs from $HOME instead of unhandled error
Replace assertSafeDirectory with validateDirectory in projectRoot() and throw a typed
GSDNoProjectError that the dispatcher catches and renders as a user-friendly warning.

Fixes #3023
2026-03-28 18:09:30 -05:00
Jeremy
b0bb5390fb feat(splash): add remote channel indicator to welcome screen tools row
Add configured remote channel (Discord/Slack/Telegram) as a checkmark
in the tools row alongside Brave/Answers/Jina. Remove verbose remote
status lines and duplicate display from header-renderer and register-hooks.
2026-03-28 12:38:33 -05:00
TÂCHES
0a2c9b64c6 feat: stream full text and thinking output in headless verbose mode (#2934)
Previously, headless --verbose mode accumulated text_delta events into a
buffer and displayed a single truncated 120-char [thinking] line before
tool calls. The model's actual text responses between tool calls were
effectively invisible.

Changes:
- Stream text_delta and thinking_delta events directly to stderr in
  verbose mode with [text] and [thinking] block markers
- No truncation — full model output is visible
- Fix non-verbose fallback: read from ame.delta (correct field) instead
  of ame.text (always undefined for text_delta events)
- Track inTextBlock/inThinkingBlock state to properly close streaming
  blocks before tool calls
- Expand summarizeToolArgs with support for async_bash, await_job,
  cancel_job, find, ls, lsp, hashline_edit, subagent, browser_navigate,
  and gsd_* tools
- Add streaming formatter functions: formatTextStart, formatTextEnd,
  formatThinkingStart, formatThinkingEnd
- Update tests for new tool arg summarization and path field handling
2026-03-27 21:57:11 -06:00
TÂCHES
efe61c2fcc wip: M005 daemon — orchestrator, event bridge, formatter, batcher improvements (#2929)
Saves in-progress daemon work from M005-m138xe that was sitting uncommitted.
Includes orchestrator expansion, event bridge/formatter enhancements,
message batcher tweaks, and discord bot additions.
2026-03-27 20:22:30 -06:00
github-actions[bot]
1783559610 release: v2.58.0 2026-03-28 02:14:33 +00:00
TÂCHES
8d0a81ff89 Merge pull request #2925 from gsd-build/fix/2923-double-startauto-race
fix(auto): guard startAuto() against concurrent invocation
2026-03-27 19:45:38 -06:00
Lex Christopherson
86f97885cc fix(auto): guard startAuto() against concurrent invocation (#2923)
checkAutoStartAfterDiscuss() fire-and-forgets startAuto() when a
milestone is ready. The headless runner then chains `/gsd auto`,
calling startAuto() a second time. Two concurrent auto-loops on the
same AutoSession singleton corrupt shared state (counters, dispatch
maps), causing planning/execution to never run after research.

Add an early `s.active` check at the top of startAuto() so the second
call no-ops. Add source-scanning test to enforce the guard exists.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:35:10 -06:00
NilsR0711
79da90edde fix(auto-dispatch): widen operational verification gate regex (fixes #2866) (#2898)
Three defects in the completing-milestone dispatch guard caused false
positive blocks on valid validation output:

1. Single-line constraint: [^\n]* stopped at newlines, missing verdicts
   on subsequent lines. Fixed with [\s\S]{0,500}? (bounded lazy match).

2. Missing keywords: 'satisfied' and 'partially' were absent from the
   alternation. LLMs commonly write 'PARTIALLY SATISFIED' or 'FULLY
   SATISFIED'. Added both.

3. Markdown bold delimiters: **Operational** blocked [\s:] after the
   word. The new [\s\S] class handles any character including *.

Also adds SATISFIED to the structuredMatch includes check, and  to
the prose regex (overlaps with #2862).

Includes 8 regression test cases covering multi-line formats, satisfied
keyword variants, markdown bold tables, and checkmark emoji.
2026-03-27 18:10:10 -06:00
Jordan Gaytan
558b1f2081 fix(parallel): three bugs preventing reliable parallel worker execution (#2801)
Bug 1 — Workers exit immediately (#2792):
spawnWorker() used `--print "/gsd auto"` which calls session.prompt()
that returns immediately when ctx.newSession() resets the session inside
the auto-loop. Changed to `headless --json auto` which uses an RPC
client that keeps the process alive until auto-mode completes.

Bug 2 — Dispatch guard blocks parallel workers (#2797):
getPriorSliceCompletionBlocker() checked ALL milestones in queue order,
blocking M012 when M011 had incomplete slices. When GSD_MILESTONE_LOCK
is set, the guard now only checks intra-milestone slice dependencies.
Added test covering cross-milestone bypass + intra-milestone preservation.

Bug 3 — Orphaned RPC children on stop (#2798):
stopParallel() gave only 750ms for SIGTERM before SIGKILL. The headless
parent needs ~1500ms to cascade shutdown to its RPC child via
client.stop(). Increased to 3000ms to prevent orphaned processes holding
auto.lock.

Updated tests:
- dispatch-guard.test.ts: new test for GSD_MILESTONE_LOCK bypass
- parallel-worker-monitoring.test.ts: updated spawn args assertion
2026-03-27 18:10:02 -06:00
NilsR0711
7c5dae0298 fix(web): fall back to project totals when dashboard metrics are zero (#2847)
The dashboard reads elapsed time, total cost, and tokens used
exclusively from AutoDashboardData. When auto-mode is not active
(e.g. manual /gsd next), auto is null and all three metrics show 0
— even though the status bar displays real values via /api/visualizer.

Add the same projectTotals polling pattern (30s interval via
/api/visualizer) that status-bar.tsx already uses, and wire it into
the fallback chain: projectTotals ?? auto ?? 0.

Closes #2709
2026-03-27 18:09:55 -06:00
mastertyko
6918fb76c6 fix(gsd): parse raw YAML under preference headings (#2794)
Accept raw YAML blocks beneath markdown preference headings while preserving legacy heading-list parsing.

Closes #2787
2026-03-27 18:09:48 -06:00
mastertyko
c88a9d2d4f fix(gsd): persist verification classes in milestone validation (#2820) 2026-03-27 18:09:39 -06:00
drkthng
6dd02bb3ce fix(gsd): guard reconcileWorktreeDb against same-file ATTACH corruption (#2825)
When worktrees use shared-WAL mode (R012), the worktree DB path resolves
to the same physical file as the project root DB via symlink. Calling
reconcileWorktreeDb() ATTACHes this WAL-mode file to itself, corrupting
the database with 'database disk image is malformed'.

Fix 1 — auto-worktree.ts mergeMilestoneToMain(): skip reconciliation
when isSamePath() confirms both DB paths resolve to the same file.

Fix 2 — gsd-db.ts reconcileWorktreeDb(): defence-in-depth realpathSync
guard inside the function itself, before the ATTACH statement.

Fix 3 — auto/infra-errors.ts: classify 'database disk image is
malformed' as SQLITE_CORRUPT infrastructure error so the auto-loop
stops immediately instead of burning 3 retries on a guaranteed failure.

Regression tests verify:
1. Same-file via symlink returns zero (no ATTACH)
2. Identical string paths return zero
3. Genuinely different DBs still reconcile normally
4. Malformed DB message classified as infra error
5. Transient SQLITE_BUSY is not falsely classified

Closes #2823
2026-03-27 18:08:13 -06:00