Commit graph

3806 commits

Author SHA1 Message Date
Lex Christopherson
b873f8112f 2.14.4 2026-03-15 15:46:16 -06:00
Lex Christopherson
5662c5fba8 docs: update changelog for v2.14.4 2026-03-15 15:46:16 -06:00
TÂCHES
8882ce484e fix(session): update cwd on newSession to reflect worktree chdir (#517)
When auto-mode creates a worktree and chdir's into it, the Node process
cwd changes but AgentSession._cwd stays frozen at the original path.
Every newSession() builds a system prompt telling the LLM "Current
working directory: /original/path", so the LLM cd's back there and
writes files to the wrong location.

Update _cwd = process.cwd() at the start of newSession() so the system
prompt reflects the actual working directory after chdir.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:45:15 -06:00
Lex Christopherson
ce78c2a7d5 2.14.3 2026-03-15 15:34:13 -06:00
Lex Christopherson
13fe8b2c84 docs: update changelog for v2.14.3 2026-03-15 15:34:13 -06:00
TÂCHES
5ae8cf8851 fix(auto): copy planning artifacts into new auto-worktrees (#516)
Auto-worktrees are fresh git checkouts — untracked .gsd/ files don't
carry over. Projects with the old blanket .gsd/ gitignore have planning
artifacts on disk but not in git. When createAutoWorktree makes a new
worktree, the milestones/, DECISIONS.md, REQUIREMENTS.md etc are missing,
causing auto-mode to loop on plan-slice (plan file not found in worktree).

Copy .gsd/ planning artifacts from the source repo into the new worktree
after git worktree add. Skips runtime files and the worktrees/ dir.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:33:05 -06:00
Lex Christopherson
b333d450a3 2.14.2 2026-03-15 15:22:41 -06:00
Lex Christopherson
4465b5ea76 docs: update changelog for v2.14.2 2026-03-15 15:22:41 -06:00
TÂCHES
cc22920c2e fix(gitignore): self-heal blanket .gsd/ ignore from pre-v2.14.0 projects (#515)
ensureGitignore() now detects and removes standalone ".gsd/" lines that
blanket-ignore the entire directory. Replaces with explicit runtime-only
patterns so .gsd/milestones/ planning artifacts are tracked in git.

Without this, existing projects keep the old blanket ignore forever.
New worktrees start with zero planning state because artifacts aren't
in git, causing auto-mode to re-execute completed work.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:21:04 -06:00
Lex Christopherson
e759af8e2a fix(auto): reset _dispatching flag + improve discuss depth verification UX
- auto.ts: wrap dispatchNextUnit body in try/finally to always reset
  _dispatching to false. Without this, the reentrancy guard permanently
  blocked all subsequent dispatches after the first one, causing the
  dispatch gap watchdog to fire and auto-mode to stall.
- discuss.md: render depth summary as chat text (where markdown renders)
  then use ask_user_questions for the short confirmation only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:20:45 -06:00
Lex Christopherson
484524b528 2.14.1 2026-03-15 15:11:01 -06:00
Lex Christopherson
dd9d837304 docs: update changelog for v2.14.1 2026-03-15 15:11:01 -06:00
TÂCHES
e0c9dc638e fix(auto): quiet diagnostic noise in auto-mode warnings (#514)
Downgrade internal recovery machinery to info/verbose-only so users
only see warnings when action is needed:

- "Dispatch gap detected" → verbose-only info (recovery is automatic)
- "Model not found, trying fallback" → verbose-only info
- "Failed to set model, trying fallback" → verbose-only info
- "Could not set any preferred model" → deleted (redundant)
- "New session cancelled" → info (user action, not error)
- "Unexpected phase" → info with doctor suggestion
- "No command context" → info with restart suggestion

Kept as warnings (user-actionable):
- Budget ceiling, blockers, prior slice incomplete, pre-flight,
  no context, stub summary, model ambiguity, all fallbacks exhausted

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:09:32 -06:00
Lex Christopherson
8737b509c1 2.14.0 2026-03-15 14:35:52 -06:00
Lex Christopherson
60e1abee6f docs: update changelog for v2.14.0 2026-03-15 14:35:34 -06:00
Lex Christopherson
c372c4d87c docs: update README for branchless worktree architecture 2026-03-15 14:34:08 -06:00
Flux Labs
a8ad805973 Merge branch 'main' into fix/gsd-extension-ctx-log 2026-03-15 15:09:58 -05:00
Flux Labs
26e6f0f48d Merge branch 'main' into fix/openrouter-preferences 2026-03-15 15:09:49 -05:00
Flux Labs
d7aaa5c5d9 Merge branch 'main' into fix/tui-resource-leaks-and-quality 2026-03-15 15:09:38 -05:00
TÂCHES
59698978af fix(auto): stop re-running finished tasks after session restart (#513)
* fix(auto): prevent infinite re-dispatch when completion key is missing

Root cause: When a task completed successfully on the first attempt,
the idempotency key was never persisted to completed-units.json.
The persistence logic (persistCompletedKey) only triggered at the
retry threshold (MAX_UNIT_DISPATCHES=3). After session restart, the
key was missing and auto-mode re-dispatched the same task endlessly.

Evidence: M008/S01/T01 was dispatched 15+ times over 3.5 hours.
T01-SUMMARY.md existed, S01-PLAN.md marked T01 as [x], but
completed-units.json had no execute-task/M008/S01/T01 entry.

Fix: Added fallback artifact check before dispatch. If the expected
artifact already exists on disk but the completion key is missing,
the key is repaired (persisted + added to in-memory set) and the
unit is skipped. This catches the gap between the closeout-based
persistence (which requires the NEXT dispatch to fire) and the
retry-threshold persistence (which requires MAX attempts).

Also fixes guided-flow-escape.test.ts: added missing cache
invalidation after rmSync (clearPathCache + invalidateStateCache).

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

* fix(auto): prevent TUI freeze on cascading skip-dispatches

When multiple completed tasks are skipped in sequence (T01 artifact
fallback → T02 idempotency skip → T03 dispatch), the recursive
dispatchNextUnit calls can freeze the TUI.

Fix: invalidateStateCache() after key repair so deriveState returns
the correct next task, and use setTimeout(50ms) instead of
setImmediate to yield more generously to the event loop between
cascading skips.

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

* fix(auto): systematic hardening of dispatch recovery pipeline

Five fixes addressing the 20 failure modes identified in the auto-mode
dispatch loop audit:

1. Stale runtime record cleanup: selfHealRuntimeRecords now clears
   records older than 1h with phase=dispatched (crash orphans), and
   also persists completion keys for records with existing artifacts.

2. Recursion depth limit: _skipDepth counter prevents TUI freeze when
   many completed units are skipped in cascade. After MAX_SKIP_DEPTH
   (20) skips, yields 200ms to the event loop before continuing.

3. Atomic completed-units.json writes: persistCompletedKey now uses
   tmp file + renameSync to prevent partial writes on crash.

4. Skip depth tracking on both skip paths (idempotency check at L1815
   and artifact fallback at L1844) with setTimeout(50ms) between skips.

5. Self-heal now also repairs missing completion keys when artifact
   exists, closing the gap where crash between completion and closeout
   leaves the key unwritten.

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

* fix(auto): add reentrancy guard to dispatchNextUnit itself

The _handlingAgentEnd boolean only guards calls from agent_end hooks.
Direct calls from watchdog timers, step wizard, and crash recovery
can still race with an in-progress dispatch. Added _dispatching guard
that blocks concurrent external calls while allowing recursive skip
calls (_skipDepth > 0). Cleared on stopAuto.

Audit confirmed: double watchdog (#11) already prevented by existing
clearDispatchGapWatchdog in startDispatchGapWatchdog + catch/return.
Counter cleanup (#16) already handled by unitDispatchCount.clear()
in startAuto before selfHealRuntimeRecords.

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

* fix(auto): final hardening for unattended multi-milestone runs

Three fixes from paranoid stress-test audit:

1. Git index.lock cleanup: Remove stale .git/index.lock (>60s old) at
   auto-start. A crash during git commit/merge leaves this file behind,
   blocking ALL subsequent git operations with no recovery.

2. Stub summary for complete-milestone: If the LLM fails to write a
   milestone SUMMARY after MAX_UNIT_DISPATCHES attempts, generate a
   stub summary to unblock the pipeline. Without this, auto-mode
   loops forever in "completing-milestone" phase.

3. Pre-flight queue validation: At auto-start with multiple milestones,
   scan for CONTEXT-DRAFT.md files (will pause for discussion) and
   report milestone count. Gives the user early visibility into what
   will happen during the run.

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

---------

Co-authored-by: deseltrus <simulacraverse@protonmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:06:56 -06:00
TÂCHES
f59301e4ba fix(auto): prevent nested worktree creation inside existing worktrees (#511)
* fix(auto): prevent nested worktree creation inside existing worktrees

When auto-mode starts inside a manual worktree (e.g., /worktree memory-db),
it unconditionally created an auto-worktree for the milestone, nesting
.gsd/worktrees/M001 inside the existing worktree. This caused GSD to
chdir into the inner worktree, read state from the wrong repo, and
report "All milestones complete" or loop on artifact verification.

Add detectWorktreeName() guard to both the start and resume paths:
if already inside a worktree, skip auto-worktree creation and work
directly on the current branch.

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

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-15 13:56:56 -06:00
deseltrus
27d07a35d7 fix(discuss): enforce depends_on frontmatter in multi-milestone CONTEXT.md (#507)
The multi-milestone discussion flow writes CONTEXT.md files for each
milestone but never adds depends_on YAML frontmatter. The QUEUE.md
documents the dependency chain, but the auto-mode state machine reads
dependencies from CONTEXT.md frontmatter only — not from QUEUE.md.

Without frontmatter, milestones execute in filesystem order regardless
of their actual dependency chain, causing out-of-order execution.

Fix: Added MANDATORY depends_on documentation to both discuss.md
(Phase 2, after primary milestone) and queue.md (output section).
Instructs the LLM to write frontmatter with the exact milestone IDs
from the dependency chain confirmed during the milestone split gate.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: TÂCHES <afromanguy@me.com>
2026-03-15 13:55:07 -06:00
TÂCHES
198fb6ca0e Merge branch 'main' into feat-google-oauth-search 2026-03-15 13:45:14 -06:00
TÂCHES
d06262ce4b Merge branch 'main' into fix/gsd-extension-ctx-log 2026-03-15 13:45:09 -06:00
TÂCHES
f844635de0 Merge branch 'main' into fix/tui-resource-leaks-and-quality 2026-03-15 13:45:04 -06:00
TÂCHES
8bf07559d5 Merge branch 'main' into fix/openrouter-preferences 2026-03-15 13:45:02 -06:00
TÂCHES
9f83ab91dd Merge branch 'main' into worktree-investigate-468 2026-03-15 13:44:59 -06:00
TÂCHES
dda9d713f2 chore: remove dead code from branchless refactor (#510)
Remove methods, fields, and comments left over after the branchless
worktree architecture landed:

- git-service.ts: delete isOnSliceBranch, getActiveSliceBranch,
  branchExists (private), discardUntrackedRuntimeFiles (private);
  update writeIntegrationBranch comment and remove --force flag
- worktree.ts: delete isOnSliceBranch, getActiveSliceBranch exports;
  update module doc from "branch-per-slice" to "worktree utilities"
- state.ts: remove activeBranch computation (always null)
- types.ts: remove GSDState.activeBranch field
- templates/state.md: remove "Slice Branch" line
- auto.ts, guided-flow.ts: update "branch-per-slice" comments
- Tests updated to match

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:42:41 -06:00
Flux Labs
e6d55f8aaf Perf/gsd startup speed (#497)
* docs: add startup performance analysis and optimization plan

Profiled GSD CLI startup finding 2.2s for --version and ~3.8s for
interactive mode. Identified 5 root causes with measured timings and
created a phased optimization plan targeting <0.2s for --version
and ~0.8s for interactive startup.

* perf: speed up GSD startup with lazy loading and fast paths

- Fast-path --version/-v and --help/-h in loader.ts before importing
  any heavy dependencies (2.2s → 0.15s, 14x faster)
- Lazy-load undici (~200ms) only when HTTP_PROXY env vars are set
- Skip initResources cpSync when managed-resources.json version
  matches current GSD version (~128ms saved per launch)
- Lazy-load Mistral SDK (~369ms) on first API call instead of startup
- Lazy-load Google GenAI SDK (~186ms) on first API call instead of
  startup
- Parallelize extension loading with Promise.all() instead of
  sequential for-loop

---------

Co-authored-by: TÂCHES <afromanguy@me.com>
2026-03-15 13:33:43 -06:00
TÂCHES
ed47018496 refactor(git): branchless worktree architecture (#506)
Eliminate slice branches — all work commits sequentially on milestone/<MID>
within auto-mode worktrees. No branch creation, switching, or merging
within a worktree. Planning artifacts (.gsd/milestones/) tracked in git
properly instead of being blanket-gitignored then force-added.

Removes ~2,600 lines: ensureSliceBranch, switchToMain, mergeSliceToMain,
mergeSliceToMilestone, shouldUseWorktreeIsolation, getMergeToMainMode,
withMergeHeal, recoverCheckout, fix-merge dispatch/labels, and associated
tests. Adds legacy_slice_branches doctor check, deprecation warnings for
git.isolation and git.merge_to_main preferences.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:21:58 -06:00
Flux Labs
6188c040fa fix: normalize path separators in debug-logger test for Windows CI 2026-03-15 13:06:38 -05:00
Flux Labs
314c134962 Merge branch 'main' into fix/gsd-extension-ctx-log 2026-03-15 12:51:42 -05:00
Flux Labs
afd4a514e0 feat: add gsd --debug mode with structured JSONL diagnostic logging (#468)
Add `gsd auto --debug` and `gsd next --debug` flags (also GSD_DEBUG=1
env var) that write structured JSONL debug logs to `.gsd/debug/`.

Instrumentation points:
- deriveState() timing and result phase
- parseRoadmap/parsePlan timing with native flag
- TTSR checkDelta timing, buffer size, and peak tracking
- Unit dispatch cycle/lifetime counts
- Context injection sizing
- Debug summary with aggregated stats on stop

The logger is zero-overhead when disabled — all functions check a
boolean and return immediately. Auto-prunes to 5 most recent logs.
2026-03-15 12:51:24 -05:00
Flux Labs
5cc99ac77e Merge branch 'main' into worktree-investigate-468 2026-03-15 12:50:33 -05:00
Flux Labs
fa4dae7e08 fix: prevent CPU spinning from regex backtracking and TTSR throttling (#468)
Replace [\s\S]*? regex patterns with indexOf-based string parsing in
boundary map, preferences, and skill-discovery frontmatter parsers to
eliminate catastrophic backtracking on content containing code fences.

Add 50ms throttle to TTSR JS-fallback regex path to prevent CPU spinning
when token deltas arrive faster than regex evaluation on growing buffers.

Closes #468
2026-03-15 12:41:28 -05:00
TÂCHES
14875effae Merge branch 'main' into feat-google-oauth-search 2026-03-15 11:27:44 -06:00
TÂCHES
b503c55722 Merge branch 'main' into fix/openrouter-preferences 2026-03-15 11:27:26 -06:00
TÂCHES
2d4a14b7ca Merge pull request #491 from fluxlabs/fix/hook-orchestration
fix: hook orchestration — finalize records, add supervision, fix retry
2026-03-15 11:27:12 -06:00
Flux Labs
266e58effb merge: resolve conflict with main in parseScalar
Merge main's unknown return type and []/{}  literal support with
our inline comment stripping and quote handling changes.
2026-03-15 12:19:07 -05:00
Flux Labs
71f33de869 Merge branch 'main' into fix/hook-orchestration 2026-03-15 12:16:41 -05:00
Flux Labs
94336dd445 fix: hook orchestration — finalize runtime records, add supervision, fix retry
Hooks were dispatched (runtime record created with phase="dispatched") but
never properly tracked through completion. Four issues fixed:

1. Hook runtime records now finalized: handleAgentEnd writes phase="finalized"
   and clears the record when a hook completes. Previously records stayed at
   "dispatched" forever because verifyExpectedArtifact returned false for
   hook types.

2. Supervision timer for hooks: hook dispatch now sets a hard timeout so
   stuck hooks don't hang auto-mode indefinitely.

3. Hook retry removes completion key: when a hook requests retry via
   retry_on, the trigger unit's completion key is removed from the
   idempotency set so dispatchNextUnit will re-dispatch it.

4. Hook closeout in dispatchNextUnit: hook units are properly closed out
   (pushed to completedUnits, runtime cleared) without polluting the
   idempotency set. verifyExpectedArtifact returns true for hook/ types.

Fixes #140 (comment 4063396798)
2026-03-15 12:14:30 -05:00
Flux Labs
ba5e2ceded fix: harden YAML preferences parser for OpenRouter model IDs (#488)
Fix parsing issues that prevented OpenRouter model preferences from
being correctly picked up during auto-mode dispatching:

- Array items with colons (e.g. qwen/qwen3-coder:free) were incorrectly
  parsed as objects instead of strings. Now only items matching a valid
  key-value pattern (key:value where key is [A-Za-z0-9_]+) are treated
  as structured objects.

- Inline YAML comments (# after whitespace) were included in parsed
  values, causing model ID lookups to fail silently.

- Frontmatter regex now handles Windows CRLF line endings.

- GSDPreferences.models type updated from GSDModelConfig (legacy
  string-only) to GSDModelConfig | GSDModelConfigV2 to match actual
  runtime usage with extended object format.

- Explicit comment-line skipping in the parser loop for clarity.

- Added comprehensive test suite covering OpenRouter-style org/model IDs,
  colon variants, inline comments, CRLF, and mixed format configs.
2026-03-15 12:07:12 -05:00
Flux Labs
4a76d7b174 Merge branch 'main' into fix/tui-resource-leaks-and-quality 2026-03-15 11:39:52 -05:00
Lex Christopherson
e147b2dfdf fix(state): empty slice plan stays in planning, not summarizing (#454)
A plan file with zero tasks caused `find(t => !t.done)` to return
undefined, which was treated as "all tasks done" → summarizing phase.
Now requires `tasks.length > 0` before entering summarizing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 10:05:03 -06:00
TÂCHES
65acf67762 Merge pull request #461 from deseltrus/feat/multi-milestone-enforcement
feat(discuss): three-layer enforcement for multi-milestone discussions
2026-03-15 10:02:00 -06:00
TÂCHES
996dc3d7dc Merge branch 'main' into fix/gsd-extension-ctx-log 2026-03-15 09:59:08 -06:00
TÂCHES
58506cf833 Merge pull request #459 from deseltrus/fix/session-config
feat: session-internal /gsd config + fix key hydration in gsd config
2026-03-15 09:53:49 -06:00
TÂCHES
c0ab967f35 Merge pull request #457 from deseltrus/fix/skill-diagnostics-ux
fix(ux): improve preferences wizard and skill diagnostics
2026-03-15 09:53:46 -06:00
TÂCHES
2b34d79f8d Merge pull request #443 from fluxlabs/fix/discuss-needs-discussion-deadlock-440
fix: /gsd discuss routes to draft discussion when phase is needs-discussion
2026-03-15 09:53:43 -06:00
TÂCHES
f347572758 Merge branch 'main' into feat/multi-milestone-enforcement 2026-03-15 09:49:51 -06:00