Commit graph

2141 commits

Author SHA1 Message Date
mastertyko
43b1de6d59 fix: signal malformed tool arguments in toolcall_end event (#2647)
When the API stream is truncated mid-tool-call, PartialMessageBuilder
emits a toolcall_end event with { _raw: "<broken json>" } in the
arguments — but the event looks identical to a healthy tool completion.
Downstream consumers (error classifiers, tool handlers, activity log)
have no way to distinguish a truncated call from a completed one.

Add a malformedArguments: boolean flag to the toolcall_end event variant
in AssistantMessageEvent. The flag is set to true only in the JSON parse
catch path, so existing consumers (which do not check for it) are
unaffected. New consumers like classifyProviderError can use it to
handle truncated tool calls appropriately.

Closes #2574
2026-03-26 08:15:16 -06:00
mastertyko
badcaa3152 fix: prevent double mergeAndExit on milestone completion (#2648)
When a milestone completes, phases.ts calls mergeAndExit to merge the
worktree branch back to main. It then calls closeoutAndStop → stopAuto,
which unconditionally calls mergeAndExit again. The second call fails
because the branch was already deleted by the first merge, producing a
misleading 'not something we can merge' warning even though the merge
succeeded.

Add a milestoneMergedInPhases session flag that phases.ts sets after a
successful merge. stopAuto checks this flag and skips its own merge
when it is already set. The flag is cleared in AutoSession.reset() so
it does not leak across sessions.

Closes #2645
2026-03-26 08:14:54 -06:00
mastertyko
b03694fb4f fix: respect queue-order.json in DB-backed state derivation (#2649)
getActiveMilestoneId and deriveStateFromDb sorted milestones by ID
(localeCompare / milestoneIdSort) while the dispatch guard in
dispatch-guard.ts sorted by queue-order.json via findMilestoneIds.
When a user reordered milestones via /gsd queue to prioritize a
later-numbered milestone, the state machine ignored the reordering
and dispatched to the earlier-numbered one. The dispatch guard then
blocked completion because the queue-ordered-first milestone was
incomplete — producing a deadlock.

Replace the lexicographic sort with sortByQueueOrder(loadQueueOrder())
in both the getActiveMilestoneId DB path and the deriveStateFromDb
milestone sort. This aligns all three subsystems (state derivation,
dispatch, and dispatch guard) on the same ordering.

Closes #2556
2026-03-26 08:14:23 -06:00
Jeremy McSpadden
af7da35384 fix(vscode): support Remote SSH by adding extensionKind and error handler (#2650)
* fix(vscode): add extensionKind and error handler for Remote SSH support

* fix(vscode): reject failed RPC startup
2026-03-26 08:14:08 -06:00
mastertyko
f0e727d369 fix: update DB task status in writeBlockerPlaceholder for execute-task (#2657)
writeBlockerPlaceholder writes a placeholder SUMMARY file when idle
recovery exhausts all retries, but never updated the DB task status.
verifyExpectedArtifact checks the DB as the authoritative source for
execute-task units — with status still "pending", verification failed,
deriveState re-derived the same task, and the dispatch loop repeated
indefinitely (observed as 8-9 "Advancing pipeline" messages).

After writing the file, call updateTaskStatus to mark the task as
"complete" in the DB. This lets verifyExpectedArtifact pass and
breaks the infinite re-dispatch loop.

Closes #2531
2026-03-26 08:13:36 -06:00
TÂCHES
c2aaf6ace8 refactor: extract runSafely helper for try-catch-debug-continue pattern (#2611)
* refactor: extract runSafely helper for try-catch-debug-continue pattern

Reduces boilerplate in auto-post-unit.ts by extracting the repeated
try { op() } catch (e) { debugLog(ctx, { phase, error }) } pattern
into a reusable runSafely() helper in auto-utils.ts. Replaces 6
sequential blocks (github-sync, prune-bg-shell, browser-teardown,
worktree-sync, rewrite-docs-resolve, reactive-state-cleanup).

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

* ci: trigger rebuild after null-safety fix

* chore: trigger CI rebuild

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 08:11:01 -06:00
TÂCHES
dc378242bd Merge pull request #2624 from gsd-build/feat/ecosystem-skills-directory-merge
feat(skills): use ~/.agents/skills/ as primary skills directory with curated catalog
2026-03-26 00:01:11 -06:00
Lex Christopherson
959a0e1a19 fix: normalize path separators in matchesProjectFileMarker for Windows
On Windows, scanProjectFiles returns backslash paths (e.g.
"apps\mobile\app\build.gradle") but PROJECT_FILES markers use forward
slashes ("app/build.gradle"). Normalize scanned paths to forward
slashes before matching.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:55:09 -06:00
Lex Christopherson
dc74072765 fix(tests): remove obsolete doctor filesystem test
The doctor-task-done-missing-summary-slice-loop test was written for
the old filesystem-based task_done_missing_summary check, which was
refactored to db_done_task_no_summary (SQLite-based). The test creates
filesystem structures but the current check queries the database,
making it fundamentally incompatible.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:46:51 -06:00
github-actions[bot]
50c7bd3af5 release: v2.50.0 2026-03-26 05:40:44 +00:00
TÂCHES
bef46e9b5b Merge pull request #2617 from ahwlsqja/fix/filesystem-task-reconcile-2514
fix: reconcile stale task status in filesystem-based state derivation
2026-03-25 23:26:01 -06:00
ahwlsqja
43de82912e fix: reconcile stale task status in filesystem-based state derivation (#2514)
`_deriveStateImpl` (used when no gsd.db exists) lacked the SUMMARY-based
reconciliation added to `deriveStateFromDb` in 0e7a01f4. Heading-style
tasks (`### T01:`) are always parsed as `done=false` by `parsePlan`
because the heading syntax has no checkbox. When the agent writes a
SUMMARY file but the plan heading has no checkbox, the task appears
incomplete forever, causing infinite re-dispatch.

Now checks each non-done task for a SUMMARY file on disk after
`parsePlan()`, mirroring the DB reconciliation logic.

Root cause: `parsePlan()` recognizes two task formats:
1. `- [x] **T01: Title**` → done from checkbox state
2. `### T01: Title` → always done=false (no checkbox to read)

The DB path (deriveStateFromDb) was already fixed in 0e7a01f4 to
reconcile via SUMMARY files. This commit applies the same fix to
the filesystem path used by projects without gsd.db.
2026-03-26 14:14:34 +09:00
TÂCHES
491820ce9b Merge pull request #2614 from gsd-build/refine/adopt-parseUnitId-everywhere
refactor: adopt parseUnitId utility across all auto-* modules
2026-03-25 23:13:12 -06:00
TÂCHES
07375e4948 Merge pull request #2609 from gsd-build/refine/extract-planning-state-checks
refactor: extract planning-state validation helpers in detectRogueFileWrites
2026-03-25 23:13:02 -06:00
TÂCHES
cc6eee4d56 Merge pull request #2613 from gsd-build/refine/flatten-sync-milestone-dir
refactor: flatten syncMilestoneDir nesting with shared helper
2026-03-25 23:12:48 -06:00
TÂCHES
d3c9319869 Merge pull request #2607 from gsd-build/refine/consolidate-verdict-parsing
refine: consolidate verdict parsing and schema validation
2026-03-25 23:12:33 -06:00
TÂCHES
4d4350b91d Merge pull request #2612 from igouss/feat/structured-error-propagation
feat(gsd): wire structured error propagation through UnitResult
2026-03-25 23:10:43 -06:00
Lex Christopherson
f7eac09d51 fix: merge duplicate extractUatType imports in auto-dispatch
Consolidate two separate imports from files.js into one to resolve
TS2300 duplicate identifier error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:08:41 -06:00
Lex Christopherson
cc47fb58b3 fix: use Record<string, any> for hasNonEmptyFields to accept typed DB rows
MilestoneRow and SliceRow interfaces don't have index signatures,
so they can't be assigned to Record<string, unknown>. Using
Record<string, any> allows the helper to accept any typed row object.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:08:05 -06:00
Lex Christopherson
15030ce97d refactor: adopt parseUnitId utility across all auto-* modules
Replace manual unitId.split("/") calls with the canonical parseUnitId()
utility from unit-id.ts. This eliminates ad-hoc array indexing patterns
(parts[0]!, parts[1], parts[2]) in favor of named destructuring
({ milestone, slice, task }), improving readability and consistency.

Files modified:
- auto-post-unit.ts (5 occurrences)
- auto-artifact-paths.ts (2 occurrences)
- auto-dashboard.ts (1 occurrence)
- auto-verification.ts (1 occurrence)
- auto-start.ts (1 occurrence)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:07:55 -06:00
Lex Christopherson
5d14ac446b refactor: flatten syncMilestoneDir nesting with shared helper
Extract syncDirFiles() helper to eliminate duplicated iterate/filter/copy/catch
logic across three directory levels (milestone root, slices, tasks). Reduces
maximum nesting depth from 4 to 2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:07:31 -06:00
TÂCHES
91e7bb7d92 Merge branch 'main' into refine/consolidate-verdict-parsing 2026-03-25 23:02:14 -06:00
Iouri Goussev
dc723b2519 feat(gsd): wire structured error propagation through UnitResult
Add ErrorContext interface to UnitResult so error information (provider
errors, timeouts, idle watchdog kills) is no longer discarded at the
resolve boundary. The four call sites that previously threw away context
now attach typed error metadata with category, message, and transience.

Downstream consumers (stuck detection in phases.ts, journal unit-end
events) use the structured errorContext field directly instead of
fragile regex heuristics on message content.
2026-03-26 01:01:15 -04:00
Lex Christopherson
bf8ebc0346 fix(tests): update doctor issue code to db_done_task_no_summary
The test referenced task_done_missing_summary which was renamed to
db_done_task_no_summary in the DoctorIssueCode type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:01:07 -06:00
TÂCHES
53a3388d89 Merge pull request #2610 from gsd-build/refine/dedup-merge-cleanup
refactor: extract merge-state cleanup helper in reconcileMergeState
2026-03-25 23:00:46 -06:00
TÂCHES
363910b184 Merge pull request #2608 from gsd-build/refine/split-doctor-checks
refactor: split doctor-checks into focused modules
2026-03-25 22:58:08 -06:00
TÂCHES
704ec8f29c Merge pull request #2585 from 0xLeathery/feat/quality-gates-v2
feat: embed 8-question quality gates with parallel evaluation across GSD lifecycle
2026-03-25 22:57:42 -06:00
TÂCHES
0929fd3c36 Merge pull request #2606 from gsd-build/refine/merge-worktree-sync-into-auto-worktree
refactor: merge auto-worktree-sync into auto-worktree
2026-03-25 22:57:30 -06:00
Lex Christopherson
0aa7490bc6 refactor: extract merge-state cleanup helper in reconcileMergeState
The same ~20-line cleanup sequence (merge abort / squash msg unlink /
hard reset) appeared twice in reconcileMergeState(). Extract into a
private abortAndResetMerge() helper to eliminate the duplication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:55:44 -06:00
Lex Christopherson
96c86c5a78 refactor: extract planning-state validation helpers in detectRogueFileWrites
Deduplicate near-identical "has any non-empty field" checks for milestone
and slice planning state into a shared hasNonEmptyFields() helper with
field-name arrays, reducing 8 repeated String(row.field||"").trim() calls
to 2 declarative one-liners.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:52:26 -06:00
Ethan Hurst
f70a912d59 feat: add parallel quality gate evaluation with evaluating-gates phase
Introduce infrastructure to spawn parallel sub-agents for independent
quality gate questions (Q3: Threat Surface, Q4: Requirement Impact)
during slice planning, reducing wall-clock time per milestone.

- quality_gates DB table (schema v12) with CRUD functions
- evaluating-gates phase in state machine between planning and executing
- gate-evaluate dispatch rule (opt-in via gate_evaluation preference)
- gsd_save_gate_result tool for sub-agents to persist findings
- Gate seeding inside plan-slice transaction (atomic with plan + tasks)
- Markdown renderer injects gate findings into plan.md and task-plan.md
- Recovery, rogue detection, dashboard, and scope-badge wired for new phase
- 15 new tests (9 storage + 6 dispatch/state)

  plan-slice tool
    └─ transaction: upsertSlicePlanning + insertTask(s) + insertGateRow(s)
    └─ renderPlanFromDb

  deriveState() → phase: "evaluating-gates"  (pending slice gates)

  auto-dispatch: "evaluating-gates → gate-evaluate"
    ├─ if !prefs.gate_evaluation.enabled → markAllGatesOmitted → skip
    └─ dispatch gate-evaluate unit
         └─ parent agent spawns sub-agents in parallel:
              ├─ Q3 agent → gsd_save_gate_result(verdict, findings)
              └─ Q4 agent → gsd_save_gate_result(verdict, findings)

  deriveState() → phase: "executing"  (no pending slice gates)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 14:51:38 +10:00
Lex Christopherson
b559651531 refactor: split doctor-checks into focused modules
Each health check function (git, runtime, global, engine) moves to its
own file with only the imports it needs. doctor-checks.ts becomes a
re-export barrel for backward compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:50:25 -06:00
Ethan Hurst
10e18e6a4b feat: add 8-question quality gates to planning and completion templates
Embed 6 new quality questions (Q3-Q8) into the GSD lifecycle so
consumer projects get adversarial, failure, load, and operational
coverage by default. All sections are opt-out ("OMIT ENTIRELY") for
simple slices.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 14:50:03 +10:00
TÂCHES
1961fd7651 Merge pull request #2602 from gsd-build/refine/decouple-session-forensics-from-worktree
refactor: decouple session-forensics from auto-worktree
2026-03-25 22:49:36 -06:00
TÂCHES
277edae27e Merge pull request #2605 from gsd-build/refine/dedupe-artifact-path-functions
refactor: deduplicate artifact path functions into single module
2026-03-25 22:49:22 -06:00
TÂCHES
03d47fd51a Merge pull request #2604 from gsd-build/refine/remove-dead-selfHeal
refactor: remove dead selfHealRuntimeRecords function
2026-03-25 22:48:32 -06:00
Lex Christopherson
26aa82f02e refine: consolidate verdict parsing and schema validation
Extract verdict extraction, normalization, and schema validation into a
single verdict-parser.ts module. This fixes inconsistent normalization
where `passed` was normalized to `pass` in state.ts but not in
auto-dispatch.ts or auto-prompts.ts, and centralizes scattered verdict
schema definitions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:48:10 -06:00
TÂCHES
00e948ed8e Merge pull request #2603 from gsd-build/refine/remove-unused-gate-params
refine: remove unused basePath/unitId from verification gate
2026-03-25 22:47:56 -06:00
TÂCHES
eb9d2dd8c6 Merge pull request #2601 from gsd-build/refine/remove-dead-worktree-code
chore: remove dead worktree code and unused methods
2026-03-25 22:47:23 -06:00
Lex Christopherson
8429c0e173 refactor: merge auto-worktree-sync into auto-worktree
Consolidate all worktree sync, resource staleness, stale worktree escape,
and stale runtime unit cleanup into auto-worktree.ts. Extract shared
ROOT_STATE_FILES constant and isSamePath helper to eliminate triple
duplication of the rootFiles array and copy-pasted symlink checks.

Replace inline 26-line stale-unit cleanup in auto-start.ts with a call
to cleanStaleRuntimeUnits().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:47:18 -06:00
TÂCHES
bdb21c3c23 Merge pull request #2600 from gsd-build/refine/consolidate-branch-patterns
refactor: consolidate branch name patterns into single module
2026-03-25 22:46:51 -06:00
TÂCHES
10e907a519 Merge pull request #2599 from gsd-build/refine/dedupe-session-lock-handlers
refactor: deduplicate session-lock compromise handler
2026-03-25 22:46:33 -06:00
Lex Christopherson
61cf3b556b refactor: deduplicate artifact path functions into single module
Remove duplicate resolveExpectedArtifactPath() and diagnoseExpectedArtifact()
from auto-recovery.ts, making auto-artifact-paths.ts the single source of truth.
auto-recovery.ts re-exports both functions for backward compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:43:05 -06:00
Lex Christopherson
ba6ea1c2fa refactor: remove dead selfHealRuntimeRecords function from auto-recovery
guided-flow.ts has its own local implementation; the exported version
in auto-recovery.ts was never imported anywhere. Removes 35 lines of
dead code, the unused clearUnitRuntimeRecord import, and associated
tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:42:18 -06:00
Lex Christopherson
fec7f8cc30 refactor: decouple session-forensics from auto-worktree
session-forensics.ts is a general-purpose JSONL parser that had a direct
import of getAutoWorktreePath from auto-worktree.ts, creating tight
coupling. getDeepDiagnostic now accepts an optional worktreePath parameter
instead of resolving it internally. The caller (auto.ts) resolves the
worktree path via readActiveMilestoneId + getAutoWorktreePath and passes
it in.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:41:53 -06:00
Lex Christopherson
f4c6dc67b7 refine: remove unused basePath/unitId from verification gate
Remove basePath and unitId from RunVerificationGateOptions — they were
defined in the interface and passed by callers but never read by
runVerificationGate(). This eliminates false coupling where callers
compute values that have zero effect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:41:49 -06:00
Lex Christopherson
5bf36151d6 chore: remove dead worktree code and unused methods
Delete unused resource-version.ts (functions duplicated in auto-worktree-sync.ts
with zero imports). Remove GitServiceImpl.git() private method with no call sites.
Clean up orphaned section headers and dangling JSDoc in git-service.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:40:14 -06:00
Lex Christopherson
ed23fe56ab refactor: consolidate branch name patterns into single module
SLICE_BRANCH_RE, QUICK_BRANCH_RE, and WORKFLOW_BRANCH_RE were scattered
across worktree.ts and git-service.ts. Extract all three into
branch-patterns.ts as the single source of truth. Both original modules
re-export for backward compatibility — no consumer changes needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:39:52 -06:00
Lex Christopherson
9f4bf8c452 fix: restore PR files lost during merge conflict resolution
Files added by PR #2008 that were not in main were dropped during
the merge. Restore all src/, docs/, and scripts/ files from the
pre-merge PR head.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:39:33 -06:00
Lex Christopherson
65f49af383 refactor: deduplicate session-lock compromise handler and state assignment
The lock acquisition had a primary path and a retry path with identical
28-line onCompromised callbacks and 6-line state assignment blocks (68 lines
of copy-paste). Extract into createLockCompromisedHandler() and
assignLockState() helpers so bug fixes only need to be applied once.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:38:14 -06:00