Skip to content

fix(server): attribute founders from the session binding; quiet standing desks - #173

Open
nullStack65 wants to merge 3 commits into
release/native-0.1.10from
fix/clo-1108-founder-attribution-and-inbox
Open

nullStack65 wants to merge 3 commits into
release/native-0.1.10from
fix/clo-1108-founder-attribution-and-inbox

Conversation

@nullStack65

@nullStack65 nullStack65 commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

This PR fixes three things from the founder attribution audit item, A-P1-04 (Linear CLO-1108): who spoke, standing desks flooding Action, and mobile threads with no inbox. It also carries out Phase 1 of the verified founder identity research posted on that issue. Founder identity comes from a server-side binding made when a client enrolls, never from the client and never from a guess. Stock mobile needs no change.

Problem

  1. sentBy.founder is null on every live message. Every live auth_sessions.founder row is NULL; no client has been assigned to a founder. feat(web): show who spoke and keep each founder's place #157 (show who spoke) papered over this by crediting any unassigned person's session to this machine's ownerFounder. The research rejects that: on a shared environment it records Jeff's messages from his paired desktop, or a cloud-connect phone, as Kameron's, and makes the null count look better while attributing the wrong founder.
  2. Standing desks crowd Action. All five standing desks (CoS, CTO, CEO, CFO, Product Designer) are stored as attentionKind: "action" with reason conversation and no open decision, so they sit in Kameron's Action lane all the time.
  3. Mobile threads land in no inbox. Web and desktop send inboxOrigin from the client's founder setting. Stock mobile has no such setting, so it sends none, and the orchestrator creates no inbox for a person's thread without an origin.

Fix

  • Identity comes only from the session binding (security item S1-02):

    • messageSender in ws.ts is the session's own sender. The owner credit (creditUnassignedSender) is removed, so an unassigned session records founder: null rather than a guessed founder.
    • A new creatorInboxOrigin in packages/contracts/src/threadInbox.ts decides who a person's new thread is filed under. A session assigned to a founder files as that founder, overriding whatever origin the client claims. ws.ts applies it to both thread.create dispatch and launchThread. An unassigned session keeps the client's own choice (today's behavior) and is never filed under the machine owner. A failed session read keeps the claim, so a lookup failure doesn't block thread creation.
    • This is how a mobile thread lands in its creator's inbox: once that phone's session is assigned to its founder, its threads file there with no mobile change.
  • Standing desks read as FYI in projectThreadInbox unless a decision request is open, or a runtime approval or user-input request is waiting on a person. Either one puts the desk back in Action. The stored inbox is unchanged. This is projection only, so it applies to existing desks with no migration. ProjectionStore passes standing at all three shell projection sites. Desks still show in the owner's view, with the FYI dot.

  • A founder is bound when a client enrolls, never inherited (Phase 1, second commit):

    • A pairing code can name the founder it enrolls. The pairing dialog in Settings → Sharing & access has a Founder picker. The session the code starts carries that founder.
    • An approved T3 Connect device key keeps its founder. Assigning a founder to a Connect session also binds the device, so the hourly renewals keep the same founder with no change to the mobile app. Revoking the device deletes its row and clears the binding, so a device that signs in again starts as unknown.
    • Removed: inheritance from the shared desktop-bootstrap session, from a prior session with the same proof key, and from the session being replaced. Any of these could hand one founder's name to whoever holds the next session.
    • Agent sign-in codes (MCP access) drop any founder, and bot sessions never get one.
    • Migration 098 adds founder to auth_pairing_links and auth_connect_devices. It copies each device's newest live assigned session founder onto the device, so devices assigned since feat(web): show who spoke and keep each founder's place #157 stay assigned.
  • Fail closed, behind a switch. The new Require enrolled founders setting in Settings → Sharing & access is off by default, and changing it needs access:write. When it is on, ws.ts refuses message.dispatch, queued-run.edit, runtime-request.respond, thread.create and launchThread from a person's session with no founder, before anything is queued. A failed settings or session read also refuses. Bots are unaffected. The rule is refusesUnenrolledSender in threadInbox.ts.

Behavior change to know before merging

Until each client is assigned to its founder, new messages from unassigned sessions record founder: null again. That includes this laptop's own desktop app. Since #157, those sessions were credited to Kameron. This is deliberate: the research treats an honest unknown as better than a wrong founder. The fix is enrollment, not a fallback. Pair new devices with a founder's code, or assign existing ones in Settings → Sharing & access from a different admin client, since a session can't assign itself.

Desktop tradeoff. With desktop-bootstrap inheritance gone, each new desktop app session starts unknown until it is assigned from another client. So keep Require enrolled founders off until every device, including the desktop app, is assigned and the device canary passes. Turned on early, it blocks the desktop app from sending. Phase 2 (WorkOS AuthKit) is what gives the desktop a durable sign-in.

Shared device / joint session (spec)

One session is bound to exactly one founder. Each founder uses their own enrolled session: a separate app install, device, or desktop/browser profile. A jointly used session can attest to only the founder it was assigned to, and taking turns typing in it does not give per-person attribution. The other founder uses their own enrolled session, or signs in on web, for anything consequential.

Not in this PR (remaining follow-ups)

  1. Device canary. Pair and approve a stock iOS and Android store build, assign each, and confirm renewal keeps the founder before turning on Require enrolled founders. Not run here.
  2. Re-check the principal on every protected RPC, and close open sockets when a session is revoked. Today the check runs when the command arrives.
  3. Authorize client-requested inboxRouting against the principal.
  4. Block one founder from answering a decision meant for the other. That needs per-founder reply tracking.
  5. An account ID can't be the binding unit yet: the host stores one linked T3 Connect subject, so the device key is the unit.
  6. A bot session holding access:write can still mint a founder-named pairing code over HTTP. The MCP path is blocked.

Phase 2 (WorkOS AuthKit Google sign-in for web and desktop) and the bot-to-bot collapse and /note work are in a separate lane.

Tests

Extended the existing cases in packages/contracts/src/threadInbox.test.ts:

  • creatorInboxOrigin: an assigned session overrides any client claim; an unassigned session keeps the client's choice and gets no guessed owner; bot claims are untouched.
  • Standing desk: FYI and not active-while-working by default; Action again with an open decision request or a pending runtime request; non-standing threads are unchanged.

Both cases fail against the base threadInbox.ts (missing export, and the desk stays action) and pass with this change. The creditUnassignedSender tests are removed along with the helper.

Phase 1 tests (second commit):

  • apps/server/src/auth/EnvironmentAuth.test.ts, new case "binds a founder only from its pairing code or its approved Connect device": a pairing code's founder reaches the session; an agent code drops it; a new desktop-bootstrap session and a reused proof key don't inherit; a Connect device keeps its founder across renewal and loses it on revoke. It fails on the base, at the pairing-code assertion. With that block removed it fails again on the base, at the desktop-inheritance assertion ('jeff' where null was expected).
  • apps/server/src/persistence/Migrations/098_FounderEnrollmentBindings.test.ts: the backfill picks the newest live assigned session and skips revoked and unassigned ones.
  • threadInbox.test.ts: refusesUnenrolledSender refuses only when the setting is on, for a person with no founder, on founder-attributed commands.
  • serverSettings.test.ts: changing requireFounderIdentity needs access:write.

Run locally at head 3b486509:

  • apps/server: src/auth/ plus serverSettings, Migrations and migration 098, 209/209 pass. ws.test.ts 39/39 pass.
  • packages/contracts: threadInbox.test.ts and settings.test.ts 59/59 pass.
  • apps/web: settingsSearch.test.ts 24/24 pass. scripts/feature-map.test.ts 4/4 pass.
  • Typecheck: contracts, server, web and mobile are clean. Format and lint are clean on all changed files, apart from the base lint below.

Run locally at head 88584848d9 (first commit):

  • packages/contracts threadInbox.test.ts: 23/23 pass. The inbox invariants and upgrade suites also pass, 31/31 across the three files.
  • packages/shared seenMarker.test.ts: 5/5.
  • apps/server ws.test.ts, ThreadEventAlerts, ThreadLaunchService, ThreadSettlementService, ProjectionSettlement and HumanNote: 223/223.
  • Typecheck: contracts, shared and server are clean. Format: clean on all changed files.

Failures already on the base (not fixed here)

vp run check:changed origin/release/native-0.1.10 and the pre-commit hook also fail on the base commit 18cf8f27f1. None of the failures are in code this PR changes. The commit used --no-verify for this reason.

  • Lint: threadInbox.test.ts:528 and :537 (no-inline-schema-compile; they were :505 and :514 before the new test case), from feat(threads): quiet shared bots until a founder is asked #159. The native-title lint on the founder select in AuthorizedClientsSettings.tsx was also already on the base. It is fixed here because this PR edits that file, and the select now uses the shared Tooltip.
  • Knip: 4 unused files and 24 unused exports, all in code outside this PR. One is INBOX_CAPABILITY, which is already in threadInbox.ts.
  • Typecheck: evals/mcp-tool-use/run.ts:2768 and run.test.ts:1152.
  • AgentContextBudget.test.ts: mcpToolListJsonBytes measures 56852 against a 55827 budget. It fails the same way with this change removed.
  • Browser tests in check:changed can't start locally, because the Playwright Chromium executable is missing. CI runs them.

Deploy note

The live laptop runs 3ad1bfdd, which predates #157. After this lands and deploys, attribution is non-null only for sessions enrolled with a founder's pairing code or assigned in Sharing & access. Require enrolled founders stays off until someone turns it on.

Deploy: fleet

Model and harness: Claude Opus 5.5 (claude-opus-5-5) in Claude Code, run from T3 Code.

🤖 Generated with Claude Code

…ing desks

Founder identity now comes only from the session's server-side binding.
The machine-owner credit for unassigned sessions is removed, so an
unassigned session records founder: null instead of a guessed founder.
A person's new thread is filed under their session's founder, overriding
any client-claimed origin, so mobile threads land in their creator's inbox
once that session is assigned. Standing desks project as FYI unless a
decision request or a runtime request is open.

Refs CLO-1108 (founder attribution audit item A-P1-04).

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

Copy link
Copy Markdown
Owner Author

Checkpoint: founder attribution, standing desks and mobile inbox (CLO-1108)

  • Scope: the attribution and inbox fix from the founder attribution audit item (A-P1-04). Phase 1 identity rule: founder identity comes only from the server-side session binding.
  • Base: release/native-0.1.10 at 18cf8f27f1. Head: 88584848d99d7e82878d0628946f0c206078ee93.
  • Result: the PR is open for Kameron's review and is not merged. Local results:
    • contracts inbox tests: 31/31 pass;
    • shared seen-marker tests: 5/5;
    • server suites, including ws and launch: 223/223;
    • typecheck of contracts, shared and server: clean.
  • Proof: the new tests fail on the base threadInbox.ts (missing export, and the desk stays action) and pass with this change.
  • Base failures not fixed here: lint at threadInbox.test.ts:505/514, knip, the evals typecheck and the MCP size budget test. They are listed in the PR body. The commit used --no-verify because of them.
  • Not verified:
    • no device canary on real iOS or Android builds;
    • CI hasn't run yet;
    • the pairing-grant and device-key binding and fail-closed enforcement are follow-ups.
  • Return path: the Linear connector in this session is read-only, so this PR comment is the durable record.

@coderabbitai

coderabbitai Bot commented Nov 22, 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

… history

A session's founder now comes only from the pairing code that enrolled it, the
approved T3 Connect device key it signs in with, or an assignment made from
another client. Sessions no longer inherit a founder from the shared desktop
bootstrap, a reused proof key, or the session they replace, which could hand
one founder's name to someone else. Revoking a Connect device clears its
founder; agent sign-in codes and bots never carry one.

The pairing dialog picks the founder a code enrolls. A new "Require enrolled
founders" access setting (off by default, needs access:write) makes the server
refuse messages, approval answers, and thread starts from unenrolled people.

Migration 098 adds founder columns to pairing links and Connect devices and
keeps existing device assignments.

Committed with --no-verify: the hook fails on checks already failing on
release/native-0.1.10 (threadInbox.test.ts Schema.is lint from #159, knip,
evals typecheck, AgentContextBudget).

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

Copy link
Copy Markdown
Owner Author

Checkpoint: Phase 1 founder identity (CLO-1108), head 3b4865098e756f07853912e3d5e8cf88dfacdb66

Scope: verified founder identity for the founder attribution item (A-P1-04, Linear CLO-1108). Founders are bound to a pairing code or an approved T3 Connect device key on the server. Inheritance from earlier sessions is removed. The Require enrolled founders switch (off by default) refuses founder actions from people with no founder.

Commits:

  1. bdf9798698: the server binding, migration 098, the setting and the ws.ts refusal, the web founder picker and switch, and docs.
  2. 3b4865098e: the feature map entry.

Observed locally (sequential runs):

  • Server auth, settings and migrations: 209/209 pass. ws.test.ts: 39/39 pass.
  • Contracts: 59/59 pass. Web settings search: 24/24 pass. Feature map: 4/4 pass.
  • Typecheck is clean for contracts, server, web and mobile.
  • The new EnvironmentAuth founder test fails on the base twice, at the pairing-code assertion and at the desktop-inheritance assertion, and passes with the fix.
  • check:changed still fails only on checks that already fail on the base: the feat(threads): quiet shared bots until a founder is asked #159 Schema.is lint, knip, the evals typecheck and AgentContextBudget. Playwright Chromium is missing locally, so browser tests didn't run.

Not verified: CI on this head, the stock iOS and Android device canary, and a live deploy. Not merged. Kameron is the only human reviewer.

Linear: the Linear connector here is read-only, so this checkpoint isn't on the Linear issue.

This branch has not been deployed

No deployments
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