Skip to content

fix(mobile): refuse phone tracker setup unless its destination host is confirmed - #52704

Merged
AmoabaKelvin merged 4 commits into
mainfrom
fix-tracker-setup-verified-host
Nov 30, 2026
Merged

AmoabaKelvin merged 4 commits into
mainfrom
fix-tracker-setup-verified-host

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

Connecting Linear or Jira from the phone saves your token on one specific computer. Before, if the phone couldn't confirm which computer that was, or the choice changed while you were filling in the form, the token could end up on another computer you own. Now the phone checks the destination right before sending. If it can't confirm it, or the destination changed, it stops and asks you to reconnect and try again.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​139 $\color{#cf222e}{\Huge{\mathbf{−}}}$​43 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​96

What Changed

  • Before: Linear and Jira setup on the phone bound the account host to a client instance when setup opened. Two things made it fail open, falling back to an untagged write that the desktop pins to its current default tracker host:

    • The desktop's settings couldn't be read when setup opened.
    • The client changed during setup (reconnect, repo-list reload).

    So a token (jira.connect, linear.connect) or a workspace choice (linear.selectWorkspace) could follow whatever the desktop's default was at submit time, not the host the user set up against.

  • After: tracker-account-host.ts, the one place both trackers use, binds a destination as setup opens. The destination is a host id, or "a desktop older than per-host tracker accounts, which stores the account itself", or "unconfirmed". Every account write then:

    • Refuses if the bound destination is unconfirmed.
    • Re-reads the destination right before the write and refuses if it can't be read or has changed.
    • Sends the write tagged with the bound host through the current connection. The desktop never re-routes a tagged account-setup call.
  • On refusal: the user sees "Couldn't confirm which computer saves this account. Reconnect, then try again." (in all 11 phone languages). The sheet stays open. A confirmed new destination becomes the one the next attempt checks, so retrying in the same sheet works. A failed read keeps the original binding.

  • Older phone apps that can't tag a host send untagged after the re-read confirms the destination. The desktop pins untagged account setup to that same host.

  • Linear workspace switch: reloads the Linear context after a failure, so the picker shows the workspace the desktop kept.

  • Linear status read: stays untagged, like the team and issue reads, so all Linear reads ask the same host. Writes only go out once the bound host is confirmed as that same tracker host.

  • Capabilities: the host capabilities used to scope the write are captured with the binding. That keeps the Linear context load off a capability-identity dependency, which would otherwise reload it on every status reply.

Why

The destination check belongs where both trackers decide where an account goes, not in each sheet. Tagging the write with a verified host id closes the gap between the check and the write for every current phone app, because the desktop won't move a tagged call. The only untagged cases left are legacy desktops (no per-host tracker accounts, so nowhere else to go) and phone apps too old to tag. Both are re-checked within one round trip of the write.

Linked Issue

STA-19691. Follow-up to #51202 (phone Jira setup), whose setup binding this hardens for both Linear and Jira.

Visual Proof

N/A. No new screens. The only visible change is the error line in the existing Connect Linear and Connect Jira sheets and the Linear workspace switch, shown only when the destination can't be confirmed.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • mobile/src/tasks/task-list/tracker-account-host.test.ts drives the real owner through a fake desktop that records each call's executionHost. It covers:

    • the token goes to the host bound at open, even through a newer client;
    • the write is refused when the destination was unreadable at open, unreadable before the write, or changed;
    • a retry in the same sheet succeeds after a host change, and after a transient read failure;
    • an older phone app sends untagged after confirmation;
    • a legacy desktop stores the account itself.

    With the old fail-open fallback restored, 3 of the refusal cases fail.

  • pnpm check:changed, the mobile typecheck and the mobile tests typecheck pass.

Performance

One extra settings.get per user-tapped account write: Linear connect, Jira connect, workspace switch. The one read when setup opens already existed. No timers, polls or subscriptions. The Linear context load keeps main's dependencies (client, connState, tasksSupported), so status replies with an equal capability list still trigger no reload. When nothing is being set up, there's no added work.

Risk

The riskiest part is refusing a write that would have worked: for example, a desktop whose settings read fails transiently as the user taps Connect. The user sees the reconnect message and the next tap goes through, and the guard never sends a write without a confirmed destination. A plain revert restores the old fail-open behaviour.

Level: Low

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • No store build is needed. Tasks is a host-served page.
  • Older desktops: a desktop that doesn't report trackerAccountHost (older than per-host tracker accounts) stores the account itself, as before. Current desktops always report it.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no new blocking issue was found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Phone setup now checks the account destination again before sending Linear or Jira account writes.

  • Phone tracker setup checks its destination before sending account writes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Open setup or workspace picker] --> B[Read and bind destination]
  B --> C[User submits]
  C --> D[Read destination again]
  D --> E{Both confirmed and equal?}
  E -->|No| F[Show error and keep setup open]
  F --> G[Keep confirmed destination for retry]
  E -->|Yes| H[Send write through current connection]
  H --> I[Tag destination when supported]
Loading

Reviews (4) · Last reviewed commit: "fix(mobile): keep Linear status reads on..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f252b9e1-6611-4b73-831f-23df0000fa18
Commits

Reviewing files that changed from the base of the PR and between 0b3b2a0 and a78a1d8.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Tracker account bindings capture the destination and host capabilities when setup opens. Writes validate the current destination and reject unconfirmed or changed destinations. Linear and Jira task flows use the write-routing API, while Linear status reads use the host client directly. Linear workspace selection reloads context after a failure. Tests cover destination changes, read failures, retries, and legacy clients. Eleven locale files add an unconfirmed-destination message.

Merge Risk: Minimal · previous review 0b3b2

This change makes mobile Linear and Jira setup refuse to save an account unless the destination desktop is confirmed and unchanged. No concrete merge-blocking defect was found. The main tradeoff is that a transient settings-read failure now asks the user to reconnect and retry.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: phone tracker (Linear/Jira) setup now refuses to write unless the destination host is confirmed. The changeset adds destination binding and write-time validation in tr…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template and covers all required sections: ELI5, What Changed (before and after, with mechanism), Why (including the alternative of tagging writes and why untagg…
Full details: Title check

Explanation

The title names the main change: phone tracker (Linear/Jira) setup now refuses to write unless the destination host is confirmed. The changeset adds destination binding and write-time validation in tracker-account-host.ts, and the title matches that. The title uses the conventional fix(mobile) prefix and is specific.

Full details: Description check

Explanation

The description follows the repository template and covers all required sections: ELI5, What Changed (before and after, with mechanism), Why (including the alternative of tagging writes and why untagged cases remain), Linked Issue (STA-19691, follow-up to #51202), Visual Proof (N/A with reason), Testing (manual testing, automated tests, and a description of the test cases), Performance (one extra settings.get per tapped account write, with reasoning), Risk (riskiest part, level Low, and revert path), and Notes and Checklist. The AI Disclosure section is empty. The template states it can be ignored for internal contributors, and the author's team membership is not confirmed, so this is a minor gap, not a blocker. The Linked Issue section uses the 'STA-19691' reference rather than a GitHub issue link ('Fixes #'), which the template says outside contributors must provide. The author appears to be an internal contributor, so this is not a blocker either. The description is mostly complete.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3119fe2-085f-46e8-a6b2-7b156fa52427
Commits

Reviewing files that changed from the base of the PR and between 78f091a and 0b3b2a0.

Files selected for processing: 3

  • mobile/src/tasks/screen-state/use-mobile-tasks-route-and-item-state.tsx
  • mobile/src/tasks/task-list/tracker-account-host.ts
  • mobile/src/tasks/task-list/use-mobile-tasks-provider-load-actions.tsx
Files with no reviewable changes: 1

  • mobile/src/tasks/task-list/tracker-account-host.ts
Files skipped from review as they are similar to previous changes: 1

  • mobile/src/tasks/screen-state/use-mobile-tasks-route-and-item-state.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

…sn't confirmed

Phone Linear and Jira setup bound the account host to a client instance and
fell back to an unscoped client when the desktop's settings couldn't be read or
the client changed during setup, so a token or workspace choice could follow
whatever the desktop's default was at submit time. Setup now binds the
destination host id as it opens, re-reads it right before the write, and sends
the write to that host through the current connection. When the destination
can't be read, changed, or can't be reached, the write is refused and the
sheet asks the user to reconnect and try again.
…eep it across a failed read

Reading host capabilities inside loadLinearContext reloaded the Linear context
whenever a status reply landed with an equal capability list. The binding now
carries the capabilities it was taken with, and a refusal caused by an
unreadable destination keeps the bound host so the next attempt succeeds.
…d issue reads

The setup binding now survives a reconnect, so reading Linear status through it
could ask a different host than the team and issue reads after the desktop's
default changed. Status reads go untagged with the rest; account writes still
only go out after the bound host is confirmed as the current tracker host.
@AmoabaKelvin
AmoabaKelvin force-pushed the fix-tracker-setup-verified-host branch from 0b3b2a0 to a78a1d8 Compare November 29, 2026 23:35
@AmoabaKelvin
AmoabaKelvin merged commit 0fbb7c2 into main Nov 30, 2026
29 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