Skip to content

fix(gui): name the leftover link key and trust-file refusals on the Remote Link page - #8617

Merged
lidge-jun merged 2 commits into
devfrom
fix/remote-link-enrollment-errors
Nov 13, 2026
Merged

lidge-jun merged 2 commits into
devfrom
fix/remote-link-enrollment-errors

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

The Remote Link page showed "Remote link request could not be completed." for five refusals the Home already returns while adding a Child. Two of them leave a link key behind that the person must revoke, and the CLI says so; the dashboard did not. The dashboard also ignored the server's residual: true flag, which means the Child may still be connected.

Code Sent by What the page now says (English)
link_pin_conflict POST /api/link/confirm-host Another Home-initiated link already pins a different host key for this alias; remove that link first.
host_key_changed POST /api/link/apply The confirmed host key is no longer the trusted one; test the connection and confirm the host again.
trust_file_unexpected POST /api/link/apply The link known_hosts file has a pattern, host list, marker or malformed line; remove it and confirm again.
key_cleanup_failed POST /api/link/apply rollback Enrollment did not complete, and Home could not revoke the key it issued; revoke the leftover link key under API keys.
link_cleanup_uncertain POST /api/link/apply rollback Whether the link is saved is unknown, and its key could not be revoked; disconnect the link if it is listed, and revoke the leftover link key under API keys.

The five codes. They are added to LINK_ERROR_CODES in gui/src/remote-link-api.ts and to the ERROR_TKEY map behind errorKey in gui/src/pages/RemoteLink.tsx. Each of the 11 locale catalogs gets its own translation, none copied from English. The two cleanup messages match the CLI's HOME_CLEANUP wording in src/cli/link-enrollment.ts.

When the Child may still be connected. For any refusal, readLinkJson now reads residual: true into LinkApiError.residual. That value is one of four fixed variants: purge, ephemeral or full, which match the three recovery lines in src/server/management/link-enrollment.ts, or unknown for any other line. The server's recovery text is never shown as such. The error notice then adds a translated step that starts with "The Child may still be connected." and names the command, as ocx link add already does.

Before (key_cleanup_failed from apply):

before

After, without the residual flag. This capture predates the wording change and still reads "The Child was not connected"; the current text reads "Enrollment did not complete", as the next capture shows:

after

After, with residual: true and the ephemeral recovery line, at the current head:

after with residual

The captures come from a local Vite page that mounts the real RemoteLink component with a stubbed fetch. They live on the pr-assets branch and are linked by commit SHA, so no image is committed to this branch.

Stays the same. No server code or wire format changes. Every other code keeps its current text, and unknown codes still fall back to the generic message. The extra Child step appears only when the server sent residual: true.

Verification

Tests that failed first in gui/tests/remote-link.test.tsx:

  • 6 failed before the first GUI change: one per code, plus the locale test.
  • 5 more failed before the residual change: four residual variants across both cleanup codes, plus readLinkJson keeping the residual variant.

At head 3ded712:

  • cd gui && bun test tests/remote-link.test.tsx tests/locale-parity.test.ts tests/i18n-locales.test.ts: 86 pass, 0 fail. This includes the existing guard that every LINK_ERROR_CODES entry is still sent by a Home route.
  • cd gui && bunx tsc -b: exit 0.
  • bun run lint:gui: exit 0.
  • bun run privacy:scan: exit 0.

NOT RUN: the full bun run test and the full GUI suite. The change touches only the GUI error copy, the error map and readLinkJson, so CI covers the rest.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed (no docs describe these dashboard messages).
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. These are copy changes; the server's prose and recovery text are never echoed.

…emote Link page

The Home answers five enrollment codes that the dashboard did not know, so it showed
"Remote link request could not be completed." for each: link_pin_conflict, host_key_changed,
trust_file_unexpected, key_cleanup_failed and link_cleanup_uncertain. They are now in
LINK_ERROR_CODES with strings in every locale; the two cleanup codes tell the person to revoke the
leftover link key under API keys, as ocx link add already does.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • 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

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 13, 2026
…nrollment

Review round 1 on #8617: the cleanup messages claimed the Child was not connected, but the
server sends key_cleanup_failed and link_cleanup_uncertain with residual: true when the Child may
still be connected. The dashboard now keeps that flag as a fixed variant (the server's recovery
line is matched against the lines it writes, never shown) and adds a translated Child step:
detach --purge, ocx-child detach, ocx disconnect and restart, or a generic check. The cleanup
messages now say enrollment did not complete, as the CLI does.
@lidge-jun
lidge-jun marked this pull request as ready for review November 13, 2026 02:31
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 13, 2026 02:31
@lidge-jun
lidge-jun merged commit 20fb0d3 into dev Nov 13, 2026
38 of 39 checks passed
@lidge-jun
lidge-jun deleted the fix/remote-link-enrollment-errors branch November 13, 2026 02:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T02:33:10.546625Z 3ded712 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant