fix(server): dev database copies drop links to other environments#27313
Problem
Dev database seeds retain links to real environments and can contact those machines after secrets are copied.
Change
Add peer_environment_links to the existing cleared tables. Preserve @eyeveil's regression test and guidance update; remove only the redundant code comment. No production database behavior changes.
Verification
- Blacksmith: regression reproduced without the fix (
links: 1); all 7 migration tests pass with it. - Blacksmith:
vp run check:changed 36dac688a17c6de1c6398e62d01546fb787c185bpasses format, lint, both knip checks, GraphQL, affected typechecks, and 8 tests. - Real migration CLI against an isolated database: source retains 1 peer link; destination has 0.
- Two independent reviews approve this head with no findings.
- Unverified: starting a seeded server with copied secrets. No UI changes or visual evidence required.
Takeover
Replaces #27127, with thanks to @eyeveil for the original implementation.
Built with GPT-6.1-Sol in the Codex harness on T3 Code.
Checks
Added 1 commit
- fix(server): dev database copies drop links to other environments14f0229
Approvability
Verdict: Approved at 14f0229
Macroscope's review found this PR approvable — Development database copies now omit links to other environments, reducing unintended connections to real machines. The source database and production behavior remain unchanged.
You can add or adjust custom eligibility rules. Learn more.
Walkthrough
The development database migration now clears
peer_environment_links. The migration test verifies that no peer environment links remain in the copied database. The guidance now includes these links among the data dropped during refresh.Changes: Development database cleanup
Layer / File(s) Summary Clear and verify peer environment links
apps/server/scripts/migrate-dev-db.ts,apps/server/scripts/migrate-dev-db.test.ts,AGENTS.mdpeer_environment_linksis added toCLEARED_TABLES. The migration test inserts a link and verifies that no links remain. The guidance lists links among the data dropped during refresh.Priority: External image Normal
Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#27127: Implements the same fix in the same three files. This PR continues that implementation while replacing PR
#27127.
Suggested reviewers:
juliusmarminge,t3dotgg- pingdotgg/t3code#27127: Implements the same fix in the same three files. This PR continues that implementation while replacing PR
Merge Risk: External image Minimal · up to 14f02
The migration change is localized and covered by matching regression checks, with no merge-blocking risk identified.
Pre-merge checks: Passed 3 · Failed 1
Failed Failed checks: 1 warning
Check name Status Explanation Resolution Description check Warning The description explains the problem, change, verification results, and known limitation. It does not include the required Scope and approval section or explain the approval basis for this focused fix… Add a Scope and approval section. Link the triaged issue or discussion with explicit maintainer approval, or explain why this obvious, focused bug fix qualifies without prior approval. Passed Passed checks: 3 passed
Check name Status Explanation Title check Passed The title clearly identifies the server fix: development database copies no longer retain links to other environments. Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the problem, change, verification results, and known limitation. It does not include the required Scope and approval section or explain the approval basis for this focused fix.
Resolution
Add a Scope and approval section. Link the triaged issue or discussion with explicit maintainer approval, or explain why this obvious, focused bug fix qualifies without prior approval.
Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Usage-based review receipt
- Mode: Continue automatically
- Reviewed files: 3
- Charged: $0.75
- View usage details
Note
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
Comment @coderabbitai help to get the list of available commands.
Thread transfer impact
✅ Thread transfer remains within every enforced ceiling.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | +6 B (+0.1%) | 6.8 KiB | ✅ |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Codex | Live turn WebSocket wire | 1.2 KiB | 1.3 KiB | +6 B (+0.5%) | 2.0 KiB | ✅ |
| Codex | Live turn WebSocket decoded | 21.6 KiB | 21.6 KiB | 0 B (0.0%) | 24.4 KiB | ✅ |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
| Claude | Total thread wire | 5.0 KiB | 5.0 KiB | 0 B (0.0%) | 6.8 KiB | ✅ |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Claude | Live turn WebSocket wire | 1.3 KiB | 1.3 KiB | 0 B (0.0%) | 2.0 KiB | ✅ |
| Claude | Live turn WebSocket decoded | 21.9 KiB | 21.9 KiB | 0 B (0.0%) | 24.4 KiB | ✅ |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
Baseline: 8970a32 · PR result: 14f0229 · Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
Note
Written by gpt-6.1-sol on behalf of Maria
Verified in a real dev environment
verified as-is at 14f0229451c12716d0a63b3cf515313d6b80747f on this linux boat vm. no code changes or pushes.
- installed and ran
github/main(6575ce3250) in a separate worktree, then the exact pr head. only one dev server ran at a time. - used playwright from the repo with
/usr/bin/google-chrome. created a project pointing at the real git worktree, completed a real codexgpt-6.1-solturn, enabled linked environments, and linked an isolated realt3 serveenvironment through settings and its pairing flow. no mock responses or seeded fixtures. - ran the real migration cli against the same sqlite backup on both revisions, with source secrets/settings present in each destination. main retained a reachable peer link. the pr showed "no linked environments" in the running client and returned
[]fromt3 environment list. - opened the retained conversation and resumed codex. it recalled its prior response, then successfully ran
git rev-parse --is-inside-work-treeandgit status --shortthrough the provider tool path. - created a fresh link on the pr, restarted the server, confirmed it remained reachable, then removed it with "forget" and confirmed the empty state. the source database still retains its original link and conversation.
short runtime transcript (counts immediately after migration, before pairing the destination):
| 1 | vp run migrate-dev-db --source <same-source>/statev2.sqlite --base-dir <isolated-destination> |
| 2 | source main copy pr copy |
| 3 | peer_environment_links 1 1 0 |
| 4 | threads 2 2 2 |
| 5 | messages 2 2 2 |
| 6 | auth_sessions 3 0 0 |
| 7 | |
| 8 | t3 environment list --base-dir <main-copy> --json |
| 9 | [{..."urls":["http://127.0.0.1:18181"],..."status":"reachable"}] |
| 10 | t3 environment list --base-dir <pr-copy> --json |
| 11 | [] |
blacksmith: all 7 migration tests passed. vp run check:changed 36dac688a17c6de1c6398e62d01546fb787c185b passed format, lint, both knip checks, graphql, affected typechecks, and 8 tests. existing ci reports 30 successful checks.
main copy, retaining the peer:
main dev database copy retains a reachable environment link
pr copy of the same data and secrets:
pr dev database copy has no linked environments
real codex tool turn after migration, then forgetting a freshly created link:
codex runtime and linked environment removal
Not verified
native desktop, ios/android, macos/windows, and cross-machine tailscale/t3 connect paths were not exercised on this linux vm. both environments used loopback. the automatic first-start seed trigger was not exercised; the real migrate-dev-db cli was. no remote agent delegation was started. the uploaded mp4 playback and seeking were checked in the t3 browser; the recording above is an animated gif for github compatibility. git.cafe currently displays external media as links.