Commit Graph

1731 Commits

Author SHA1 Message Date
Steve Yegge
4e97e0eb97 Clarify Agent Mail is external service, not embedded in beads
- bd-27xm: Mark as external debugging work
- Updated status doc to emphasize separation
- Agent Mail server at ~/src/mcp_agent_mail (separate repo)
- Beads integration will be lightweight HTTP client only
2025-11-07 23:21:50 -08:00
Steve Yegge
a47b69e4f3 Close test issues 2025-11-07 23:19:32 -08:00
Steve Yegge
a02467e4bd bd-muls: Add Agent Mail integration tracking 2025-11-07 23:18:19 -08:00
Steve Yegge
6355ee1448 feat: implement agent-driven compaction (bd-buol)
- Add --analyze mode to export candidates without API key
- Add --apply mode to accept agent-provided summaries
- Move --auto mode for legacy AI-powered compaction
- Update documentation for new workflow
- Addresses GH #243 complaint about API key requirement
2025-11-07 23:11:05 -08:00
Steve Yegge
07bd7066c1 bd sync: 2025-11-07 23:10:55 2025-11-07 23:11:05 -08:00
Steve Yegge
93c90a48f5 Add dependencies for Agent Mail integration issues 2025-11-07 23:04:44 -08:00
Steve Yegge
78d3f5f6d0 Update bd JSONL (closed bd-z528)
Amp-Thread-ID: https://ampcode.com/threads/T-fc7b7391-8881-4dd9-8e1f-28a2f95afb2b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 22:51:17 -08:00
Steve Yegge
e5e0c8a211 bd sync: 2025-11-07 22:51:08 2025-11-07 22:51:08 -08:00
Steve Yegge
c416c7d266 Prevent test pollution in production database (bd-z528)
- Add warning when creating issues with 'Test' prefix
- Suggest BEADS_DB for isolated testing
- Document testing workflow in AGENTS.md
- Include examples for manual and automated testing

Amp-Thread-ID: https://ampcode.com/threads/T-fc7b7391-8881-4dd9-8e1f-28a2f95afb2b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 22:50:58 -08:00
Steve Yegge
4f442ce5f1 bd sync: 2025-11-07 22:44:23 2025-11-07 22:44:23 -08:00
Steve Yegge
1065e66a75 Add bd cleanup command for bulk deletion of closed issues
Implements bd-jx90: simple cleanup command without API key requirement.

Features:
- Delete all closed issues with --force
- Filter by age with --older-than N (days)
- Preview with --dry-run
- Cascade deletion with --cascade
- JSON output support

Usage:
  bd cleanup --force                    # Delete all closed
  bd cleanup --older-than 30 --force    # Delete >30 days old
  bd cleanup --dry-run                  # Preview

Closes bd-jx90

Amp-Thread-ID: https://ampcode.com/threads/T-8d905db0-4ec7-411e-95de-1f044219dc9c
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 22:06:50 -08:00
Steve Yegge
de665f2341 Update bd JSONL 2025-11-07 21:58:34 -08:00
Steve Yegge
f6dbcd1a4f Add test safeguards to prevent production database pollution (bd-2c5a)
- Add failIfProductionDatabase() check in Go test helpers
- Add temp directory verification in RPC test setup
- Create conftest.py with pytest safety checks for Python tests
- Add BEADS_TEST_MODE env var to mark test execution
- Tests now fail fast if they detect production .beads/ usage

This prevents test issues from polluting the production database
like the incident on Nov 7, 2025 where 29+ test issues were created
in .beads/beads.db instead of isolated test databases.

Resolves: bd-2c5a
Amp-Thread-ID: https://ampcode.com/threads/T-635a8807-1120-4122-a0cb-4c21970362ce
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 21:58:22 -08:00
Steve Yegge
6f22c9641a bd sync: 2025-11-07 21:29:59 2025-11-07 21:29:59 -08:00
Steve Yegge
3431cd455a bd sync: 2025-11-07 21:29:32 2025-11-07 21:29:38 -08:00
Steve Yegge
fe705befbe Add RPC diagnostics with BD_RPC_DEBUG env var
- Add BD_RPC_DEBUG=1 for lightweight timing logs to stderr
- Log socket path, socket exists check, dial timing, health check timing
- Improve daemon status message when lock not held
- Helps field triage of connection issues without verbose daemon logs
- Fixes bd-j7e2
2025-11-07 21:29:22 -08:00
Steve Yegge
1c86fc1434 Update bd JSONL 2025-11-07 21:21:37 -08:00
Steve Yegge
a236558a7a Add client self-heal for stale daemon.pid
- When socket missing and lock free, automatically remove stale daemon.pid
- Prevents stale artifacts from accumulating after daemon crashes
- Includes comprehensive test coverage
- Fixes bd-1mzt

Amp-Thread-ID: https://ampcode.com/threads/T-3f606a8a-d591-4412-b994-ea790889a04d
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 21:21:24 -08:00
Steve Yegge
00f045a972 bd-vcg5: Add daemon crash recovery with panic handler + socket cleanup
Improvements:
1. Added top-level panic recovery in runDaemonLoop
   - Captures stack trace and logs to daemon.log
   - Writes daemon-error file with crash details for user visibility
   - Cleans up PID file on panic
2. Replaced os.Exit calls with return statements where possible
   - Allows deferred cleanup to run (lock release, socket removal, etc)
   - Improves graceful shutdown on errors
3. Enhanced stopDaemon forced-kill path
   - Removes stale socket file after process.Kill()
   - Prevents socket artifacts from accumulating
4. Added integration tests for crash recovery

Closes bd-vcg5
2025-11-07 21:17:24 -08:00
Steve Yegge
f6bdf7c641 Reduce RPC dial timeout from 2s to 200ms for fast-fail (bd-expt)
- Changed TryConnect default from 2s to 200ms
- Updated fallback timeout in TryConnectWithTimeout
- Complements bd-wgu4 lock probe to eliminate 5s delays
- Fixes GH#243 (5s delay when daemon socket missing)
- Health checks still use longer timeouts via explicit TryConnectWithTimeout calls
2025-11-07 21:12:45 -08:00
Steve Yegge
ba1b856acb Standardize daemon detection with tryDaemonLock probe (bd-wgu4)
- Extract lock checking to internal/lockfile package
- Add lock probe in RPC client before connection attempts
- Update daemon discovery to use lock probe
- Eliminates unnecessary connection attempts when socket missing

Closes bd-wgu4

Amp-Thread-ID: https://ampcode.com/threads/T-3b863f21-3af4-49d3-9214-477d904b80fe
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 21:02:38 -08:00
Steve Yegge
eeef37f37b Fix bd-srwk: Add ID-based staleness detection to bd export
Prevents data loss when exporting stale database by comparing issue IDs,
not just counts. Detects both scenarios:
- Database has fewer issues than JSONL
- Database has different issues than JSONL (same count)

Shows specific missing issue IDs in error. Allows override with --force.
Includes comprehensive tests for all scenarios.
2025-11-07 20:07:59 -08:00
Steve Yegge
620d96f142 Add MCP server functions for repair commands (bd-7bbc4e6a)
- Add repair_deps(fix=False) for orphaned dependencies
- Add detect_pollution(clean=False) for test issue detection
- Add validate(checks=None, fix_all=False) for health checks
- Implemented in BdCliClient, stubs in BdDaemonClient
- Registered as MCP tools in server.py

Amp-Thread-ID: https://ampcode.com/threads/T-9ce04c75-201b-4019-b9f1-0cf10663557c
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 19:40:04 -08:00
Steve Yegge
73e73aecf9 File bd-srwk: Prevent stale database exports
bd export currently silently overwrites issues.jsonl even when the
database is stale (older than the JSONL file). This causes data loss
in multi-agent workflows.

Real incident from vc project:
- Agent A created 4 discovery epics and exported
- Agent B had stale database and exported, removing those epics
- Required manual recovery

Proposed fix: Check database freshness before export, similar to
VC's ValidateDatabaseFreshness(). Require --force to override.

Priority P1: Silent data loss in common multi-agent scenario.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 19:39:44 -08:00
Steve Yegge
d97df21a65 Fix MCP server integration tests - add env variable propagation
- Fix BdCliClient._run_command() to pass BEADS_DIR/BEADS_DB env vars to subprocess
- Update temp_db fixture to create .beads in workspace and return .beads dir path
- Update mcp_client fixture to use beads_dir and enable BEADS_NO_DAEMON mode
- Simplify test_init_tool to work with connection pool architecture

Result: All 19 integration tests now pass (was 19 failing)
Amp-Thread-ID: https://ampcode.com/threads/T-c1da2a55-f086-4284-9c85-0dfa4c479cf9
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 19:27:22 -08:00
Steve Yegge
33c3b05eef Update bd JSONL 2025-11-07 19:08:05 -08:00
Steve Yegge
52833704f0 bd sync: 2025-11-07 19:07:55 2025-11-07 19:07:55 -08:00
Steve Yegge
0e8936bf61 Fix test failures: update to new AddDependencyParams field names
- Update tests to use issue_id/depends_on_id instead of from_id/to_id
- Fix test_client_lazy_initialization to mock create_bd_client instead of BdClient
- Add workspace setup for lazy initialization test
- Fixes 2 test failures (now 123 passing, down from 121)

Amp-Thread-ID: https://ampcode.com/threads/T-71b3ce65-87cb-451a-a30d-162d76d92f9c
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 19:07:49 -08:00
Steve Yegge
9eab271010 bd sync: 2025-11-07 19:05:05 2025-11-07 19:05:05 -08:00
Steve Yegge
62643ea8c6 Fix Windows MCP subprocess timeout for git detection (bd-r79z)
- Add shell=True for subprocess.run() on Windows platform
- Improves git command PATH resolution on Windows
- Add debug logging for git detection failures
- Fixes GH#245 timeout issue where git rev-parse times out in MCP server

Amp-Thread-ID: https://ampcode.com/threads/T-71b3ce65-87cb-451a-a30d-162d76d92f9c
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 19:05:02 -08:00
Steve Yegge
7fa0c93195 Fix daemon orphaning: track parent PID and exit when parent dies
- Add ParentPID field to DaemonLockInfo struct
- Daemon monitors parent process every 10 seconds
- Gracefully exits when parent process dies
- Prevents accumulation of orphaned daemons from dead sessions
- Fixes race conditions from multiple daemons on same database

Closes bd-zpnq
2025-11-07 18:57:43 -08:00
Steve Yegge
a6c9579645 bd sync: 2025-11-07 18:57:35 2025-11-07 18:57:35 -08:00
Steve Yegge
c81c1653fd Fix beads-mcp workspace context persistence and buffer overflow
Fixes bd-ww0g - Two critical bugs in beads-mcp v0.21:

1. "No workspace set" error after successful set_context:
   - Root cause: os.environ doesn't persist across MCP tool calls
   - Solution: Added module-level _workspace_context dict (server.py)
   - Modified set_context(), with_workspace(), where_am_i() to use persistent storage

2. "chunk longer than limit" MCP buffer overflow:
   - Root cause: Large issue lists exceed MCP stdio buffer limits
   - Solution: Reduced default list limit from 50 to 20
   - Strip dependencies/dependents from list() and ready() responses
   - Full details still available via show() command

Files changed:
- integrations/beads-mcp/src/beads_mcp/server.py
- integrations/beads-mcp/src/beads_mcp/models.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 16:54:17 -08:00
Steve Yegge
f1f144dbf3 bd sync: 2025-11-07 16:08:52 2025-11-07 16:08:52 -08:00
Steve Yegge
3e207dfca9 Add cleanup script for test pollution (bd-vxdr) 2025-11-07 16:08:47 -08:00
Steve Yegge
36919da128 bd sync: 2025-11-07 16:08:36 2025-11-07 16:08:36 -08:00
Steve Yegge
ced2a6c38f Merge remote changes after test pollution cleanup 2025-11-07 16:08:35 -08:00
Steve Yegge
705fcc0853 bd sync: 2025-11-07 16:08:11 2025-11-07 16:08:11 -08:00
Steve Yegge
a1ef05db98 Update bd JSONL 2025-11-07 16:07:25 -08:00
Steve Yegge
86d48a168d bd sync: 2025-11-07 16:03:56 2025-11-07 16:03:56 -08:00
Steve Yegge
d9db9755a8 Sync beads database after merge
Amp-Thread-ID: https://ampcode.com/threads/T-37164fd7-6452-40b0-b5dd-c13672dcb843
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 15:56:30 -08:00
Steve Yegge
cdecc02e4d bd sync: 2025-11-07 15:56:20 2025-11-07 15:56:20 -08:00
Steve Yegge
4cfded14f5 Merge branch 'main' of github.com:steveyegge/beads
Amp-Thread-ID: https://ampcode.com/threads/T-37164fd7-6452-40b0-b5dd-c13672dcb843
Co-authored-by: Amp <amp@ampcode.com>

# Conflicts:
#	.beads/beads.jsonl
2025-11-07 15:56:17 -08:00
Steve Yegge
df8ad121aa Update beads issues - close bd-tuqd (GH#254 fix) 2025-11-07 15:56:05 -08:00
Steve Yegge
0815ac2602 bd sync: 2025-11-07 15:55:36 2025-11-07 15:55:36 -08:00
Steve Yegge
046e852861 Fix GH#254: bd init now detects and chains with existing git hooks
- Detect existing git hooks (pre-commit framework, custom scripts)
- Prompt user with 3 options: chain (recommended), overwrite, skip
- Chain mode preserves existing hooks by calling them first
- Overwrite mode creates timestamped backups
- Add tests for hook detection and installation
- Update documentation with chaining feature

Fixes silent overwrites of pre-commit framework hooks that caused
test failures to slip through.

Amp-Thread-ID: https://ampcode.com/threads/T-37164fd7-6452-40b0-b5dd-c13672dcb843
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 15:55:19 -08:00
Steve Yegge
d3de5519b2 Fix Windows SQLite support in releases
- Enable CGO in GoReleaser config
- Add MinGW cross-compiler for Windows builds
- Split builds per platform to configure correct CC
- Install cross-compilation toolchains in release workflow

Fixes #253

Amp-Thread-ID: https://ampcode.com/threads/T-8600ed89-42af-4785-b5dc-01ad37f1451d
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 15:54:59 -08:00
Steve Yegge
3191c9c3da Remove vc.db exclusion from FindDatabasePath filter
Only filter out backup files, allow vc.db to be a valid database

Amp-Thread-ID: https://ampcode.com/threads/T-8600ed89-42af-4785-b5dc-01ad37f1451d
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 14:55:01 -08:00
Steve Yegge
f5726fc437 docs: add system requirements section for glibc compatibility
Amp-Thread-ID: https://ampcode.com/threads/T-3680ef32-8d31-4120-bbbd-d50d559e956e
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 14:53:44 -08:00
Steve Yegge
46dbdc0170 Add version number to beads-mcp startup log
Fixes #247 - Shows version on initial INFO line to help users verify
sync between MCP server and bd CLI tool
2025-11-07 14:24:07 -08:00