Commit Graph
45 Commits
Author SHA1 Message Date
Theo BrowneandClaude 6800ee32ea Address dev utility review findings
Co-Authored-By: Claude <[email protected]>
2026-07-27 00:44:44 -07:00
Theo Browne 2187054482 Keep seeded development state internally consistent 2026-07-26 20:40:30 -07:00
Theo Browne 200774a710 Restore dev sharing when lease handoff fails 2026-07-26 20:40:30 -07:00
Theo Browne 900173096d Handoff dev share leases between clear and serve 2026-07-26 20:40:30 -07:00
Theo Browne df39785c51 Make dev share acquisition transactional 2026-07-26 20:40:30 -07:00
Theo Browne e125c343c0 Claim dev share ownership after serving 2026-07-26 20:40:30 -07:00
Theo Browne c698e6aa5b Fix dev sharing across hosted and restarted servers 2026-07-26 20:39:53 -07:00
Theo BrowneandClaude Opus 5 6045ce23d0 Rank activities by sequence, scope the seed guard, unify the probes
Two Cursor Bugbot findings on the merge, plus the simplification they
enabled:

- The activity cap ordered `created_at` before `sequence`; the app ranks
  `sequence` first. The keys disagree outright under clock skew — a
  higher-sequence activity can carry an older timestamp — and then the
  cap keeps rows the timeline treats as oldest. Reordered to match, with
  the regression test now covering a skewed row, not just a tied one.
- The running-server guard blocked on a live server in either state
  directory while the seed touches exactly one. A server using only the
  other directory's database now no longer refuses the seed; both the
  pre-copy check and the pre-commit re-check take the resolved state dir.
- Scoping the probe meant threading one rule through both variants, so
  they now share a single implementation: the sync function reads and
  checks, and the Effect wrapper just lifts it. That deletes the schema
  decoder the Effect path used, removes the duplicated parsing, and
  makes the parity the tests pin structural rather than incidental.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:39:13 -07:00
Theo BrowneandClaude Opus 5 9c61dbed19 Cover the command-receipts delete in the fixture
Completing the fixture audit: `orchestration_command_receipts` is one of
the three tables the seed clears, but the fixture never created it, so
that delete only ever ran its table-missing skip path.

Added the table (migration 002) with a receipt row, and extended the
event-log test to assert receipts go too — a receipt left behind records
a command whose events the seed deleted, so re-issuing that command would
be treated as already applied and produce nothing. Confirmed the
assertion fails when the delete is removed.

The audit is now complete: every table the seed writes or clears exists
in the fixture, and every column it keys on is present. The remaining
schema gaps are columns copied generically by column intersection, where
no seeder behavior depends on them.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 dc375f336d Cap activities by the order the app displays them
Auditing the fixture against the real migrations (the method that found
the missing checkpoint column) turned up a second gap: the test schema
omitted `projection_thread_activities.sequence`, and the copy's per-thread
cap ordered on `created_at` alone.

The app reads these back ordered by `sequence` first, then `created_at`
(ProjectionSnapshotQuery). A burst of tool activity lands many rows on
one timestamp, so capping on the timestamp alone cuts arbitrarily among
them — demonstrated with four tied rows where "keep the newest two" kept
the two the timeline treats as oldest.

Ordered to match, falling back to the timestamp when the source predates
migration 008. Fixture gained the column, and the regression test fails
against the old ordering.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 a37db1a837 Give the fixture the checkpoint column its guard depends on
The test schema omitted `projection_turns.checkpoint_turn_count`, which
is the column `dropPendingTurnStarts` keys its "spare checkpoint rows"
guard on. Every existing test therefore ran the degraded path where the
clause is dropped for schema drift, so the guard's real behavior was
never exercised.

Added the column (migration 005 has it) and a case covering what the
clause is for: a pending row carrying a checkpoint survives the delete.
Confirmed the case fails when the clause is removed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 28a69713ed Pin the two liveness probes to identical behavior
The sync probe added for the pre-commit re-check duplicates the Effect
one's rules by hand — positive pid, live process, unparseable means no.
Two implementations of one rule drift apart silently, and this branch has
already produced several bugs of exactly that shape.

Asserts every case against both probes rather than trusting them to
agree: live in either state dir, dead pid, pid 0 and -1, malformed JSON,
and JSON with no pid. Confirmed the parity test fails when the sync
probe's positive-pid guard is removed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 bc12b990a4 Re-check for a live server before commit; make the tie WAL-aware
Two findings from Macroscope review:

- The running-server guard was check-then-act. A copy takes seconds, and
  nothing stopped a server starting after the check returned None — the
  seed would then replace the projections and event log underneath it,
  which is exactly what the guard exists to prevent. `seedDevDatabase`
  now takes an optional probe and re-runs it immediately before COMMIT,
  where a rollback still costs nothing. This narrows the window to the
  commit itself rather than closing it: a filesystem read and a SQLite
  transaction share no lock, so a server starting in that last instant is
  still possible. Documented as such rather than claimed as airtight.
- The state-dir tiebreak read `state.sqlite` mtime, but the server runs
  SQLite in WAL mode, where writes land in `state.sqlite-wal` and the
  main file can stay untouched until a checkpoint. Verified: 50 writes
  left the main mtime unchanged while the sidecar advanced. So a busy
  directory lost the tie to a dormant one, and the seed overwrote the
  wrong database. Recency is now the newer of the two files.

Both verified end-to-end: a backdated main file with a fresh -wal now
wins the tie, and a probe returning a pid mid-copy leaves the target's
rows and event log intact.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 974d68356e Document the seeder's exported surface
CodeRabbit flagged docstring coverage. Added docs where a caller would
actually need them — that `seedDevDatabase` is destructive and not
incremental, that it validates before opening anything so a rejected run
leaves the target intact, that the caller still owns the attachment
files, and that `DevSeedError.hint` is the actionable half the CLI prints
separately.

Left the self-describing internals (`placeholders`, `hasTable`,
`columnsOf`, `stateDbPath`) alone: the surrounding scripts/ code documents
about 2% of its declarations, so padding to an 80% tool default would
read as noise rather than convention.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 8dee88913c Fix single-column recency ordering and validate limits
Two more from Macroscope review:

- `ORDER BY COALESCE(...)` throws on a source down to one recency
  column. SQLite requires at least two arguments, so the pre-017 schema
  the column filter exists to support was exactly the case that aborted.
  Emit the column directly when only one survives the filter.
- `seedDevDatabase` accepted non-positive limits. Both are bound into
  `LIMIT ?`, where SQLite reads a negative as "no limit" — a caller
  bypassing the CLI flags silently got a full-table copy instead of the
  bounded one the options contract promises. Rejected before the target
  is touched, alongside the existing upper-bound check.

Both regression tests confirmed failing without their fix.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 dba56bafa3 Mirror the server's turn-id guard when settling
Self-review of the settle path, which has been the source of every
regression in this branch. The server filters `turnId !== null &&
state === "running"` before settling; this filtered only on state.

No row is both null-id and running today — the sole null-id insert
writes 'pending' — so this changes no behavior. It is the invariant the
UPDATE already depends on, written down where it is relied upon, and it
keeps the two predicates directly comparable if a null-id running row
ever becomes possible.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 c92ad95fe3 Delete pending turn starts, and follow the real state directory
Three findings from Macroscope review:

- Settling `pending` rows to `interrupted` was the wrong verb. The server
  deletes them (`clearPendingProjectionTurnsByThread`) once the turn
  starts or the thread stops, and never settles one in place. They also
  cannot be settled coherently: `turn_id` is NULL, so an "interrupted"
  pending row is a terminal turn with no id, a shape no real turn has.
  Now deleted, matching the server's predicate exactly so a checkpoint
  row is never caught by it.
- `COALESCE(completed_at, requested_at)` preserved a stale completion on
  a running turn. One can carry a completion from an earlier settle that
  a later checkpoint reverted to "running" — the `...existingTurn` spread
  in ProjectionPipeline keeps the old value — and dating the interruption
  to that checkpoint gives a wrong duration. Overwritten unconditionally.
- The CLI hard-coded `<base>/userdata/state.sqlite` while a dev server
  under an implicit dev home stores state in `<base>/dev`. A main-checkout
  `bun run dev` was therefore unseedable, and said so by claiming no
  database existed and suggesting the user start the server that was
  already running. Source and target now follow whichever directory holds
  a database, `userdata` breaking the tie; attachments follow the same
  directory. Verified both a dev-only target and the precedence order.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 d3ee18cd2c Own the thread ceiling where the bindings are built
The cap was declared in the CLI while the constraint belongs to the
seeder's statements, and the number appeared in three places. That split
is the mechanism behind the last regression: a change to a statement in
the library silently invalidated a bound stated in the CLI, and the
mismatch only surfaced at the maximum — after the target was emptied.

Move it to `MAX_SEED_THREAD_LIMIT` beside the statements that have to
satisfy it, have the flag derive its bound from there, and check it in
`seedDevDatabase` before anything is opened so a caller bypassing the
flag fails while the target is still intact.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 33e4c7624b Keep the settle UPDATE within SQLite's variable ceiling
Adding "pending" to the settled states bound them as parameters, costing
two bindings on top of one per thread. `--threads` is capped at 32766 —
SQLite's ceiling — so the documented maximum landed exactly two over and
threw "too many SQL variables", after the target had already been
emptied. Inline the literals; they are internal constants, never input.

The regression test seeds at the cap for real rather than asserting the
statement text, since the property is that no code path adds a binding.
Fixture rows are batched into one transaction and the scale case builds
thread rows only, keeping it near a second.

Caught by Macroscope review.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:49 -07:00
Theo BrowneandClaude Opus 5 8a76bb83cc Fix liveness probe, --json output, and remaining unsettled state
Follow-up review of the pairing path and a second pass over seeding:

- `isPersistedServerRuntimeStateLive` reported non-positive pids as live.
  `process.kill` reads 0 and -1 as signal-group targets rather than
  process lookups, so neither throws and both were caught by the "it
  didn't throw, so it's running" branch. A truncated or hand-edited file
  recording either would be believed forever — the dev candidate wins the
  devUrl preference, so it also outranks a genuinely live server
  elsewhere and mints tokens into a database nothing reads. Rejected in
  the schema and re-checked at the call site; the errno cast is now a
  guard, since an out-of-range pid throws a TypeError with no `code`.
- `pairing url --json` emitted warnings on stdout ahead of the payload.
  The probe reads both state directories, so a corrupt file in the one
  *not* in use broke JSON for any consumer piping it; the quiet-logs
  layer was only applied around the issuing step that runs after. Verified
  with a crafted fixture: stdout is now valid JSON.
- Turns copied in the `pending` state were left unsettled. Same defect as
  the `running` case fixed previously — a user message accepted before its
  provider turn started, which only that thread's next message would ever
  clear.
- The source was read across a dozen implicit transactions while the
  installed app may be writing to it, so a project could vanish between
  the query that selected it and the copy that read its row. One deferred
  read transaction pins every query to a single snapshot.
- `--from` and `--to` resolving to the same directory is now refused. Not
  for the data loss it appears to be (the source reads a pre-transaction
  snapshot, so the rows come back — verified in both journal modes), but
  because the event log, the cursors, and everything outside the caps do
  not.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:48 -07:00
Theo BrowneandClaude Opus 5 373e7919d1 Harden dev:seed against state it cannot settle
Review of the seeding path found five ways a seeded database could
describe something the copy cannot back up:

- Nothing stopped `dev:seed` from running against a live server. SQLite
  locking lets the seed take the write lock between the server's own
  writes and commit cleanly; what it cannot do is tell that server its
  projections and event log were replaced underneath it. Refuse instead,
  via a pid probe over both state directories.
- A thread copied mid-turn kept `state = 'running'`. The session override
  did not cover it — the turn is read independently, and an unsettled one
  leaves the thread spinning and its timeline unfoldable forever. Settle
  those to "interrupted", matching what the server does when a session
  leaves "running". Streaming messages are finished for the same reason.
- Attachment metadata was copied without the files behind it, so a seeded
  thread rendered an image whose request 404s. Report the referenced ids
  and copy the matching files alongside the rows.
- Orphaned `provider_session_runtime` rows survived the seed naming
  threads it had just deleted, which the session reaper then tried to
  stop against a provider instance the worktree may not define.
- `--threads` had no upper bound, so a large enough value died with "too
  many SQL variables" after the target was already emptied.

Also corrects the projector-cursor comment: `orchestration_events.sequence`
is AUTOINCREMENT, so emptying the log does not reset its high-water mark
and sequence does not restart at 1. Zero remains the right cursor, for the
reason now stated.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 20:38:48 -07:00
Theo Browne 180070865e Add dev pairing and seed utilities 2026-07-26 20:38:23 -07:00
Theo BrowneandClaude Opus 5 23b5502217 feat(dev): Make t3 code dev instances shareable over Tailscale (#4556)
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-07-26 19:48:09 -07:00
maria edb12401e5 fix(cli): publish nightly branded favicons (#4372) 2026-07-23 23:36:02 +02:00
7a820abfdd feat: add headless t3 connect setup for SSH hosts (#3749)
Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: codex <[email protected]>
2026-07-19 18:59:23 +02:00
Julius Marminge ebe8afb1df Refresh splash screen and favicon branding (#4120) 2026-07-18 15:44:06 +02:00
Julius Marmingeandcodex 6e9987cf17 Refresh app icons across release variants (#4080)
Co-authored-by: codex <[email protected]>
2026-07-17 18:51:14 +02:00
Julius Marmingeandcodex 40d14647db [codex] Structure catalog dependency resolution failures (#3298)
Co-authored-by: codex <[email protected]>
2026-06-20 11:01:36 -07:00
Julius Marmingeandcodex 2fa37ec183 [codex] Enforce canonical Node namespace imports (#3238)
Co-authored-by: codex <[email protected]>
2026-06-20 01:06:37 -07:00
Julius Marmingeandcodex 708d5383a9 [codex] Trace first-party relay clients (#2995)
Co-authored-by: codex <[email protected]>
2026-06-16 00:11:29 -07:00
477795697d refactor: resolve host process state through Effect (#2959)
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
2026-06-14 16:47:56 -07:00
Julius Marmingeandcodex 0e4a43519f [codex] Extract infrastructure, telemetry, and test tooling (#2994)
Co-authored-by: codex <[email protected]>
2026-06-07 20:21:47 -07:00
Julius Marminge f60def2054 Migrate tests to vite-plus test APIs (#2964) 2026-06-05 04:39:19 +00:00
Julius Marmingeandcodex 5ae77c0d63 feat(relay): Add managed relay tunnels and APN service (#2837)
Co-authored-by: codex <[email protected]>
2026-06-04 19:53:56 -07:00
Julius MarmingeandJulius Marminge 37bf0f0d1d [codex] remove duplicated pnpm root config (#2939)
Co-authored-by: Julius Marminge <[email protected]>
2026-06-04 05:34:23 +00:00
b440dd1812 Migrate workspace to Vite+ and pnpm (#2899)
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
2026-06-03 16:16:53 -07:00
Julius Marmingeandcodex bd851c0203 chore: add Alchemy reference repo subtree (#2918)
Co-authored-by: codex <[email protected]>
2026-06-03 00:08:31 +00:00
Julius Marmingeandcodex e3f1405884 chore: add vendored reference repo subtree sync tooling (#2902)
Co-authored-by: codex <[email protected]>
2026-06-01 21:44:23 -07:00
Julius MarmingeandJulius Marminge 3c32bc8fd1 [codex] Fix hosted channel bootstrap (#2613)
Co-authored-by: Julius Marminge <[email protected]>
2026-05-08 22:57:16 -07:00
Julius Marmingeandcodex 3772fa127c feat: Hosted Frontend, Tailscale Integration & SSH Lancher (#2361)
Co-authored-by: codex <[email protected]>
2026-05-03 22:19:15 -07:00
Evan YuandJulius Marminge 6891c77d3e Build for Windows ARM (#2080)
Co-authored-by: Julius Marminge <[email protected]>
2026-04-16 17:01:27 -07:00
409ff90a14 Nightly release channel (#2012)
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
2026-04-14 18:18:37 -07:00
Julius Marmingeandcodex e3004ae806 Harden secret store and resolve catalog overrides (#1891)
Co-authored-by: codex <[email protected]>
2026-04-10 13:09:39 -07:00
d249e628ee Stage production icons for desktop builds and publish (#168)
* Stage production icons for desktop builds and publish

- add shared brand asset paths and a Windows .ico asset
- stage Linux/Windows icons in desktop artifact builds
- override and restore publish favicon during server CLI publish

* 'blip'

* Fix PR review issues for publish icon staging

* Refactor brand assets and harden Windows desktop build setup

* Apply remaining server orchestration updates

* Fix production mac icon asset

Co-authored-by: Theo Browne <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Theo Browne <[email protected]>
2026-03-06 13:54:31 -08:00
Julius Marminge 11606fd9c6 cli for pub 2026-03-03 00:30:15 -08:00