pingdotgg / pingdotgg/t3code

[Bug]: Worktree pairing can migrate the live desktop database

Open
#10,516 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug via-triage
Dominant language
TypeScript
Stars
23k
Forks
5.9k
Avg merge
11h 14m
Merged PRs (30d)
357

Description

Before submitting
  • I searched existing issues and did not find a duplicate of this specific failure.
  • I included enough detail to reproduce or investigate the problem.
Area

apps/server

Steps to reproduce
  1. Keep the installed desktop server running.
  2. In a development worktree with a pending migration, run node apps/server/src/bin.ts pair without --base-dir, with no discoverable worktree server.
  3. Discovery falls back to the installed server; token creation opens its database using the development checkout's migrations.
Expected behavior

Worktree pairing must not silently target the live install. Minting a token should not run a different checkout's schema migrations.

Actual behavior

An agent trying to pair a dev browser migrated my live database. On September 3, the command returned the installed server on port 3773. The live DB recorded migration 48 (ProjectionThreadMessageContext, unmerged work) and the t3 pair token in the same second: 16:33:46 UTC.

Updating later broke both installed builds: released migration 48 is ProjectionThreadBranchPullRequest, so it was skipped and startup failed on the missing column.

Code path: cli/pair.ts shared-home fallback → EnvironmentAuth.runtimeLayer → SQLite setup → runMigrations().

Related: #8896 covers migration identity validation; this report concerns the pairing command that unexpectedly applies development migrations to live data.

Impact

Blocks work completely

Version or commit

Affected installed builds: 0.0.39 and 0.0.40-nightly.20260907.1346; pairing ran from an unmerged inline-context worktree.

Environment

macOS, Electron desktop; Node CLI invoked from a linked git worktree.

Logs or stack traces
Pairing with MacBook Pro (http://127.0.0.1:3773).
PersistenceSqlError: ProjectionSnapshotQuery.getCommandReadModel:listThreads:query
Error: no such column: branch_pull_request_json

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cli/pair.ts and trace the shared-home fallback through EnvironmentAuth.runtimeLayer to SQLite setup and runMigrations(). Reproduce the worktree pairing scenario with an installed server and pending development migration, then verify which server and database are selected. Done means pairing cannot silently target the installed server or apply development migrations to its live database.

Written by the indexing model from the issue text.

Assessment

Tech stack
sqlite, typescript
Domain
cli, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.