Skip to content

feat(onboarding): record when a person first opens Bring your own - #2197

Merged
lilyshen0722 merged 1 commit into
mainfrom
growth/onboarding-byo-opened
Oct 15, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
growth/onboarding-byo-opened

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds a third write-once first-session mark beside podOpenedAt (#2170) and the first-start pick (#2194): User.onboarding.byoOpenedAt, the first time a person opens the Bring your own page.

Why

We can see that someone opened their workspace (#2170), and we can see whether they generated a token. We can't see whether they ever looked at setup. A new signup who never generates a token is either "never opened Bring your own" or "opened it and left", and those call for different fixes. A 10-15 signup is exactly this case.

How

Tests

  • onboardingMarks.test.js:
    • a new markByoOpened block: write-once filter and $set shape; no person, no write; one write per person per process; a failed write is retried and never throws;
    • a new "three marks together" block: the marks never suppress each other, and the reset seam forgets all three.
  • hosted.test.js: /availability calls the mark with the caller's id and still answers 200.
  • Mutation checks, re-run after the rebase:
    • dropping byoOpenedMarked.clear() from the reset seam fails 4 tests;
    • dropping $exists from the filter fails 2;
    • before the rebase, dropping the call from the route failed the route test.
  • Ran locally at the rebased head: these two suites plus messageController.test.js (the feat(onboarding): record when a new person first opens their own workspace #2170 and feat(first-session): Scout's welcome offers two starts as buttons (direction B) #2194 call site), 59/59. eslint shows 0 errors (the warnings are existing long lines), and tsc shows nothing on the changed files.

🤖 Generated with Claude Code

https://claude.ai/code/session_018ajWuL8XiGBSHWiurjqm7B

A third write-once first-session mark beside podOpenedAt (#2170) and the
first-start pick (#2194): User.onboarding.byoOpenedAt, set the first time a
person loads the Bring your own page. It is read server-side from the page's
own load request, GET /api/hosted/availability, which nothing else calls, so
it needs no client event and no analytics vendor. It splits "never looked at
setup" from "looked and left", which today we cannot tell apart.

markByoOpened follows the existing marks exactly: its own in-process set, the
write-once database filter, bots excluded, and failures never reach the
request. The reset seam clears all three sets. A comment at the page's call
site says the request carries the mark.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018ajWuL8XiGBSHWiurjqm7B
@samxu01
samxu01 force-pushed the growth/onboarding-byo-opened branch from ab7c3e3 to a93f837 Compare October 15, 2026 11:35

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Written by Sprint Review, a Commonly agent — gate requested in pod thread 77624.

Gated at a93f837f590cad64ab9e952b37ae526b0f14ad1c. All 14 checks pass, 2 skipping; backend .ts eslint 0 errors. All three properties hold, each pinned. One coupling worth naming.

The claim reproduces

run result
BASE — onboardingMarks + hosted 2 suites, 35 tests
main's service + route 7 failed / 28 passed
the four markByoOpened arms, both the three marks together arms, and records the caller's first visit to Bring your own (the mark contains its own failures) in the route suite
RESTORED 35/35, clean
mutation site result
N1 — the bot exclusion is dropped 1 2 failed — …never for bots, and the independence arm
N2 — the write-once clause is dropped 1 2 failed — the same two
N3 — the in-process short-circuit is dropped 1 1 failed — one write per person per process, however often the page reloads its availability
N4 — a failed write is not retried 1 1 failed — a failed write is retried on the next visit…
N5 — the route stops recording the visit 1 1 failed — the route arm

Only a person, only once, never bots

  • Only once, two ways: the filter carries 'onboarding.byoOpenedAt': { $exists: false } so the database refuses a second write, and byoOpenedMarked saves the query on repeat loads. N2 and N3 pin them separately, which matters — the Set alone would be per-process and the filter alone would cost a query per page load.
  • Never for bots: isBot: { $ne: true }, and N1 shows it is load-bearing. I checked whether it is actually reachable rather than decorative, because that is where I would expect a telemetry filter to be theatre. It is reachable: auth rejects cm_agent_* and cm_daemon_* outright, but still accepts a plain cm_ User.apiToken, and issueUserTokenForInstallation mints exactly that onto an agent's own User row — so a bot holding a user-token can call this route, and the filter clause is the only thing between that and a bot row growing an onboarding timestamp. Same conclusion I reached for markPodOpened on #2170, and consistent with it.
  • Only a person: if (!id) return short-circuits a missing caller (N5's sibling arm no person, no write covers it), and the route is auth-gated, so an unauthenticated load never reaches the mark.
  • Fail-open: the updateOne is not awaited, the .catch releases the Set so the next visit retries, and a synchronous throw is contained — so a telemetry stall can never delay or break the availability read the page needs. N4 pins the retry half.

The write-once filter keys existence on byoOpenedAt, the single field it sets, which is simpler than firstStartId/firstStartAt's pair and consistent with podOpenedAt. Placement is right: markByoOpened runs before res.json, fire-and-forget, so it adds nothing to the response path.

The one coupling: the mark's meaning lives in a fact nothing enforces

Unlike its two siblings, this mark has no second condition — markPodOpened and markStartPicked both require pod.createdBy === userId, while this one marks on any authenticated GET of /api/hosted/availability. That is correct for what it means, and it rests entirely on the sentence in the docstring: "which nothing else calls".

I verified that, and it holds today — exactly one caller in the whole tree, V2AgentBYO.tsx:288. But it is ambient: the day anything else probes availability — an agents-list badge deciding whether to show "Run it here", a prefetch, a dashboard tile — byoOpenedAt silently stops meaning "opened the Bring your own page" and starts meaning "the app asked about hosting", with every test still green. The PR already put a comment at the call site telling that page's next editor not to move the request, which is the right half of the mitigation; it cannot reach someone adding a caller elsewhere.

Cheapest ways to make it enforce itself, in order of how little they cost: a test asserting /api/hosted/availability has exactly one caller in frontend/src (the same shape as #2194's writer-side arm, which is what made that mark's boundary self-checking); or a ?from=byo the mark keys on, so a new caller has to opt in to being counted. Not a reason to hold — the mark is correct as merged and the failure mode is a slow drift in meaning rather than a wrong write.

GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit f897892 Oct 15, 2026
24 checks passed
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.

1 participant