Skip to content

Waiting on you: list pairing steps that wait on the owner (#808 row 7, part 3) - #1443

Open
scuttletoby wants to merge 2 commits into
mainfrom
fork/needs-you-pairing
Open

scuttletoby wants to merge 2 commits into
mainfrom
fork/needs-you-pairing

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Part of #808 (row 7, part 3; after #1434 and #1436).

What: the "Waiting on you" page (the Issues entry while client.ownerQuestionsPage is on) gains a Pairing that needs you list:

  • A device waiting for approval. A saved machine (switched on in this app) where this device waits for approval: upstream's connection presentation marks it awaitingApproval, and its own text says where to approve it and shows the code. The row gives that text and the step (approve it on that machine's Settings → Connections, or from another device signed in to it).
  • A machine link that needs a new pairing code. A link one connected machine holds to another (its agents work there) that has expired, or ends within 5 days. This is upstream's own peerLinkHealth rule, the one Settings → Connections uses for "Expired. Link it again…" and "Expires in N days". The row names both machines and the step: link it again from that machine with a new pairing code from the linked one.
  • Each row has a Connections button. When only pairing rows wait, the empty state says "No owner question is waiting" rather than "Nothing is waiting on you".

How: every code file is fork-owned under apps/web/src/components/fork/ownerQuestions. There is no server change, no setting and no seam. The rule is pure logic in pairing.logic.ts. NeedsYouPairing.tsx reads the environment presentations the app already holds, plus each connected machine's link list (peerLinkListsAtom over usePeerLinkHosts(), the same reader Settings uses), and draws the rows. The page adds one hook call, one section line and the empty-title condition.

Left out on purpose:

  • A link that is only unreachable or failing is not listed. No pairing step fixes it, and Settings → Connections already shows it.
  • The links are listed once when the page opens, not on a timer, because listing probes every link. An expiry by time still shows, since it is worked out from expiresAt against the current minute.

State question:

  • Stale state: an approval row goes as soon as the connection leaves "waiting for approval", because it is read from the live presentation. Nothing is stored, so after a restart the page shows the current state.
  • A machine that is not connected is not asked for its links. A machine whose list is still loading lists nothing. A machine whose list failed is named ("Could not read the machine links of …"), so a missing row is never read as "nothing to do".
  • A link renewed elsewhere clears its row the next time the list is read.
  • There is nothing to answer, so nothing can be answered twice.

Merge note: #1434 and #1436 change the same empty-title line in WaitingOnYouPage.tsx and the same spot in docs/fork/about.md. Whichever merges later keeps all three conditions and all three lines. The README text here is a separate paragraph.

Tests: apps/web/src/components/fork/ownerQuestions/pairing.logic.test.ts (new; red on main because the module does not exist, 8 green here). The questions they answer:

  • Does a saved machine where this device waits for approval get a row, with the connection's words (where to approve, the code)?
  • Do a connected machine, a failing one, one switched off, and one in error stay off the list?
  • Is an expired link listed, whether its status says so or its end time has passed? Is a link ending within 5 days listed with the days left ("1 day" or "N days")?
  • Do a link with time left, an unreachable link and a failing link stay off the list?
  • Is a machine whose link list failed named, while one still loading lists nothing?
  • Are the rows sorted by machine, and is the count both kinds together?

Ran locally: the test file above, vp fmt and vp lint on the changed files, the apps/web typecheck, and the fork schema, upstream-files and seam checks.

Docs: docs/fork/README.md (a paragraph under client.ownerQuestionsPage), docs/fork/about.md, and the change file docs/fork/changes/app/808-waiting-on-you-lists-pairing.md.

Left for row 7: OS-only prompts ("needs you at " with the exact step) and agent guidance to avoid OS prompts.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: Claude Opus 5.5 (code lens r1) · read at: dce2565

blocker: none
major: none
minor: the approval row repeats itself. step says "Approve this device on X, in its Settings → Connections, or from another device signed in to it." and detail is upstream's own text, which starts with the same instruction ("Approve this device on {host}. It shows code {verificationCode}."). Consider showing only the code part, or the detail alone when it is present.
minor: the page's Refresh button re-reads owner questions only. The machine-link list stays as it was when the page opened, so a link renewed elsewhere keeps its row until the page is reopened. The PR body says this is on purpose. A one-line note near the rows, or having Refresh also re-read the links, would make that clear.
minor: when a machine connects or disconnects while the page is open, the peerLinkListsAtom key changes. The whole list goes back to "loading" for a moment, so the link rows can blink. This is harmless, and Settings uses the same reader.

Checked:

  • The rule matches upstream peerLinkHealth. An expired status or expiresAt <= now gives "expired". A reachable link ending within 5 days gives ceil(days) >= 1, so "expires in 0 days" cannot happen. Unreachable and failing links are left out, as the PR says.
  • An approval row needs the machine switched on, phase reconnecting and awaitingApproval. That is exactly how presentConnectionState sets it for approval-pending.
  • Only connected machines with read scope are asked for their links (usePeerLinkHosts). "loading" lists nothing and "failed" names the machine. The pairing section shows above every body state (questions unsupported, loading, error, empty), so it is not hidden when issues are unavailable.
  • The empty title switches only when pairing rows exist. The keys are unique per approval machine and per (host, linked machine) pair.
  • Tests: the new pairing.logic.test.ts covers each branch of the rule and fails on main, because the module does not exist there. The React wiring (index mapping from hosts to lists) is not tested, but it is the same pattern upstream's useLinkThroughRoutes uses.

State question:

  • Runs again: nothing is stored or written, so reopening the page or re-rendering it just works the rows out again from the live presentations and from the link lists read when the page opened. There is nothing to answer twice.
  • Stops half-way: an unmount drops the list atoms. The next open reads them again.
  • Old or empty state: with no saved machines and no connected hosts, the key is empty, the list is [], the section returns null and the old empty title stays. An old server without link support is never asked (offersLinkedEnvironments). An approval clears as soon as the live phase changes.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

Merge conveyor: head dce25651534d does not merge cleanly on main 9983982c4c2e (conflicts in apps/web/src/components/fork/ownerQuestions/WaitingOnYouPage.tsx, docs/fork/about.md): fork:merge-ready swapped for fork:merge-blocked. Merge main into the branch (a writer may already be queued for it), then add fork:merge-ready again.

@scuttletoby scuttletoby added fork:merge-blocked Merge conveyor: did not merge, needs a look (PRs) and removed fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) labels Nov 30, 2026
@scuttletoby

Copy link
Copy Markdown
Owner Author

Rebase

Merged main (9983982) into the branch (merge commit a1cbe60, no force push). The merge brings in main plus only this branch's own changes.

Conflicts

  • apps/web/src/components/fork/ownerQuestions/WaitingOnYouPage.tsx: main added the Needs you on a machine section (needsYou / NeedsYouOnMachines), and this branch added Pairing that needs you (usePairingWaits / NeedsYouPairing). The page now has both: both imports, both hooks, and both sections, machine sign-ins first and then pairing. The empty-state title says "No owner question is waiting" when either section has something in it, and "Nothing is waiting on you" only when both are empty. The count line is still main's version (questions and sign-ins).
  • docs/fork/about.md: both sides added a sentence about the same page. I merged them into one sentence that names both sections.

Checks

  • vp test run src/components/fork/ownerQuestions (apps/web): 5 files, 54 tests passed
  • vp run typecheck (apps/web): passed
  • vp run check:changed: passed
  • fork-seam-check.cjs --no-upstream origin/main HEAD, fork-setup-copy-check.cjs, fork-schema-check.cjs origin/main HEAD: all passed

@scuttletoby scuttletoby added fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) and removed fork:merge-blocked Merge conveyor: did not merge, needs a look (PRs) labels Nov 30, 2026
@scuttletoby

Copy link
Copy Markdown
Owner Author

Merge conveyor: head 9dc92b2607eb does not merge cleanly on main f9fddd1ea450 (conflicts in docs/fork/about.md): fork:merge-ready swapped for fork:merge-blocked. Merge main into the branch (a writer may already be queued for it), then add fork:merge-ready again.

@scuttletoby scuttletoby added fork:merge-blocked Merge conveyor: did not merge, needs a look (PRs) and removed fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) labels Nov 30, 2026
scuttletoby and others added 2 commits December 2, 2026 02:28
…, part 3)

A saved machine where this device waits for approval, and a machine link
that expired or ends within 5 days, each with a Connections button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's signed-out-providers change also starts "Waiting on you also lists, under"; with the same first pull request the changes-list check read both as one change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby
scuttletoby force-pushed the fork/needs-you-pairing branch from 9dc92b2 to 48d3199 Compare December 2, 2026 02:28
@scuttletoby scuttletoby added fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) and removed fork:merge-blocked Merge conveyor: did not merge, needs a look (PRs) labels Dec 2, 2026
@scuttletoby

Copy link
Copy Markdown
Owner Author

Merge conveyor: head 48d31996934e does not merge cleanly on main f14852ef6130 (conflicts in apps/web/src/components/fork/ownerQuestions/WaitingOnYouPage.tsx, docs/fork/README.md, docs/fork/about.md): fork:merge-ready swapped for fork:merge-blocked. Merge main into the branch (a writer may already be queued for it), then add fork:merge-ready again.

@scuttletoby scuttletoby added fork:merge-blocked Merge conveyor: did not merge, needs a look (PRs) and removed fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) labels Dec 2, 2026

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

fork:merge-blocked Merge conveyor: did not merge, needs a look (PRs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant