fix(server): dev database copies drop links to other environments#27313

merged1
main
maria/takeover-pr-27127
opened1d agobyMmaria
View on GitHubTwo-way sync enabledPR last imported 5h ago

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 36dac688a17c6de1c6398e62d01546fb787c185b passes 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

23 successful · 14 skipped
All checks passed
14f0229

Added 1 commit

  • fix(server): dev database copies drop links to other environments14f0229
Synced from GitHub

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.

Synced from GitHub

Review in Change Stack →

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.md
peer_environment_links is added to CLEARED_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

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 nameStatusExplanationResolution
Description checkWarningThe 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 nameStatusExplanation
Title checkPassedThe title clearly identifies the server fix: development database copies no longer retain links to other environments.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck 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

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.

Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB+6 B (+0.1%)6.8 KiB✅
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
CodexLive turn WebSocket wire1.2 KiB1.3 KiB+6 B (+0.5%)2.0 KiB✅
CodexLive turn WebSocket decoded21.6 KiB21.6 KiB0 B (0.0%)24.4 KiB✅
CodexLive turn messages220 (0.0%)8✅
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
ClaudeLive turn WebSocket wire1.3 KiB1.3 KiB0 B (0.0%)2.0 KiB✅
ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
ClaudeLive turn messages220 (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 codex gpt-6.1-sol turn, enabled linked environments, and linked an isolated real t3 serve environment 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 [] from t3 environment list.
  • opened the retained conversation and resumed codex. it recalled its prior response, then successfully ran git rev-parse --is-inside-work-tree and git status --short through 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):

text
1vp run migrate-dev-db --source <same-source>/statev2.sqlite --base-dir <isolated-destination>
2 source main copy pr copy
3peer_environment_links 1 1 0
4threads 2 2 2
5messages 2 2 2
6auth_sessions 3 0 0
7
8t3 environment list --base-dir <main-copy> --json
9[{..."urls":["http://127.0.0.1:18181"],..."status":"reachable"}]
10t3 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.