Commit graph

2533 commits

Author SHA1 Message Date
Tom Boucher
0908adcb4e fix: reopen DB on cold resume, recognize heavy check mark (#3319)
* fix: reopen DB on cold resume and recognize U+2714 check mark

The paused-session resume path in auto.ts called rebuildState/deriveState
without first opening the project database, causing state derivation to
fall back to markdown parsing. This misparsed roadmap table rows with
glyph done markers and could redispatch wrong slices.

Export openProjectDbIfPresent from auto-start.ts and call it in the
resume path before rebuildState, matching the fresh bootstrap ordering.

Also add U+2714 (heavy check mark) to the table parser done-detection
regex alongside the existing U+2705/U+2611/U+2713 glyphs.

Closes #2940

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

* fix: remove duplicate openProjectDbIfPresent from rebase conflict

The rebase onto main introduced a duplicate `openProjectDbIfPresent`
function declaration (one from the PR, one from main), causing TS2393.
Keep the exported version that uses the static import.

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

* fix: use logWarning instead of process.stderr in openProjectDbIfPresent

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: trek-e <trek-e@users.noreply.github.com>
2026-04-05 00:49:29 -04:00
Tom Boucher
b1ae782876 fix: dashboard model label shows dispatched model, not stale previous unit (#3320)
* fix: dashboard model label shows dispatched model, not stale previous unit model

Move updateProgressWidget and ensurePreconditions after selectAndApplyModel
in phases.ts so the widget's first render tick reads the correct model.
Store currentDispatchedModelId in session state after model selection + hook
overrides, expose it via widgetStateAccessors, and update auto-dashboard.ts
to prefer the dispatched model ID over cmdCtx.model which can be stale.

Closes #2899

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

* fix(test): widen runUnitPhase slice in ordering test to accommodate grown function body

The structural test for selectAndApplyModel ordering sliced only 8000
chars of runUnitPhase, but the function grew past that limit after
rebase, causing updateProgressWidget to fall outside the window.

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

* chore: retrigger CI

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: trek-e <trek-e@users.noreply.github.com>
2026-04-05 00:48:50 -04:00
Tom Boucher
9b6ff01471 docs: add provider setup guide for third-party LLM providers (#3294)
* docs: add provider setup guide and improve onboarding hints

Fixes #2161

Add docs/providers.md with step-by-step setup instructions for every
supported LLM provider: OpenRouter, Ollama, LM Studio, vLLM, SGLang,
and all built-in providers. Includes env var names, example configs,
common pitfalls, and verification steps.

Improve onboarding wizard:
- Add URL hints to provider selection list
- Show common local endpoints when choosing Custom (OpenAI-compatible)
- Add post-setup guidance for OpenRouter and custom endpoints
- Reference docs/providers.md for compat troubleshooting

Update cross-references in getting-started.md, troubleshooting.md,
docs/README.md, and help-text.ts to link to the new guide.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: verify config help mentions OpenRouter, Ollama, and docs/providers.md

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: trek-e <trek-e@users.noreply.github.com>
2026-04-05 00:48:19 -04:00
github-actions[bot]
647954098a release: v2.63.0 2026-04-05 03:48:56 +00:00
Jeremy McSpadden
ab38f60cc2 Merge pull request #3525 from jeremymcs/fix/diagnostic-messaging
fix(gsd): enrich vague diagnostic messages with root-cause context
2026-04-04 21:20:43 -05:00
Jeremy
53639aee5d fix(gsd): enrich vague diagnostic messages with root-cause context
Closes #3524
2026-04-04 21:04:26 -05:00
github-actions[bot]
b8cb665ba5 release: v2.62.1 2026-04-05 01:33:15 +00:00
github-actions[bot]
546c93cae7 release: v2.62.1 2026-04-05 01:33:15 +00:00
Jeremy McSpadden
9e3ee58619 Merge pull request #3514 from jeremymcs/fix/ask-user-questions-dedup
fix(gsd): prevent duplicate ask_user_questions dispatches
2026-04-04 20:12:48 -05:00
Jeremy
ca55b5c269 fix(test): reset dedup cache between ask-user-freetext tests
The per-turn dedup cache introduced in the parent commit persists across
test cases since they all use the same question signature. Test 1 populates
the cache, causing tests 2 and 3 to get cached results instead of exercising
their intended code paths.
2026-04-04 19:59:54 -05:00
Jeremy McSpadden
74d5200cfd Merge pull request #3516 from jeremymcs/feat/mcp-server-readonly-tools
feat(mcp-server): add 6 read-only tools for project state queries
2026-04-04 19:56:49 -05:00
Jeremy McSpadden
34baf57e40 Merge pull request #3518 from jeremymcs/fix/bootstrap-prefer-gsd-preferences
fix(gsd): prefer PREFERENCES.md over settings.json for bootstrap model
2026-04-04 19:50:09 -05:00
Jeremy McSpadden
56153c9096 Merge pull request #3520 from jeremymcs/fix/worktree-orphaned-wal-shm
fix(db): delete orphaned WAL/SHM files alongside empty gsd.db
2026-04-04 19:47:14 -05:00
Jeremy
e4987f5337 fix(db): delete orphaned WAL/SHM files alongside empty gsd.db (#2478)
syncProjectRootToWorktree deleted empty gsd.db but left companion
-wal and -shm files on disk. On Node 24, node:sqlite attempts WAL
recovery from orphaned files, triggering a synchronous CPU spin loop
(227% CPU, 1.4GB RSS). Now deletes gsd.db-wal and gsd.db-shm when
the main DB is deleted or already missing.
2026-04-04 19:36:43 -05:00
Jeremy McSpadden
b0697f24f6 Merge pull request #3519 from jeremymcs/fix/auto-wrapup-inflight-interrupt
fix(gsd): prevent auto-wrapup from interrupting in-flight tool calls
2026-04-04 19:26:02 -05:00
Jeremy
fd96a1a30b fix(gsd): prevent auto-wrapup from interrupting in-flight tool calls (#3512)
Gate triggerTurn behind getInFlightToolCount() === 0 for both soft
timeout and context-pressure wrapup messages. Add clearQueue() to
stopAuto() and pauseAuto() to flush late async follow-ups.
2026-04-04 19:14:23 -05:00
Jeremy McSpadden
246e706991 Merge pull request #3495 from Tibsfox/fix/tool-argument-json-robustness
fix(pi-ai): extend repairToolJson to handle XML tags and truncated numbers
2026-04-04 19:02:28 -05:00
Jeremy McSpadden
12ef95024c Merge pull request #3451 from deseltrus/fix/stale-retries-after-model-switch
fix: cancel stale retries after model switch
2026-04-04 18:27:33 -05:00
Jeremy McSpadden
dbaf37ae78 Merge pull request #3491 from Tibsfox/fix/claude-code-skill-directory-support
fix(gsd): add Claude Code official skill directories to skill resolution
2026-04-04 18:24:51 -05:00
Jeremy McSpadden
677ca806df Merge pull request #3494 from Tibsfox/fix/decision-save-transaction-race
fix(gsd): wrap decision and requirement saves in transaction to prevent ID races
2026-04-04 18:23:15 -05:00
Jeremy
eed833138d chore: untrack .repowise/ and add to .gitignore
Machine-local indexing state (LanceDB, sync cursors, job files) was
being tracked in Git, causing merge conflicts and stale cursor
propagation across branches. Gitignore alone doesn't affect
already-tracked files, so this removes them from the index while
keeping them on disk.
2026-04-04 18:22:39 -05:00
Jeremy
70c76d9a1a fix(gsd): handle bare model IDs in resolveDefaultSessionModel (#3517)
resolveDefaultSessionModel() previously only returned a result for
provider/model format strings, silently ignoring valid bare model IDs
like "gpt-5.4". This meant preferences could fail to override stale
settings.json defaults when users configured models without explicit
provider prefixes.

Now accepts sessionProvider param (ctx.model?.provider) to resolve bare
IDs. Also handles object configs without explicit provider field.
2026-04-04 18:10:50 -05:00
Tibsfox
c70eacea89 fix(gsd): wrap decision and requirement saves in transaction to prevent ID races
nextDecisionId() and nextRequirementId() compute the next ID via
SELECT MAX then pass it to a separate upsertDecision/upsertRequirement
call. When parallel tool calls hit these functions concurrently, both
read the same MAX value and produce the same ID — the second insert
silently overwrites the first.

Move the SELECT MAX + INSERT into a single transaction() call from
gsd-db.ts, which uses BEGIN/COMMIT/ROLLBACK and works on both
better-sqlite3 and node:sqlite providers. The transaction is
re-entrant safe (nested calls skip the BEGIN).

Same fix applied to saveRequirementToDb for consistency.

Closes #3326, closes #3339, closes #3459
2026-04-04 15:16:52 -07:00
Jeremy
fbcd722cf4 fix(gsd): prefer PREFERENCES.md over settings.json for session bootstrap model (#3517)
Session bootstrap used ctx.model (from settings.json defaultProvider/defaultModel)
as the autoModeStartModel snapshot. When settings.json had a stale provider
(e.g. claude-code) but PREFERENCES.md was fully configured for openai-codex,
sessions would start with the wrong provider and fail with auth errors.

Add resolveDefaultSessionModel() to preferences-models.ts which extracts the
default model from GSD preferences (execution → planning → first configured).
In auto-start.ts, the preferred model now takes priority over ctx.model when
building startModelSnapshot, so PREFERENCES.md always wins over stale settings.
2026-04-04 17:15:43 -05:00
Tibsfox
e107828363 fix(gsd): add Claude Code official skill directories to skill resolution
GSD-2 only searches ~/.agents/skills/ and .agents/skills/ for skills.
Claude Code's official skill directories (~/.claude/skills/ and
.claude/skills/) are not included in the search path, making GSD-2
blind to any skills managed there.

The skills.sh CLI (npx skills list -g) already recognises both
~/.agents/skills/ and ~/.claude/skills/ as valid global skill
directories. This commit aligns GSD-2's resolution logic with
that behaviour.

Affected functions:
- getSkillSearchDirs(): adds ~/.claude/skills/ and .claude/skills/
- captureAvailableSkills(): includes Claude Code dir in telemetry
- detectStaleSkills(): includes Claude Code dir in staleness checks
- detectNewSkills(): resolves SKILL.md from either directory
- isPackInstalled(): checks both dirs before recommending installs
- formatSkillDetail(): finds SKILL.md in either directory
2026-04-04 15:15:29 -07:00
Jeremy
75a5be9278 fix(dedup): hash full question payload, not just IDs
The questionSignature() function only hashed sorted question IDs,
meaning calls with the same IDs but different text/options would
return stale cached answers. Now hashes the full canonicalized
payload (id, header, question, options, allowMultiple).

Adds 4 regression tests for signature correctness.
2026-04-04 17:02:59 -05:00
Jeremy
45b606744f feat(mcp-server): add 6 read-only tools for project state queries (#3515)
Add gsd_progress, gsd_roadmap, gsd_history, gsd_doctor, gsd_captures,
and gsd_knowledge tools that parse .gsd/ on disk — no session needed.

Inline lightweight readers in src/readers/ keep the package standalone
(zero new dependencies). 33 new tests, 64 total passing.
2026-04-04 16:41:24 -05:00
Jeremy
f0759086e4 fix(gsd): prevent duplicate ask_user_questions dispatches with per-turn dedup cache
Closes #3513

- Add per-turn dedup cache in ask_user_questions keyed by hashed question IDs;
  duplicate calls return cached results instead of re-dispatching to Discord
- Lower loop guard threshold for interactive tools (ask_user_questions) from 4
  to 1 — blocks 2nd identical call immediately
- Wire cache reset into session_start, session_switch, and agent_end hooks
- Harden discuss prompts with "call exactly once per turn" instruction
- Add regression tests covering strict threshold and dedup behavior
2026-04-04 16:33:36 -05:00
Jeremy McSpadden
099e6f3120 Merge pull request #3511 from jeremymcs/fix/steer-worktree-path
fix(gsd): steer writes overrides to worktree when active
2026-04-04 16:10:30 -05:00
github-actions[bot]
40fc92a2a6 release: v2.62.0 2026-04-04 21:10:16 +00:00
github-actions[bot]
f6521cd92e release: v2.61.0 2026-04-04 20:53:42 +00:00
Jeremy
ee87924636 fix(gsd): gate steer worktree routing on active session, fix messaging
Address adversarial review findings:

1. [high] Override routing now requires an active auto-mode session
   (in-process or remote via checkRemoteAutoSession) before writing
   to a worktree path. Previously, any existing worktree directory
   would receive the override even if no agent was running there —
   a leftover worktree from a previous session would silently eat
   the override.

2. [medium] Success messages now report the actual resolved override
   location (worktree vs project root .gsd/OVERRIDES.md) so operators
   know exactly where to look during recovery or manual rewrite.

Additional tests cover: inactive worktree fallback, double-gate
(autoRunning + valid .git), and getAutoWorktreePath null on missing .git.

Closes #3476
2026-04-04 15:37:13 -05:00
Jeremy McSpadden
82906524a8 Merge pull request #3482 from NilsR0711/fix/remote-questions-interactive-mode
fix(remote-questions): fire configured channels in interactive mode
2026-04-04 15:32:19 -05:00
Jeremy
bd863e3e21 fix(gsd): resolve steer overrides to worktree path when worktree is active
handleSteer used process.cwd() as the base path for appendOverride,
which writes to project/.gsd/OVERRIDES.md. When auto-mode runs in a
worktree, it reads from worktree/.gsd/ — so overrides written from a
second terminal were never seen by the agent.

Now checks for an active worktree via getAutoWorktreePath and writes
the override there when one exists, falling back to the project root
when no worktree is active.

Closes #3476
2026-04-04 15:25:26 -05:00
Jeremy McSpadden
af82c37041 Merge pull request #2755 from jeremymcs/feat/capability-aware-model-routing-pr
feat: capability-aware model routing (ADR-004)
2026-04-04 15:23:38 -05:00
Jeremy McSpadden
2acf5292d0 Merge pull request #3508 from jeremymcs/fix/audit-log-hardening
fix(gsd): harden audit log persistence and demote probe warnings
2026-04-04 15:12:14 -05:00
Jeremy McSpadden
1c4219ee2e Merge pull request #3510 from jeremymcs/feat/codebase-map-enhancements
feat(gsd): enhance /gsd codebase with preferences, --collapse-threshold, and auto-init
2026-04-04 15:11:36 -05:00
Jeremy
4ddb9ca8a5 fix(gsd): add codebase validation in validatePreferences so preferences are not silently dropped
The codebase preferences block was accepted as a known key but never
validated or assigned in validatePreferences(), causing all user-configured
codebase defaults to be silently discarded. Adds validation for
exclude_patterns (string[]), max_files (positive int), and collapse_threshold
(positive int) with unknown-key warnings and 4 new tests.
2026-04-04 15:01:15 -05:00
Jeremy
bbe67da02c feat(gsd): enhance /gsd codebase with preferences, --collapse-threshold, and auto-init
Add configurable codebase map options via preferences.md (exclude_patterns,
max_files, collapse_threshold), expose --collapse-threshold as a CLI flag,
and auto-generate CODEBASE.md during project init for instant agent orientation.

Closes #3509
2026-04-04 14:51:51 -05:00
Jeremy McSpadden
5cd25cf5df Remove copyright notice from test file
Removed copyright notice from capability-router tests.
2026-04-04 14:33:50 -05:00
Jeremy
a290708573 fix(test): update db-path-worktree-symlink test for simplified diagnostic logging
The ensureDbOpen catch block now logs via logWarning with error message
instead of structured diagnostic object. Update source-level assertion
to match the new pattern.
2026-04-04 14:33:12 -05:00
Jeremy
6eb532bf9d fix(gsd): update tests for errors-only audit persistence, fix empty catch blocks
Update existing workflow-logger tests to use logError for audit
persistence assertions (warnings are now ephemeral). Add void
expression to empty catch blocks in detectMainBranch to satisfy
the no-empty-catch CI check.
2026-04-04 14:29:00 -05:00
Jeremy
10cd4a12c5 test(gsd): add workflow-logger audit persistence tests
Covers error-only persistence policy, warning ephemeral behavior,
message truncation, context field allowlist sanitization, and
mixed severity filtering.
2026-04-04 14:22:56 -05:00
Jeremy
2396ecf1db fix(gsd): harden audit log persistence — errors-only, sanitized, demote probe warnings
Only persist error-severity entries to audit-log.jsonl (warnings stay
ephemeral in stderr + buffer). Sanitize persisted entries with message
truncation and context field allowlisting. Demote expected main/master
branch probe failures to silent control flow. Remove JSON.stringify of
diagnostic objects embedding cwd/paths in warning messages.

Addresses Codex adversarial review findings on workflow-logger migration.
2026-04-04 14:19:36 -05:00
Jeremy McSpadden
104d103d14 Merge pull request #3501 from jeremymcs/fix/upgrade-kotlin-lsp
fix: upgrade Kotlin LSP to official Kotlin/kotlin-lsp
2026-04-04 14:04:40 -05:00
Jeremy McSpadden
7a1c6213a0 Merge pull request #3507 from jeremymcs/refactor/workflow-logger-migration
refactor(gsd): migrate all catch blocks to centralized workflow-logger
2026-04-04 14:04:26 -05:00
Jeremy McSpadden
1a21915572 Merge pull request #3505 from jeremymcs/pr-3496
fix(gsd): fail-closed stop guard, harden backtrack parsing, fix prompt params
2026-04-04 13:59:04 -05:00
Jeremy
64fe364fdb fix(gsd): address adversarial review findings on workflow-logger migration
workflow-events.ts: stop logging raw event line content to audit log —
log byte length only to avoid persisting potentially sensitive payload
fragments to .gsd/audit-log.jsonl.

parallel-orchestrator.ts: revert worker NDJSON parse failure to silent
drop — non-JSON lines (progress text, tool output) are expected in
worker stdout and logging each one creates I/O pressure and audit log
bloat in the parallel execution hot path.
2026-04-04 13:53:16 -05:00
Jeremy
3d6d72c04d refactor(gsd): migrate all catch blocks to centralized workflow-logger
Replace raw process.stderr.write(), console.error(), and empty catch
blocks across 50 GSD files with structured logWarning/logError calls
from the centralized workflow-logger system.

Add 13 new LogComponent types to cover all subsystems: recovery,
session, prompt, dashboard, timer, worktree, command, parallel, fs,
bootstrap, guided, registry, renderer.

Every migrated catch block now automatically:
- Shows in terminal (stderr) with component tag
- Gets buffered for auto-loop stuck-detection summary
- Persists to .gsd/audit-log.jsonl for post-mortem analysis

Update regression test to verify catch blocks use workflow-logger
instead of raw stderr/console, covering auto-mode files and all
explicitly migrated infrastructure files.

Closes #3506
Supersedes the approach in #3496
2026-04-04 13:42:55 -05:00
Jeremy
abe887de10 fix(gsd): fail-closed stop guard, harden backtrack parsing, fix prompt params
- Stop/backtrack guard now calls pauseAuto before marking captures executed,
  and returns break on any exception to prevent silently dropping user halt intent
- Backtrack target parsing excludes current milestone ID and rejects ambiguous
  multi-target strings instead of guessing first match
- Fixed gsd_skip_slice parameter names in rethink prompt (milestone_id → milestoneId)
2026-04-04 13:09:16 -05:00