Commit Graph

1923 Commits

Author SHA1 Message Date
Steve Yegge
345766badc Fix FK constraint failures in AddComment and ApplyCompaction (bd-5arw)
Amp-Thread-ID: https://ampcode.com/threads/T-4358e6e4-28ea-4ed7-ba3f-3da39072e169
Co-authored-by: Amp <amp@ampcode.com>
2025-11-20 18:55:10 -05:00
Steve Yegge
4560f55795 bd sync: 2025-11-20 14:25:18 2025-11-20 14:25:18 -05:00
Steve Yegge
6a562d53fa Merge remote-tracking branch 'origin/main'
Amp-Thread-ID: https://ampcode.com/threads/T-aa765a68-5cc4-465b-a2f6-aa008933c11e
Co-authored-by: Amp <amp@ampcode.com>
2025-11-20 14:21:06 -05:00
Steve Yegge
7665ff0763 Merge branch 'fix-issue-325' into main
Amp-Thread-ID: https://ampcode.com/threads/T-aa765a68-5cc4-465b-a2f6-aa008933c11e
Co-authored-by: Amp <amp@ampcode.com>
2025-11-20 14:20:45 -05:00
Steve Yegge
49a42a5e3a bd sync: 2025-11-20 12:47:14 2025-11-20 12:47:14 -05:00
Steve Yegge
76e6dc916f Merge remote changes during sync 2025-11-20 12:47:03 -05:00
Steve Yegge
c1542e9f93 bd sync: 2025-11-20 12:45:44 2025-11-20 12:45:44 -05:00
Steve Yegge
ddf58cabbd Merge remote changes 2025-11-20 12:41:28 -05:00
Steve Yegge
4031e88cd5 Merge remote-tracking branch 'origin/main' 2025-11-20 12:40:51 -05:00
Steve Yegge
09666b4219 Fix FOREIGN KEY constraint failed when operating on non-existent issues
Fixes #325

- Fix CloseIssue to check rows affected before inserting event
- Fix RemoveLabel to check rows affected before inserting event
- Fix UpdateIssueID to check rows affected before inserting event
- Prevent orphan events and confusing error messages

Amp-Thread-ID: https://ampcode.com/threads/T-aa765a68-5cc4-465b-a2f6-aa008933c11e
Co-authored-by: Amp <amp@ampcode.com>
2025-11-20 12:35:26 -05:00
Steve Yegge
fcf37bae63 Update beads.jsonl after merge 2025-11-20 12:35:10 -05:00
Steve Yegge
e5428abbb7 Merge branch 'main' into fix-monitor
Amp-Thread-ID: https://ampcode.com/threads/T-7bbd9558-2eb4-483a-bf7b-c61ea9c22092
Co-authored-by: Amp <amp@ampcode.com>
2025-11-20 12:34:30 -05:00
Steve Yegge
20ffe60316 Merge origin/main 2025-11-20 12:27:47 -05:00
Steve Yegge
800b0c3fca Update bd JSONL 2025-11-20 12:17:02 -05:00
Steve Yegge
a5b7c51590 Update beads issues 2025-11-20 12:16:27 -05:00
Steve Yegge
d933d98d47 Merge pull request #338 from cpdata/fix-daemon-lifetime
Fixes issue #278: Prevent daemon from exiting when launcher process dies
2025-11-20 09:15:51 -08:00
Steve Yegge
78a893d17d Merge pull request #337 from cpdata/fix-resolve-partial-id
Fix: Restore JSON unmarshaling in ResolveID for fixing failed bd show/update/close operations
2025-11-20 09:15:08 -08:00
Steve Yegge
0041efdf45 Merge pull request #333 from cpdata/cpdata-issue-322
Fix doctor incorrectly diagnosing hash IDs as sequential (#322)
2025-11-20 09:12:15 -08:00
dependabot[bot]
ff90be7a20 Bump github.com/anthropics/anthropic-sdk-go from 1.17.0 to 1.18.0 (#330)
Bumps [github.com/anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/anthropics/anthropic-sdk-go/releases)
- [Changelog](https://github.com/anthropics/anthropic-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/anthropics/anthropic-sdk-go/compare/v1.17.0...v1.18.0)

---
updated-dependencies:
- dependency-name: github.com/anthropics/anthropic-sdk-go
  dependency-version: 1.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-20 08:25:54 -08:00
Ryan
fb65163692 fix: address critical resource leaks and error handling issues (#327)
* fix: address critical resource leaks and error handling issues

Fixes 5 critical and high-priority issues identified in codebase analysis:

1. bd-vavh: Fix row iterator resource leak in recursive dependency queries
   - Move defer rows.Close() to execute on all code paths
   - Previously leaked connections on scan errors
   - Location: internal/storage/sqlite/sqlite.go:1121-1145

2. bd-qhws: Configure database connection pool limits for daemon mode
   - Set MaxOpenConns to runtime.NumCPU() + 1 for file-based databases
   - Prevents connection exhaustion under concurrent RPC load
   - Only affects daemon mode (long-running server)
   - Location: internal/storage/sqlite/sqlite.go:108-125

3. bd-jo38: Add WaitGroup tracking to FileWatcher goroutines
   - Track goroutines with sync.WaitGroup for graceful shutdown
   - Wait for goroutines to finish before cleanup in Close()
   - Prevents race condition on debouncer access during shutdown
   - Location: cmd/bd/daemon_watcher.go (Start, startPolling, Close)

4. bd-2d5r: Fix silent error handling in RPC response writing
   - writeResponse now returns errors instead of ignoring them
   - Prevents sending partial JSON and client hangs
   - Closes connection on marshal/write errors
   - Location: internal/rpc/server_lifecycle_conn.go:227-246

5. bd-zqmb: Fix goroutine leak in daemon restart
   - Add 10-second timeout to daemon Wait() goroutine
   - Kill process if it doesn't fork within timeout
   - Prevents goroutine accumulation on restart failures
   - Location: cmd/bd/daemons.go:250-268

All changes follow Go best practices and maintain backward compatibility.

* Add feature request for .beads/README.md generation during init

Created bd-m7ge to automatically generate a promotional/documentation
README in the .beads directory when running 'bd init'. This will help
advertise Beads in open source repositories and provide quick reference
documentation for developers using AI coding agents.

The README will include:
- Brief explanation of Beads (AI-native issue tracking)
- Link to steveyegge/beads repository
- Quick reference of essential commands
- Compelling messaging to encourage adoption
2025-11-20 08:13:06 -08:00
Matt Wilkie
4a8cbe8f57 How to resolve merge conflicts in .beads/beads.jsonl (source: Gemini 3) 2025-11-19 15:22:37 -07:00
Matt Wilkie
4985a6803c Merge branch 'fix-ci-issue-328' into fix-monitor 2025-11-19 15:15:30 -07:00
Matt Wilkie
ca52600d7e bd sync: 2025-11-19 15:01:56 2025-11-19 15:01:56 -07:00
Matt Wilkie
2682fc7003 add panic func in case of early exit
During 1st test monitor quit early with no error. Subsequent runs were fine. Added this func to give a wee bit of feedback for next time.
2025-11-19 14:44:26 -07:00
Matt Wilkie
e36baee506 fix monitor-webui failure to detect running daemon
monitor-webui fails to connect to the bd daemon because it calculates the socket path incorrectly. It expects beads.db.sock in a nested .beads directory, whereas the daemon listens on bd.sock in the .beads directory.

Updated `getSocketPath` function to:
- Check if dbPath directory is already .beads.
- Use bd.sock as the socket name instead of [dbName].sock.
- Handle both nested and non-nested cases correctly.
2025-11-19 14:33:37 -07:00
Matt Wilkie
4ba610dbae bd sync: 2025-11-19 09:48:30 2025-11-19 09:48:30 -07:00
Matt Wilkie
e538dbdee2 Merge show-rev-in-dev commit 'c922dc1ec32d5e3a470c22036891e239f4ab1350' into stable-fixes 2025-11-19 09:25:08 -07:00
Matt Wilkie
d72e57854b Merge branch 'pr-338' into stable-fixes 2025-11-19 09:15:35 -07:00
Charles P. Cross
4432af0aa4 fix: improve ResolvePartialID / ResolveID handling for bd show (issue #336)
- Add fast path for exact ID matches in ResolvePartialID
- Properly unmarshal ResolveID RPC responses used by `bd show`

Summary:
--------
Fixes regression introduced after v0.23.1 where `bd show <issue_id>`,
`bd update <issue_id>`, and `bd close <issue_id>` commands failed with
"operation failed: issue not found" errors even when the issue existed
in the database.

Root Cause:
-----------
The daemon's ResolveID RPC handler (handleResolveID in
internal/rpc/server_issues_epics.go) returns a JSON-encoded string
containing the resolved issue ID. For example, when resolving "ao-izl",
the RPC response contains the JSON string: "ao-izl" (with quotes).

After v0.23.1, the show/update/close commands in cmd/bd/show.go were
changed to use string(resp.Data) to extract the resolved ID, which
treats the raw bytes as a string without decoding the JSON. This caused
the resolved ID to literally be "ao-izl" (including the quotes),
which then failed to match the actual issue ID ao-izl (without quotes)
when passed to subsequent Show/Update/Close RPC calls.

In v0.23.1 (commit 77dcf55), the code correctly unmarshaled the JSON:
  var resolvedID string
  if err := json.Unmarshal(resp.Data, &resolvedID); err != nil {
      // handle error
  }

This unmarshal step was removed in later commits, causing the regression.

Fix:
----
Restored the JSON unmarshaling step in three places in cmd/bd/show.go:
1. showCmd - line 37-42
2. updateCmd - line 400-405
3. closeCmd - line 723-728

Each now properly decodes the JSON string response before using the
resolved ID in subsequent RPC calls.

Testing:
--------
- Verified `bd show <issue-id-with-prefix>` works correctly in both daemon and direct modes
- Tested with newly created issues to ensure the fix works for all IDs
- All Go tests pass (go test ./... -short)
- Confirmed behavior matches v0.23.1 working binary

The fix ensures that issue ID resolution works correctly regardless of
whether the ID prefix matches the configured issue_prefix.
2025-11-19 05:54:28 -05:00
Charles P. Cross
68f9bef98c fix: prevent daemon from exiting when launcher process exits (issue #278) 2025-11-19 05:07:16 -05:00
Charles P. Cross
04a1996fd9 fix: Fix daemon export leaving JSONL newer than database (issues #301, #321)
After daemon auto-export, JSONL mtime could be newer than database mtime
due to SQLite WAL mode not updating beads.db until checkpoint. This caused
validatePreExport to incorrectly block subsequent exports with "JSONL is
newer than database" error, leading to daemon shutdown.

Solution: Call TouchDatabaseFile after all export operations to ensure
database mtime >= JSONL mtime. This prevents false positives in validation
2025-11-19 05:06:12 -05:00
Charles P. Cross
8c1f865e23 Fix doctor incorrectly diagnosing hash IDs as sequential (issue #322)
- Enhanced checkIDFormat to sample multiple issues instead of just one
- Added detectHashBasedIDs function with robust multi-heuristic detection:
  * Checks for child_counters table (hash ID schema indicator)
  * Detects letters in IDs (base36 encoding)
  * Identifies leading zeros (common in hash IDs, rare in sequential)
  * Analyzes variable length patterns (adaptive hash IDs)
  * Checks for non-sequential numeric ordering
- Added comprehensive test coverage (16 new test cases)
- Fixes false positives for numeric-only hash IDs like 'pf-0088'

Closes #322
2025-11-18 05:20:11 -05:00
dependabot[bot]
aeea3532cd Bump golang.org/x/mod from 0.29.0 to 0.30.0 (#331)
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.29.0 to 0.30.0.
- [Commits](https://github.com/golang/mod/compare/v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-version: 0.30.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-17 13:06:46 -08:00
dependabot[bot]
fc7b46262c Bump fastmcp from 2.13.0.2 to 2.13.1 in /integrations/beads-mcp (#332)
Bumps [fastmcp](https://github.com/jlowin/fastmcp) from 2.13.0.2 to 2.13.1.
- [Release notes](https://github.com/jlowin/fastmcp/releases)
- [Changelog](https://github.com/jlowin/fastmcp/blob/main/docs/changelog.mdx)
- [Commits](https://github.com/jlowin/fastmcp/compare/v2.13.0.2...v2.13.1)

---
updated-dependencies:
- dependency-name: fastmcp
  dependency-version: 2.13.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-17 13:06:38 -08:00
Codex Agent
070107caee Handle formatting errors in onboard renderer 2025-11-17 11:32:37 -07:00
Codex Agent
4e222145ac Fix onboard test deadlock on Windows 2025-11-17 11:26:59 -07:00
Codex Agent
4cd26c8e5a Fix Windows concurrent issue creation 2025-11-17 10:41:05 -07:00
Codex Agent
bf9b2c83fb Annotate gosec-safe file accesses 2025-11-17 10:12:46 -07:00
Codex Agent
7b63b5a30b Fix CI regressions and stabilize tests 2025-11-17 10:06:35 -07:00
matt wilkie
c922dc1ec3 remove unrelated leftover file from agent 2025-11-16 18:13:07 -07:00
matt wilkie
12dfa0b555 also report branch in dev version 2025-11-16 18:10:46 -07:00
matt wilkie
6d390f7728 Merge branch 'main' into show-rev-in-dev
# Conflicts:
#	.beads/beads.jsonl
2025-11-16 15:50:09 -07:00
Steve Yegge
42233073bc Update bd JSONL after closing 8-char hash issues
Amp-Thread-ID: https://ampcode.com/threads/T-5358ea57-e9ea-49e9-aedf-7044ebf8b52a
Co-authored-by: Amp <amp@ampcode.com>
2025-11-15 14:14:06 -08:00
Steve Yegge
33b913f3dd bd sync: 2025-11-15 14:13:53 2025-11-15 14:13:53 -08:00
Steve Yegge
3c9cf957ad Update bd JSONL
Amp-Thread-ID: https://ampcode.com/threads/T-5358ea57-e9ea-49e9-aedf-7044ebf8b52a
Co-authored-by: Amp <amp@ampcode.com>
2025-11-15 14:08:03 -08:00
Steve Yegge
59e635dbc7 bd sync: 2025-11-15 14:07:55 2025-11-15 14:07:55 -08:00
Steve Yegge
934ae04fa0 Fix gh-316: Prefer exact ID matches over prefix matches
The ID disambiguation logic treated 'offlinebrew-3d0' as ambiguous when
child IDs like 'offlinebrew-3d0.1' existed. Now the system:

1. Checks for exact full ID matches first (issue.ID == input)
2. Checks for exact hash matches (handling cross-prefix scenarios)
3. Only falls back to substring matching if no exact match is found

Added test cases verifying:
- 'offlinebrew-3d0' matches exactly, not ambiguously with children
- '3d0' without prefix still resolves to exact match

Amp-Thread-ID: https://ampcode.com/threads/T-5358ea57-e9ea-49e9-aedf-7044ebf8b52a
Co-authored-by: Amp <amp@ampcode.com>
2025-11-15 14:07:38 -08:00
Steve Yegge
b9919fe031 Fix: --parent flag now creates parent-child dependency
When using 'bd create --parent <id>', the system now automatically
creates a parent-child dependency linking the child to the parent.
This fixes epic status reporting which was showing zero children.

Fixes #318 (bd-jijf)

Changes:
- cmd/bd/create.go: Add parent-child dependency after issue creation
- internal/rpc/server_issues_epics.go: Add same fix for daemon mode

Tested:
- Created epic with children, verified epic status shows correct count
- Verified closing all children makes epic eligible for closure
- All tests pass

Amp-Thread-ID: https://ampcode.com/threads/T-f1a1aee1-03bd-4e62-a63c-c1d339f8300b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-15 13:20:02 -08:00
Steve Yegge
1c2e88c621 bd sync: 2025-11-15 13:19:53 2025-11-15 13:19:53 -08:00
Steve Yegge
6f7e7fa930 Fix lint errors: handle error return values 2025-11-15 12:52:34 -08:00