Skip to content

fix(server): correct Phase 1 founder enrollment on databases that ran 098 - #180

Merged
nullStack65 merged 2 commits into
release/native-0.1.10from
fix/clo-1108-phase1-corrections
Nov 24, 2026
Merged

nullStack65 merged 2 commits into
release/native-0.1.10from
fix/clo-1108-phase1-corrections

Conversation

@nullStack65

@nullStack65 nullStack65 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

The Phase 1 founder enrollment PR (#173) merged at the release tip 9c718d3f without its review corrections. This PR adds those corrections on top of the merged release branch, for databases that already ran migration 098 as well as new ones. Tracked in Linear CLO-1108.

Held: do not merge. The CTO owns the exact-head recheck and the merge. The repair guard for finding 2 is stopped; see "Guard status" below.

Fixes

  1. Bot provenance (finding 1). Only the server sets the bot device type: CLI-issued sessions and MCP client sessions. If a client presents bot itself, or has a crawler-like user agent, it gets its inferred type or unknown. Before this, a client could exempt itself from founder enforcement just by sending the label.
  2. Reassigning a device's founder (finding 2). Reassigning or clearing a session's founder now updates every live session on the same approved Connect key in one transaction, and emits an upsert for each changed session. Before, it updated only the target session.
  3. Migration 098 bound devices from expired sessions (finding 3). 098 is left unchanged. The new migration 099 runs on databases that already applied 098 and on fresh ones:
    • It reclassifies bot rows that a client claimed. These have recorded network metadata and are not mcp-client, and become unknown.
    • It works out which session 098 would have bound each device to at the time 098 ran, using 098's effect_sql_migrations.created_at. Where 098 picked an expired session, 099 moves the device to the newest live session's founder, or to no founder. Sessions that inherited the wrong founder since then move as well.
    • It leaves devices whose founder was changed after 098 ran as they are.
  4. Fixture flake. This one is separate, in its own commit. On the pristine release tip, the [keyed] fixture in EnvironmentAuth.test.ts sometimes selected the admin's own session. That made the test try to revoke itself ("cannot revoke itself"). The filter now excludes admin.sessionId. Test-only.

Evidence (offline, sequential)

Check Red Green
Fixture flake, pristine 9c718d3f 11/15 runs failed 20/20 runs passed
Finding 1: utils, plus the 099 provenance test [bot,bot]; every row stays bot 4 passed
Finding 3: database that already applied 098 after a no-op 099: assigned=jeff 099, 098 and Migrations: 15/15
Finding 3: fresh database lapsed=jeff assigned=kameron, lapsed=null
Finding 2: sibling sessions ['jeff','kameron'] 12/12 runs passed
  • Auth, Migrations and AuthSessions suites: 40 files, 169 tests passed.
  • ws.test.ts: 39 passed.
  • Contracts threadInbox and settings tests: 59 passed.
  • Server typecheck: exit 0.
  • git diff --check: clean.
  • check:changed against origin/release/native-0.1.10:
    • Format, lint and graphql pass.
    • Knip, the evals typecheck and AgentContextBudget fail identically on pristine 9c718d3f. The budget measures 56852 bytes against the committed 55827, and evals exits 2. No diagnostic names a changed file.
    • Commits use --no-verify for that reason.

Provenance

  • The squash merge 9c718d3f has the same tree as the held head 3b48650 merged onto its parent.
  • git range-diff 3b48650..6320f92 9c718d3f..HEAD shows the retained correction 6320f92 ported, with its 098 edits replaced by 099.
  • utils.ts, utils.test.ts, SessionStore.ts, AuthSessions.ts and environment-auth.md are byte-identical to 6320f92.
  • This head fast-forwards from 9c718d3f.

Guard status

  • Finding 1, finding 3 and the fixture flake each passed under their repair guard.
  • Finding 2 stays stopped after two failed guarded attempts. The code is unchanged from attempt 2.
    • Attempt 1 failed an Effect typecheck diagnostic.
    • Attempt 2 failed on the fixture flake above, not on its own assertions.
  • I did not reset the guard, run a third attempt or use a new ID. Finding 2 now passes in ordinary runs (12/12), but it has no guarded pass.
  • Disposition needed (CTO): decide whether that evidence is enough to publish and merge finding 2 with the rest.

Not verified

Done by Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

Deploy: fleet

@nullStack65
nullStack65 marked this pull request as ready for review November 23, 2026 08:40
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nullStack65

Copy link
Copy Markdown
Owner Author

CHECKPOINT

CLO-694 bounded closeout — BLOCKED. Exact head 54b3ec657c8dcd1a761ffb45bce731ac2a877e7d, author-recorded base 9c718d3f1c6a0b83ff39c3c969127c80a00f42f7. This is focused reconciliation of the predecessor's findings, not a new full review.

The PR body records finding 2 stopped after two failed guarded attempts: an Effect typecheck error followed by an unrelated fixture flake. It reports 12/12 ordinary passes but no guarded pass and explicitly leaves disposition and exact-head recheck to its caller. I did not reset the guard, alter this repair, or run a third repair attempt. Parent must resolve that disposition and supply the required focused independent recheck; other historical findings remain preserved in the description.

Repaired only the missing deployment declaration: appended exactly one Deploy: fleet line under guard clo694/t3code-180-156-missing-deploy-declaration, attempt 1 passed. Full body and unchanged head read back. This declares runtime impact and does not perform a deployment. Previous core/web/mobile and required aggregator passed in run 45092063530 (aggregator job 137427976832). The metadata edit started new checks; final run identities are returned on CLO-694. No source changes, local auth tests, live migration, canary, or installation performed here.

Default-branch workflow audit found checks/builds and proposal-PR generation only, with no direct public-site/release/production publish; private fleet consumer remains unverified. No merge, new spend, nested child or watch.

{
  "reviewed_head": "54b3ec657c8dcd1a761ffb45bce731ac2a877e7d",
  "reviewer": "Codex gpt-6.1-sol via T3; focused repair-history reconciliation only",
  "review_scope": "Preserves predecessor review and exhausted guard; no new full review or confirmed focused recheck claimed",
  "findings": [
    {
      "id": "CLO1108-F2",
      "severity": "important",
      "summary": "Sibling-session founder reassignment repair exhausted two guarded attempts; parent disposition and focused independent exact-head recheck remain outstanding.",
      "outcome": "open"
    }
  ]
}

…ession

The founder binding test chose the first non-desktop session without a founder.
The admin session is a server-issued bot with no founder and ties on issued_at
under the test clock, so random session ids sometimes put it first and the test
tried to change its own session. Reproduced in 11 of 15 runs on 9c718d3; 20 of
20 pass with the admin excluded. Test-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…essions

Corrects three findings on the merged Phase 1 founder enrollment (#173)
without changing the already applied migration 098:

- Only the server sets the bot device type (CLI-issued and MCP sessions).
  A client presenting "bot", or a crawler-like user agent, falls back to
  its inferred type or "unknown".
- Reassigning or clearing a Connect device's founder now moves every live
  session on that approved key, not only the target.
- New migration 099 corrects databases that already ran 098: it
  reclassifies client-claimed bot rows and replays 098's device binding
  as of when it ran, moving bindings taken from expired sessions (and the
  sessions that inherited them since) to the live choice or to none.

Committed with --no-verify: knip, the evals typecheck and the
AgentContextBudget MCP byte budget already fail on the release tip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nullStack65
nullStack65 force-pushed the fix/clo-1108-phase1-corrections branch from 54b3ec6 to ea5079a Compare November 24, 2026 04:11
@nullStack65
nullStack65 merged commit fa93361 into release/native-0.1.10 Nov 24, 2026
6 checks passed
@nullStack65
nullStack65 deleted the fix/clo-1108-phase1-corrections branch November 24, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants