Commit Graph

3016 Commits

Author SHA1 Message Date
Steve Yegge
1feb48dd11 Merge pull request #460 from sauerdaniel/pr/shutdown-reliability
fix(shutdown): Improve gastown shutdown reliability
2026-01-21 20:33:54 -08:00
Steve Yegge
58d5226f30 Merge pull request #714 from boshu2/fix/mail-inbox-parallel
perf: parallelize mail inbox queries for ~6x speedup
2026-01-21 20:33:00 -08:00
mayor
c42b5db7ab fix(hook): normalize agent ID trailing slash in agentIDToBeadID (gt-az3jjb)
resolveSelfTarget returns "mayor/" with trailing slash per addressToIdentity
normalization, but agentIDToBeadID only checked for "mayor" without slash.

This caused `gt hook --clear` to fail with:
  Error: could not convert agent ID mayor/ to bead ID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:51:19 -08:00
Roland Tritsch
2119841d57 fix(doctor): check patrol formulas instead of placeholder beads (#715)
Changes patrol-molecules-exist check to verify that patrol formulas
are accessible via `bd formula list` instead of looking for placeholder
molecule beads created by `bd create --type=molecule`.

## Problem

The check was looking for molecule-type beads with titles "Deacon Patrol",
"Witness Patrol", and "Refinery Patrol". These placeholder beads serve no
functional purpose because:

1. Patrols actually use `bd mol wisp mol-deacon-patrol` which cooks
   formulas inline (on-the-fly)
2. The formulas already exist at the town level in .beads/formulas/
3. The placeholder beads are never referenced by any patrol code

## Solution

- Check for formula names (mol-deacon-patrol, mol-witness-patrol,
  mol-refinery-patrol) instead of bead titles
- Use `bd formula list` instead of `bd list --type=molecule`
- Remove Fix() method that created unnecessary placeholder beads
- Update messages to reflect that formulas should exist in search paths

## Impact

- Check now verifies what patrols actually need (formulas)
- Eliminates creation of unnecessary placeholder beads
- More accurate health check for patrol system

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-21 19:50:41 -08:00
Roland Tritsch
2514507a49 Fix GT_ROOT export for beads formula search compatibility (#718)
Problem:
- Gas Town sets GT_TOWN_ROOT environment variable
- Beads searches for formulas using GT_ROOT environment variable
- This naming inconsistency prevents beads from finding town-level formulas
- Result: `bd mol seed --patrol` fails in rigs, causing false doctor warnings

Solution:
Export both GT_TOWN_ROOT and GT_ROOT from `gt rig detect` command:
- Modified stdout output to export both variables (lines 66, 70)
- Updated cache storage format (lines 134, 136, 138)
- Updated unset statement for both variables (line 110)
- Updated command documentation (lines 33, 37)

Both variables point to the same town root path. This maintains backward
compatibility with Gas Town (GT_TOWN_ROOT) while enabling beads formula
search (GT_ROOT).

Testing:
- `gt rig detect .` now outputs both GT_TOWN_ROOT and GT_ROOT
- `bd mol seed --patrol` works correctly when GT_ROOT is set
- Formula search paths work as expected: town/.beads/formulas/ accessible

Related:
- Complements bd mol seed --patrol implementation (beads PR #1149)
- Complements patrol formula doctor check fix (gastown PR #715)

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-21 19:50:38 -08:00
Roland Tritsch
e4ebd0784a Fix settings templates to use 'gt prime --hook' for session ID tracking (#719)
Both settings-autonomous.json and settings-interactive.json templates
were using bare 'gt prime' in SessionStart and PreCompact hooks, which
caused gt doctor to report warnings about missing --hook flag.

The --hook flag is required for proper session ID passthrough from
Claude Code. When called as a hook, 'gt prime --hook' reads session
metadata (session_id, transcript_path, source) from stdin JSON that
Claude Code provides.

Without --hook, session tracking breaks and gt doctor correctly warns:
"SessionStart uses bare 'gt prime' - add --hook flag or use session-start.sh"

This fix updates both template files to use 'gt prime --hook' in:
- SessionStart hooks (lines 12)
- PreCompact hooks (lines 23)

New installations will now generate settings.json files with the
correct format that passes gt doctor validation.

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-21 19:50:35 -08:00
Julian Knutsen
1e97d1e637 Fix go-19z: updateAgentHookBead uses wrong directory for rig-level beads (#733)
When slinging work to an agent, updateAgentHookBead() was running
bd slot set from townRoot. But agent beads with rig-level prefixes
(e.g., go-) live in rig databases, not the town database. This caused
"issue not found" errors when trying to update the hook_bead slot.

Fix: Use beads.ResolveHookDir() to resolve the correct working directory
based on the agent bead's prefix before calling SetHookBead().

Co-authored-by: furiosa <spencer@atmosphere-aviation.com>
2026-01-21 19:32:13 -08:00
Louis Vranderick
7e5c3dd695 Add comprehensive tests for internal/dog package (#737) 2026-01-21 19:31:57 -08:00
aleiby
0cdcd0a20b fix(daemon): spawn Deacon immediately after killing stuck session (#729)
When checkDeaconHeartbeat detects a stuck Deacon and kills it, the code
relied on ensureDeaconRunning being called on the next heartbeat. However,
on the next heartbeat, checkDeaconHeartbeat exits early when it finds no
session (assuming ensureDeaconRunning already ran), creating a deadlock
where the Deacon is never restarted.

This fix calls ensureDeaconRunning immediately after the kill attempt,
regardless of success or failure, ensuring the Deacon is restarted
promptly.

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

Executed-By: mayor
Role: mayor
2026-01-21 19:31:38 -08:00
Joshua Vial
aba0a5069c fix(seance): add tests and fix race condition in session index (#864)
Co-authored-by: joshuavial <git@codewithjv.com>
2026-01-21 19:30:49 -08:00
aleiby
a8bedd2172 fix(costs): add event to BeadsCustomTypes constant (#731)
* fix(costs): add event to BeadsCustomTypes constant

The gt costs record command creates beads with --type=event, but "event"
was missing from the BeadsCustomTypes constant. This caused stop hooks
to fail with "invalid issue type: event" errors.

Also fixes gt doctor --fix to properly register the event type when
running on existing installations.

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

* fix(types): add message, molecule, gate, merge-request to BeadsCustomTypes

Extends PR #731 to include all custom types used by Gas Town:

- message: Mail system (gt mail send, mailbox, router)
- molecule: Work decomposition (patrol checks, gt swarm)
- gate: Async coordination (bd gate wait, park/resume)
- merge-request: Refinery MR processing (gt done, refinery)

Root cause: gt mail send was failing with "invalid issue type: message"
because message was never added to BeadsCustomTypes.

Also documents the origin/usage of each custom type in the constant.

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

Executed-By: mayor
Role: mayor

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:11:43 -08:00
aleiby
b9f5797b9e fix(refinery): use role-specific runtime config for startup (#756) (#847)
Use ResolveRoleAgentConfig instead of LoadRuntimeConfig to properly
resolve role-specific agent settings (like ready_prompt_prefix) when
starting the refinery. This fixes timeout issues when role_agents.refinery
is configured with a non-default agent.

Also move AcceptBypassPermissionsWarning before WaitForRuntimeReady to
avoid a race condition where the bypass dialog can block prompt detection.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:11:39 -08:00
aleiby
5791cd7e34 feat(doctor): add auto-fix capability to SessionHookCheck (#857)
Add Fix() method to SessionHookCheck to automatically update
settings.json files when 'gt prime' is used without '--hook'.
This enables 'gt doctor --fix' to repair existing installations
that use bare 'gt prime' in SessionStart/PreCompact hooks.

Changes:
- Changed SessionHookCheck to embed FixableCheck instead of BaseCheck
- Added filesToFix cache populated during Run()
- Implemented Fix() method that parses JSON and replaces 'gt prime'
  with 'gt prime --hook' in command strings
- Uses json.Encoder with SetEscapeHTML(false) to preserve readable
  ampersands in command strings

Closes: gt-1tj0c

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:11:34 -08:00
The App Agency
3931d10af3 fix(dashboard): use registered rigs for merge queue instead of hardcoded repos (#863)
The FetchMergeQueue function was hardcoded to query PRs from
michaellady/roxas and michaellady/gastown, causing the dashboard
to show unrelated PRs regardless of which rigs are actually registered.

This fix:
- Adds townRoot to LiveConvoyFetcher to access workspace config
- Loads registered rigs from mayor/rigs.json dynamically
- Adds gitURLToRepoPath helper to convert git URLs (HTTPS/SSH) to
  owner/repo format for the gh CLI
- Updates comments to reflect the new behavior

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:11:29 -08:00
Advaya Krishna
d67aa0212c feat(refinery): use squash merge to eliminate redundant merge commits (#856)
Replace MergeNoFF with MergeSquash in the Refinery to preserve the original
conventional commit message (feat:/fix:) from polecat branches instead of
creating "Merge polecat/... into main" commits.

Changes:
- Add MergeSquash function to internal/git/git.go
- Add GetBranchCommitMessage helper to retrieve branch commit messages
- Update engineer.go doMerge to use squash merge with original message

Fixes #855

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:12:40 -08:00
Erik LaBianca
b333bf8146 fix(install): Makefile uses go install to match docs (#851)
* fix(install): use go install to match docs

Makefile install target now uses 'go install' instead of cp to
~/.local/bin, aligning with documented installation method and
GOPATH/GOBIN conventions.

Closes: hq-93c
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(beads): set BEADS_DIR for config

* test(config,rig): update startup and bd stubs

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:12:38 -08:00
aleiby
7016b33b39 fix(hooks): allow feature branches in contributor workflow (#850)
The pre-push hook now detects when an `upstream` remote is configured
and allows feature branches for the fork contribution workflow.

Previously, the hook blocked all non-main branches, which prevented
pushing PR branches to forks. Now the blocking logic checks for an
upstream remote - if present, it skips the block and allows the push.

The check wraps the blocking logic (rather than early-out) so that
any future additions to the hook will still apply to contributor
workflows.

Fixes #848

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:12:34 -08:00
aleiby
1a0f2d6b3b fix(formula): clarify WITNESS_PING routing in witness patrol (#854)
Add explicit routing rules to ping-deacon step:
- WITNESS_PING always goes to deacon/, never to mayor/
- Mayor only receives ALERT messages (Step 3)
- Define what 'healthy' looks like (idle at prompt is normal)

This prevents the witness LLM from misinterpreting the formula
and sending raw WITNESS_PING messages to mayor instead of deacon.

Fixes: gt-uvz90
2026-01-21 18:12:20 -08:00
morsov
39b1c11bb6 fix(handoff): use env var fallback when town root detection fails
When the repo is in a broken state (wrong branch, detached HEAD, deleted
worktree), gt handoff would fail with "cannot detect town root" error.
This is exactly when handoff is most needed - to recover and hand off
to a fresh session.

Changes:
- detectTownRootFromCwd() now falls back to GT_TOWN_ROOT and GT_ROOT
  environment variables when cwd-based detection fails
- buildRestartCommand() now propagates GT_ROOT to ensure subsequent
  handoffs can also use the fallback
- Added tests for the fallback behavior

Fixes gt-x2q81.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:05:00 -08:00
dag
f6fab3afad feat(cmd): add --comment as alias for --reason in gt close
Add support for --comment flag as an alias for --reason in the
gt close command. This provides a more intuitive option name for
users who think of close messages as comments rather than reasons.

Handles both --comment value and --comment=value forms.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:04:58 -08:00
rictus
40cc4c9335 fix(identity): copy all agent fields during polecat identity rename
The rename operation was only copying AgentState and CleanupStatus,
missing HookBead (the primary fix), ActiveMR, and NotificationLevel.
This ensures all agent state is preserved when renaming an identity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:04:55 -08:00
mayor
82079f9715 fix(sling): handle agent bead not found gracefully
Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 18:04:15 -08:00
mayor
53fd6bad33 fix(sling): don't show closed convoy tracking
Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 18:04:11 -08:00
mayor
6e2169de7f feat(orphans): add gt orphans kill command
Adds command to find and terminate orphan claude processes with PPID=1.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 18:04:00 -08:00
beads/crew/lizzy
d0e49a216a feat(hooks): add hook registry and install command (bd-qj9nc)
- Add hooks_registry.go: LoadRegistry(), HookRegistry/HookDefinition types
- Add hooks_install.go: gt hooks install command with --role and --all-rigs flags
- gt hooks list now reads from ~/gt/hooks/registry.toml
- Supports dry-run, deduplication, and creates .claude dirs as needed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:40:05 -08:00
beads/crew/collins
6616a4726c feat(mail): support positional message arg in reply command
Allow `gt mail reply <id> "message"` in addition to `-m` flag.
This is a desire-path fix - agents naturally try positional syntax.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:28:47 -08:00
Steve Yegge
f00b0254f2 feat(config): add OpenCode as built-in agent preset (#861)
Add AgentOpenCode as a first-class built-in agent preset, similar to
Claude, Gemini, Codex, Cursor, Auggie, and AMP.

OpenCode preset configuration:
- Command: "opencode"
- Args: [] (uses Env for YOLO mode, no CLI flags needed)
- Env: OPENCODE_PERMISSION='{"*":"allow"}' for auto-approve
- ProcessNames: ["opencode", "node"] (runs as Node.js)
- SupportsHooks: true (uses .opencode/plugin/gastown.js)
- NonInteractive: run subcommand with --format json

Runtime defaults for opencode provider:
- ready_delay_ms: 8000 (delay-based detection for TUI)
- process_names: [opencode, node]
- instructions_file: AGENTS.md

This allows users to simply configure:
  role_agents:
    refinery: "opencode"

Instead of manually configuring agents.json and runtime settings.

Test coverage:
- TestOpenCodeAgentPreset: comprehensive preset validation
- TestOpenCodeProviderDefaults: runtime config defaults
- TestOpenCodeRuntimeConfigFromPreset: Env copying
- TestIsKnownPreset: includes opencode
- TestGetAgentPresetByName: opencode returns preset

Templates added:
- templates/agents/opencode.json.tmpl: agent config template
- templates/agents/opencode-models.json: model delay presets

Co-authored-by: Avyukth <subhrajit.makur@hotmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:20:57 -08:00
Steve Yegge
e12aa45dd6 feat(config): add Env field to RuntimeConfig and AgentPresetInfo (#860)
Add support for agent presets to specify environment variables that
get exported when starting sessions. This enables agents to use
environment-based configuration.

Changes:
- Add Env field to RuntimeConfig struct in types.go
- Add Env field to AgentPresetInfo struct in agents.go
- Update RuntimeConfigFromPreset to copy Env from preset
- Update fillRuntimeDefaults to preserve Env field
- Merge agent Env vars in BuildStartupCommand functions
- Add comprehensive tests for Env preservation and copy semantics

This is a prerequisite for the OpenCode agent preset which uses
OPENCODE_PERMISSION='{"*":"allow"}' for auto-approve mode.

Co-authored-by: Avyukth <subhrajit.makur@hotmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:20:09 -08:00
gastown/crew/jack
9f06eb94c4 feat(seance): support cross-account session access
Add ability to access sessions from other accounts when using gt seance --talk.
After gt account switch, sessions from previous accounts are now accessible
via temporary symlinks.

Changes:
- Search all account config directories in accounts.json for session
- Create temporary symlink from source account to current account project dir
- Update sessions-index.json with session entry (using json.RawMessage to preserve fields)
- Cleanup removes symlink and index entry when seance exits
- Add startup cleanup for orphaned symlinks from interrupted sessions

Based on PR #797 by joshuavial, with added orphan cleanup to handle ungraceful exits.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:54:36 -08:00
Subhrajit Makur
7a2090bb15 feat(config): add ShellQuote helper for safe env var escaping (#830)
Add ShellQuote function to properly escape environment variable values
containing shell special characters ({, }, *, $, ", etc.).

Changes:
- Add ShellQuote() that wraps values in single quotes when needed
- Escape embedded single quotes using '\'' idiom
- Update ExportPrefix to use ShellQuote
- Update BuildStartupCommand and PrependEnv in loader.go
- Add comprehensive tests for shell quoting edge cases

Backwards compatible: paths, hyphens, dots, and slashes are NOT quoted,
preserving existing agent behavior (GT_ROOT, BD_ACTOR, etc.).

This is a prerequisite for the OpenCode agent preset which uses
OPENCODE_PERMISSION='{"*":"allow"}' for auto-approve mode.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:49:39 -08:00
Boden Fuller
a5bbe24444 perf: parallelize mail inbox queries for ~6x speedup
The listFromDir function was making 3-6 serial bd subprocess calls
(one per identity variant × status). This caused gt mail inbox to take
~32 seconds in typical setups.

Change to run all queries in parallel using goroutines, reducing
inbox load time to ~5 seconds.

Implementation notes:
- Pre-allocate results slice indexed by query position (no mutex needed)
- Deduplication happens after wg.Wait() in single-threaded collection
- Existing error handling preserved (partial success allowed)

Fixes #705
2026-01-21 14:15:23 -05:00
gastown/crew/george
87f9a7cfd1 Merge branch 'fix/fresh-install-fixes-v2' 2026-01-21 10:52:05 -08:00
gastown/crew/george
78001d2c01 fix: update patrol_check tests and add cross-filesystem clone support
- Update patrol_check tests to expect StatusOK instead of StatusWarning
  for missing templates (embedded templates fill the gap)
- Add moveDir helper with cross-filesystem fallback for git clones
- Remove accidentally committed events.jsonl file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:51:42 -08:00
gastown/crew/dennis
d96b53e173 Merge branch 'fix/multi-repo-routing-pr811-v2' 2026-01-21 10:44:46 -08:00
gastown/crew/dennis
fa1f812ce9 fix(beads): multi-repo routing for custom types and role slots
Fixes two bugs in multi-repo routing scenarios:

1. "invalid issue type: agent" error when creating agent beads
   - Added EnsureCustomTypes() with two-level caching (in-memory + sentinel file)
   - CreateAgentBead() now resolves routing target and ensures custom types

2. "could not set role slot: issue not found" warning when setting slots
   - Added runSlotSet() and runSlotClear() helpers that run bd from correct directory
   - Slot operations now use the resolved target directory

New files:
- internal/beads/beads_types.go - routing resolution and custom types logic
- internal/beads/beads_types_test.go - unit tests

Based on PR #811 by Perttulands, rebased onto current main.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:44:37 -08:00
mayor
dfd4199396 chore: gitignore runtime directories
Add logs/, settings/, and .events.jsonl to gitignore.
These are runtime files created during gt operation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:43:26 -08:00
mayor
77126283dd fix(done): allow completion when work pushed directly to main
Previously, `gt done` would fail with "0 commits ahead; nothing to merge"
if work was pushed directly to main instead of via PR. This blocked
polecats from completing even when their work was done, causing them to
become zombies.

Now, if the branch has no commits ahead of main, `gt done` skips MR
creation but still completes successfully - notifying the witness,
cleaning up the worktree, and terminating the session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:42:07 -08:00
Subhrajit Makur
afc1ff04b1 feat(formula): add verification legs and presets to code-review (#841)
Add three new verification legs to the code-review convoy formula:
- wiring: detects dependencies added but not actually used
- commit-discipline: reviews commit quality and atomicity
- test-quality: verifies tests are meaningful, not just present

Also adds presets for common review modes:
- gate: light review (wiring, security, smells, test-quality)
- full: all 10 legs for comprehensive review
- security-focused: security-heavy for sensitive changes
- refactor: code quality focus

This is a minimal subset of PR #4's Worker → Reviewer pattern,
focusing on the most valuable additions without Go code changes.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:38:45 -08:00
Jordan Nuñez
987502ebb3 fix(formula): sync source formula with embedded changes (#845)
Two commits modified internal/formula/formulas/ without updating the
source at .beads/formulas/:
- d6a4bc22: added patrol-digest step
- bd655f58: disabled costs-digest step

This caused go generate to overwrite the embedded file with stale
source content on every build.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:31:52 -08:00
lethalspam
3588dbc5e4 fix: use exec env for startup command to fix WaitForCommand detection (#844)
When starting agents with environment variables, the previous approach
used 'export VAR=val && claude' which keeps bash as the pane command
with the agent as a child process. WaitForCommand polls pane_current_command
which returns 'bash', causing a 60-second timeout.

Changed to 'exec env VAR=val claude' which replaces the shell with the
agent process, making it detectable via pane_current_command.

Fixes startup timeout on macOS: 'still running excluded command'
2026-01-21 10:31:34 -08:00
dustin
4fbe00e224 fix: respect GT_TOWN_ROOT in quick-add command (#840)
The quick-add command (used by shell hook's "Add to Gas Town?" prompt)
previously only checked hardcoded paths ~/gt and ~/gastown, ignoring
GT_TOWN_ROOT and any other Gas Town installations.

This caused rigs to be added to the wrong town when users had multiple
Gas Town installations (e.g., ~/gt and ~/Documents/code/gt).

Fix the town discovery order:
1. GT_TOWN_ROOT env var (explicit user preference)
2. workspace.FindFromCwd() (supports multiple installations)
3. Fall back to ~/gt and ~/gastown
2026-01-21 10:31:16 -08:00
Advaya Krishna
3afd1a1dcd fix(polecat): exclude reserved infrastructure agent names from allocator (#837)
The polecat name allocator was assigning reserved infrastructure agent
names like 'witness' to polecats. Added ReservedInfraAgentNames map
containing witness, mayor, deacon, and refinery. Modified getNames()
to filter these from all themes and custom name lists.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:30:53 -08:00
furiosa
535647cefc chore: ignore Gas Town working directories
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:30:45 -08:00
furiosa
3c44e2202d fix(witness): run convoy check regardless of cleanup status
Move convoy check to run after verifyCommitOnMain succeeds, before the
cleanup_status switch. This ensures convoys can close when tracked work
is merged, even if polecat cleanup is blocked (has_uncommitted, etc.).

Previously the convoy check only ran after successful nuke, meaning
blocked polecats would prevent convoy completion detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:16:27 -08:00
Dustin Smith
b2b9cbc836 Merge upstream/main into fix/fresh-install-fixes 2026-01-21 22:48:06 +07:00
Dustin Smith
035b7775ea fix: handle error return from os.RemoveAll in defer 2026-01-21 22:45:14 +07:00
Serhii
a8be623eeb fix(cmd): extract orphan cleanup to platform-specific files (#835)
PR #759 introduced cleanupOrphanedClaude() using syscall.Kill directly,
which breaks Windows builds. This extracts the function to:
- start_orphan_unix.go: Full implementation with SIGTERM/SIGKILL
- start_orphan_windows.go: Stub (orphan signals not supported)

Follows existing pattern: process_unix.go / process_windows.go
2026-01-20 22:34:37 -08:00
Kartik Shrivastava
63a30ce548 fix(tmux): resolve claude path for alias installations (#703) (#748)
Fix "Unable to attach mayor" timeout caused by claude being installed
as a shell alias rather than in PATH. Non-interactive shells spawned
by tmux cannot resolve aliases, causing the session to exit immediately.

Changes:
- Add resolveClaudePath() to find claude at ~/.claude/local/claude
- Apply path resolution in RuntimeConfigFromPreset() for claude preset
- Make hasClaudeChild() recursive (now hasClaudeDescendant()) to search
  entire process subtree as defensive improvement
- Update fillRuntimeDefaults() to use DefaultRuntimeConfig() for
  consistent path resolution

Fixes https://github.com/steveyegge/gastown/issues/703

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 22:32:07 -08:00
Roland Tritsch
1b036aadf5 Fix deacon patrol process leak by killing pane processes before respawn (#745)
## Problem
The deacon patrol was leaking claude processes. Every patrol cycle (1-3 minutes),
a new claude process was spawned under the hq-deacon tmux session, but old processes
were never terminated. This resulted in 12+ accumulated claude processes consuming
resources.

## Root Cause
In molecule_step.go:331, handleStepContinue() used tmux respawn-pane -k to restart
the pane between patrol steps. The -k flag sends SIGHUP to the shell but does not
kill all descendant processes (claude and its node children).

## Solution
Added KillPaneProcesses() function in tmux.go that explicitly kills all descendant
processes before respawning the pane. This function:
- Gets all descendant PIDs recursively
- Sends SIGTERM to all (deepest first)
- Waits 100ms for graceful shutdown
- Sends SIGKILL to survivors

Updated handleStepContinue() to call KillPaneProcesses() before RespawnPane().

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-20 22:30:23 -08:00
Roland Tritsch
9de8859be0 Fix orphan detection to recognize hq-* sessions (#744)
The daemon creates hq-deacon and hq-mayor sessions (headquarters sessions)
that were incorrectly flagged as orphaned by gt doctor.

Changes:
- Update orphan session check to recognize hq-* prefix in addition to gt-*
- Update orphan process check to detect 'tmux: server' process name on Linux
- Add test coverage for hq-* session validation
- Update documentation comments to reflect hq-* patterns

This fixes the false positive warnings where hq-deacon session and its
child processes were incorrectly reported as orphaned.

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-20 22:27:41 -08:00