49 Commits
Author SHA1 Message Date
Kieran KlukasandKieran Klukas 61ee2d2e0e fix(db): use connection pool to avoid corrupted writes 2026-05-12 12:40:59 -04:00
Greg SlepakandGitHub 401084133d fix(db): prevent SQLITE_NOTADB corruption under concurrent sub-agents (#2690)
Crush could fail to start with "file is not a database (26)" after a
session ran many sub-agents in parallel. The shared *sql.DB was opened
with Go's default unlimited connection pool, so each concurrent sub-agent
(session/message/cost writes via coordinator.runSubAgent) could open its
own SQLite handle. Under load, WAL frames from different handles
interleaved and auto-checkpoints could race; if the process was cancelled
or killed mid-checkpoint, the main DB header and WAL desynced, producing
SQLITE_NOTADB (26) on the next open.

Two changes address this:

- Set db.SetMaxOpenConns(1). SQLite serializes writes at the file level
  anyway, so extra pool connections add no throughput, only race surface.
  Forcing a single pooled connection makes database/sql queue all callers
  through one SQLite handle, eliminating cross-handle WAL/checkpoint
  races. Sub-agents still function; their writes just serialize (which
  SQLite was going to do regardless).

- Add _txlock=immediate to both driver DSNs (modernc.org/sqlite and
  ncruces/go-sqlite3). BEGIN IMMEDIATE acquires the reserved-writer lock
  up front so concurrent writers queue cleanly on busy_timeout instead of
  racing the deferred-to-writer upgrade (the pattern behind prior
  SQLITE_BUSY reports, e.g. #2129, #2576). Defense in depth alongside the
  pool limit.

For the ncruces driver the DSN must use the file: URI prefix for query
params to be parsed; the plain path form silently ignores _txlock.
2026-05-04 11:22:09 -03:00
Christian RochaandGitHub dc003bf728 feat: PreToolUse hook (#2598) 2026-04-26 09:24:36 -04:00
Andrey Nering e0a3f4dbb8 chore: task fmt 2026-04-16 17:50:19 -03:00
Andrey Nering 4b3dff30f8 test: run migration setup once to avoid race condition 2026-04-16 17:00:15 -03:00
Andrey Nering 53c9774ca1 test: reduce amount of logs print on go test -v 2026-04-16 16:40:25 -03:00
Christian Rocha 6920cf1174 chore(lint): modernize interfaces in the db package 2026-03-24 16:21:52 -04:00
Andrey NeringandGitHub 91bec12ceb chore: update ncruces/go-sqlite3 to v0.33.0 (#2461)
This release migrates away from `wazero` in favor of `wasm2go`, which
should bring better performance, specially on startup time.

For more information, see:

* https://github.com/ncruces/go-sqlite3/releases/tag/v0.33.0
* https://github.com/ncruces/go-sqlite3/discussions/361
2026-03-23 17:18:07 -03:00
fad58e2c26 feat: be able to continue non-interactive sessions (#2401)
Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>
2026-03-16 20:40:29 +00:00
Christian RochaandGitHub cfcbd69eb2 feat: CLI-based session access and management (#2373) 2026-03-12 16:09:42 +00:00
Carlos Alexandro BeckerandGitHub 48157c6c4e fix(sqlite): increase busy timeout (#2181)
Also refactor so we have the same pragmas on both drivers.

I couldn't reproduce OP's issue, but they're likely trying to use many
Crush instances at the same time, which may cause this.

The timeout was 5s only, so it was kind of easy to hit under load, I
presume. Upping it to 30s should improve that. AFAIK there's no much
else we can do.

See https://www.sqlite.org/rescode.html#busy

Closes #2129

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-02-10 15:31:27 -03:00
02f66a2e86 feat(lsp): start LSPs on demand, improve auto-start (#2103)
* feat(lsp): start LSPs on demand, improve auto-start

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* refactor: simplify

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* chore: fmt

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* feat: handle new session/load session

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* refactor: manager holds client list reference

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: do io in cmd

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: better manager

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: nil

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: err

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: properly handle restart

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: add stopped state

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: root markers

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: load for read files as well

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* chore(go.mod): move indirect dependency to the right block

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>
2026-02-06 16:12:18 -03:00
Carlos Alexandro BeckerandGitHub 3a929ffcff feat: filetracker per session (#2033)
* feat: filetracker per session

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: only in the new ui

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: tests, lint

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: old tui

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* test: added test, improve schema

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* test: synctest

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* test: fix race

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: relpath

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: simplify

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* chore: trigger ci

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-01-29 10:19:00 -03:00
Kujtim HoxhaandGitHub 033584c7d0 feat: implement prompt history (#2005) 2026-01-27 17:47:12 +01:00
0eee061660 feat: crush stats (#1920)
* wip: stats

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fixup! wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: css

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: cleanup

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* logo

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: cast

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* cleanup

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* improvements

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* provider donut

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: improvements

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* jetbrains mono

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fixes

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: rm border

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* chore: update footer/header

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: footer class

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* refactor: move stuff around

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* refactor: improving

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: anims

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: rename vars

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* chore: remove all card borders

* chore: adjust easing

* fix: fail if no sessions

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: improvements

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: generated by

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: header hazy

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2026-01-26 12:01:49 -03:00
Carlos Alexandro BeckerandGitHub df6f51492e fix(sqlite): busy timeout (#1815)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-01-09 15:29:31 -03:00
Carlos Alexandro BeckerandGitHub d1382bb55d perf: reduce memory usage (#1812)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-01-09 14:21:42 -03:00
Kujtim HoxhaandGitHub 4f6d0e9373 fix: race condition (#1649) 2025-12-19 13:19:36 +01:00
88831a1b00 feat: todo tool
Co-authored-by: Christian Rocha <christian@rocha.is>
2025-12-12 18:16:13 +01:00
Tai GrootandGitHub 94a87508f8 sort sessions by most recently used instead of creation (#1467) 2025-12-09 14:22:54 +01:00
Kujtim HoxhaandGitHub 47212faa9c Revert "fix(sqlite): remove WAL pragma" (#1393) 2025-11-06 10:50:02 +01:00
Carlos Alexandro BeckerandGitHub bb96ca3f02 fix(sqlite): remove WAL pragma (#1280) 2025-11-05 17:49:31 -03:00
kujtimiihoxha d7619a5c08 fix(summary): handle cancel and other cases 2025-10-08 14:18:37 +02:00
78540b012f security(sqlite): enable secure_delete pragma (#966)
Co-authored-by: Nuno Cruces <ncruces@users.noreply.github.com>
2025-09-09 10:47:53 -03:00
Andrey Nering c5c8bfd1d8 feat: create .crush/.gitignore automatically
Closes #588
Closes #254
2025-08-15 17:36:57 -03:00
Kujtim Hoxha 2a0f007d41 chore: pass datadir to db 2025-07-05 17:29:16 +02:00
Kujtim Hoxha 272d93110a chore: lint 2025-07-05 16:46:47 +02:00
Kujtim Hoxha dafbdb74cd chore: remove logs 2025-07-05 16:46:47 +02:00
Kujtim Hoxha d0fcb3f25d chore: fix lint 2025-07-01 11:45:05 +02:00
Kujtim Hoxha 565ab85eb9 chore: move to the new config 2025-07-01 11:42:12 +02:00
Andrey Nering 1fa4e8a385 ci: fix linting 2025-06-30 18:16:16 -03:00
Carlos Alexandro BeckerandGitHub df557dca41 fix: added index on created_at for sessions, messages, and files (#53) 2025-06-26 10:28:18 -03:00
Kujtim Hoxha ac5fb91e20 fix: fix the file history table and implement realtime file updates 2025-06-17 14:03:12 +02:00
Kujtim Hoxha 5baebf702d chore: rename opencode -> crush 2025-06-07 21:09:10 +02:00
Kujtim Hoxha 06e8c755ef chore: change the module 2025-06-07 20:57:32 +02:00
Kujtim HoxhaandGitHub 3e424754b4 Improve summary to keep context (#159)
* improve summary to keep context

* improve loop

* remove debug msg
2025-05-15 15:59:18 +02:00
Kujtim Hoxha de41703e20 change db driver 2025-04-24 22:27:51 +02:00
Kujtim Hoxha b106787a50 change package name 2025-04-24 18:26:16 +02:00
Kujtim Hoxha ed3518d075 small things 2025-04-21 16:24:38 +02:00
Kujtim Hoxha c24e3c18e0 small improvements 2025-04-21 13:42:02 +02:00
Kujtim Hoxha cc07f7a186 rename to opencode 2025-04-21 13:42:02 +02:00
Kujtim Hoxha bbfa60c787 reimplement agent,provider and add file history 2025-04-21 13:42:00 +02:00
Kujtim Hoxha d63d0c4c44 wip files 2025-04-21 13:38:42 +02:00
Kujtim Hoxha 8d874b839d add initial message handling 2025-04-21 13:38:42 +02:00
Kujtim Hoxha 36f201d5d3 fix logs and add cancellation 2025-04-10 13:29:44 +02:00
Kujtim Hoxha cfdd687216 add initial lsp support 2025-04-03 17:23:41 +02:00
Kujtim Hoxha afd9ad0560 rework llm 2025-04-01 13:38:54 +02:00
Kujtim Hoxha e7258e38ae initial agent setup 2025-03-23 22:25:31 +01:00
Kujtim Hoxha 8daa6e774a add initial stuff 2025-03-23 19:19:08 +01:00