Skip to content

fix(mobile): scope the tour's new session to the active organization - #8259

Merged
iscekic merged 2 commits into
mainfrom
drain/tour-keeps-organization
Oct 21, 2026
Merged

iscekic merged 2 commits into
mainfrom
drain/tour-keeps-organization

Conversation

@iscekic

@iscekic iscekic commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

What changed

The first-sign-in tour's hand-off now carries the active organization into the
new-session route.

apps/mobile/src/components/tour/tour-screen.tsx read no organization and
built /(app)/agent-chat/new with at most preselectRunOn. The form derives
its whole scope from that route param (app/(app)/agent-chat/new.tsx to
NewSessionScreenBody), so the tour path opened Personal: the personal
listGitHubRepositories call answered integrationInstalled: false, the form
rendered the connect-GitHub prompt, the repository picker was empty, and Start
stayed disabled. Home avoids this by passing the organization in
components/home/new-task-button.tsx.

The hand-off now appends organizationId from useOrganization() when one is
active, before preselectRunOn, using URLSearchParams. Personal passes no
param, which is the form's own default. The Tour screen comment states why the
scope travels in the route.

Mounted tests cover the org-scoped href for both cards, the Personal fallback,
and the replay path; the mocked context keeps the shell's contract separate
from the provider's restore path, which has its own suite.

Verification

  • pnpm --filter kilo-app exec vitest run src/components/tour/tour-screen.mounted.test.tsx - 11 passed.
  • pnpm --filter kilo-app run typecheck - clean.
  • pnpm --filter kilo-app run lint - 0 warnings, 0 errors.
  • oxfmt --list-different on the two files - no output.

Android end to end on this VM (dev stack, dev-client artifact, seeded fixture:
one organization with an org-owned GitHub integration and a cached repository
snapshot, zero-usage account):

  • Before the change, Profile - Tutorial replay - Cloud Agent opened the form at
    personal scope: cloudAgentNext.listGitHubRepositories (personal) in the web
    log, a "Connect GitHub" card in the repository section, Repository: Select repository, Start session disabled.
  • After the change, the same replay path calls
    organizations.cloudAgentNext.listGitHubRepositories in the web log; the
    repository picker lists the organization repository under a GITHUB heading,
    selecting it shows Repository: GitHub - drain-e2e-labs/notes, and
    Start session enables once the prompt is set.

Screenshots of the before/after form and the picker are in the PR comment
below.

Proxy answers

The owner's proxy gave these answers in the owner's place.

  1. Question: Org readiness: The tour can hand off before the organization context finishes restoring (cold boot right after consent), in which case organizationId is still null. How should the hand-off behave?
    Answer: Pass the org when known, unchanged otherwise
    Confidence: 0.65 - Precedent: Put each separate concern in its own PR (debabfb38c82: "in a separate PR"). The fallback in agent-chat/new.tsx already belongs to open PR feat(mobile): show the active organization where sessions start #8083, so do the least work here (7f3470e0ba6f: "do the least amount of work possible, with no drop in quality").
  2. Question: Stale prompt: The finding's observation also notes a prompt carried in from the previous draft. The new-session draft is stored per account (shared across personal and organization scopes by design) and the work item's expected behavior does not mention it. Include a change?
    Answer: Leave the draft behavior unchanged
    Confidence: 0.70 - Precedent: Keep each PR diff to files that the feature needs (df491946927a: "PR should be checked for stray changes before merging"). The shared per-account draft is deliberate behavior, not a defect.
  3. Question: Test mocking: How should the mounted tour test supply the organization?
    Answer: Mock @/lib/organization-context in the mounted test
    Confidence: 0.75 - Precedent: Do the least work possible with no drop in quality (00eb2a1d3e4b: "skip work that doesn't need to be done"). The real restore path gets its proof from the Android emulator e2e run instead (55c9c80332a7: "logs and/or screenshots are mandatory proof").

@iscekic iscekic added drain Work item from the findings drain explorer:android Finding surfaced by the Android explorer labels Oct 20, 2026
@iscekic

iscekic commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Android end-to-end captures from the local dev stack on the work VM, using an owned fake account whose organization has an org-owned GitHub integration fixture. Same replay path in every capture: Profile - Tutorial - Cloud Agent.

  • Before: the hand-off opened the form at personal scope. The repository section offers Connect GitHub and the footer reads "Connect a provider to start."
  • After: the repository picker lists the organization repository under a GITHUB heading, and the form shows the selected organization repository with Start session enabled once the prompt is set (the branch row reports it could not load branches because the fixture installation has no live GitHub credentials, which is expected in this environment).

The web log for the same tap shows organizations.cloudAgentNext.listGitHubRepositories after the change and cloudAgentNext.listGitHubRepositories (personal) before it.

Before: form opened at personal scope with a Connect GitHub card and no repository

After: organization repository selected in the new-session form

After: repository picker listing the organization repository under a GITHUB heading

After: form scrolled to the footer with Start session enabled

@kilo-code-bot

kilo-code-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The tour hand-off now appends the active organization id via URLSearchParams, matching Home's new-task route, and the mounted tests cover the org-scoped, Personal, and replay paths; no defects were found in the changed lines.

Files Reviewed (2 files)
  • apps/mobile/src/components/tour/tour-screen.tsx
  • apps/mobile/src/components/tour/tour-screen.mounted.test.tsx

Reviewed by deepseek-v4.1-flash-1017 · Input: 82.4K · Output: 10.6K · Cached: 1.3M

Review guidance: REVIEW.md from base branch main

@iscekic iscekic added merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. merge:human Substantive functional risk requires human review. and removed merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. labels Oct 20, 2026
@iscekic iscekic added merge:blocked merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. merge:human Substantive functional risk requires human review. and removed merge:human Substantive functional risk requires human review. merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. merge:blocked labels Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drain Work item from the findings drain explorer:android Finding surfaced by the Android explorer merge:human Substantive functional risk requires human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants