Skip to content

feat(remote-peer): show what a remote tool call acted on - #974

Merged
huichen merged 1 commit into
mainfrom
feat/remote-tools
Oct 10, 2026
Merged

huichen merged 1 commit into
mainfrom
feat/remote-tools

Conversation

@huichen

@huichen huichen commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

What

A remote transcript showed "Bash ran" and nothing else. This shows what it acted on.

Why the arguments have to be fetched

They are not in the entry. A lean history page strips a shell call's command and keeps its identity (call id + run), so the command is read back with get_tool_call_args. The desktop declares no lean capability, but a long conversation is still byte-budgeted, so a row can arrive with its identity and nothing else — which is why this asks rather than reads.

The parsing is the shared package's, not a second copy

asToolKind / normalizeArgs / targetFromArgs from @future-os/thread-projection. Mobile derives a row's target from exactly those three, and two implementations of "where did this tool act" would drift into disagreeing about which field carries the path (command / path / file_path / filePath). The package maps an unrecognised name to shell, so a name outside the protocol's four kinds yields no target rather than a wrong one — tested, not assumed.

Caching is the point, not an optimisation

A transcript re-renders on every streaming push. The cache holds the promise per (desktop, session, run, call), so:

  • two rows asking at once make one request
  • a failure is remembered as "no target" — the row falls back to its name, which is better than a conversation full of failing requests

Reads are skipped entirely when the row cannot be addressed (no call id, no run, no host/session); the host could not answer those either.

Tests

12 tests, and the ones that matter are mutation-checked. The cancellation guard is verified by removing it: rows are recycled, so a row handed a different call while the old read is in flight would otherwise show another call's command — a wrong answer, which is worse than a missing one. Without the guard that test fails.

Also asserted: every path field, arguments that arrived as a JSON string, an unknown tool name yielding nothing, one request per call across concurrent askers, the cache keyed by all four ids, and the hook writing nothing for an unaddressable row.

0 uncovered lines added (TS v8 method, intersected with the branch diff; the two new files are 0/17 and 0/13 statements uncovered).

Wording

The row now reads {{name}} ran rather than {{name}} is running — the call is finished by the time it is in history.

Not in this PR

Still to align with mobile (each its own PR): tasks, provider management, workspace create/delete/pin, generate_session_title, set_approval_tier, skill recommendations, get_events_since.

A remote transcript showed "Bash ran" and nothing else — row, tool name, no
idea what it did. The arguments are not in the entry: a lean history page
strips a shell call's command and keeps its identity, so the command has to be
fetched back with the call id and the run.

The parsing is the shared projection package's (`asToolKind` / `normalizeArgs`
/ `targetFromArgs`), not a second copy here. Mobile derives a row's target from
exactly those three, and two implementations of "where did this tool act" would
drift into disagreeing about which field carries the path. The package maps a
name it does not recognise to `shell`, so a name outside the protocol's four
kinds yields no target rather than a wrong one.

Cached per `(desktop, session, run, call)`. A transcript re-renders on every
streaming push, so a row that refetched its command each render would turn
reading a conversation into a request storm. The cache holds the promise, so
two rows asking at once make one request, and a failure is remembered as "no
target" — the row falls back to its name, which is better than a conversation
full of failing requests.

Reads are skipped when the row cannot be addressed (no call id, no run, no
host/session): the host could not answer those either.

The round the row shows is now "{{name}} ran" rather than "{{name}} is
running" — the call is finished by the time it is in history.
@huichen
huichen enabled auto-merge (squash) October 10, 2026 09:00
@huichen
huichen merged commit ac44c0e into main Oct 10, 2026
12 checks passed
@huichen
huichen deleted the feat/remote-tools branch October 10, 2026 09:04
huichen added a commit that referenced this pull request Oct 10, 2026
…t behind (#982)

The client role landed over eighteen PRs and left no trace in `docs/`: neither
`CONNECTION.md` nor `PRODUCT.md` mentioned that a Desktop can connect *out*, and
both still framed the domain as phone-only. `CONNECTION` calls itself the single
maintenance location for this domain, so a reader following the repo's own
convention would have concluded the desktop client could not exist.

Added §2.2.2 (both languages): the two roles in one process, the handshake's
identity fields and why identity is not a capability, `remote_peers.json` being
separate from the host's book and why, the merged list and the `lastMessageAt`
key it needed, what is hidden rather than shown as a dead button, the capability
alignment with mobile, and the three known limitations stated as limitations
(host-side single slot, mobile's read-only catalogue observers, device
identification needing a newer host).

Corrected two claims that had stopped being true: the rail entry is always shown
(connecting out needs no account), and the feature is no longer phone-only.
`PRODUCT`'s §5.3 now says what the two directions are for.

Four things the audit turned up, all mine:

* `hiddenCount` (#955) was never called — the filter selects rows, nothing
  reports how many it withheld. Deleted, with its assertions replaced by the
  filter behaviour itself.
* `forgetRemoteToolTargets` (#974) was never called either, so the fetched
  tool-argument cache was never dropped and grew for the life of the window. Now
  wired into leaving a conversation, which is where the doc always said it went —
  and the test asserts a *re-read*, because dropping the cache would be wrong if
  nothing refetched.
* `RemoteConversationSettings` computed a refusal message, and commented that the
  user "gets a value that snapped back **and a reason why**" — but never rendered
  it. The hook's tests asserted on the state, not on the screen, so the reason
  reached nobody: the user watched a setting revert with no stated cause. Now
  rendered as an alert beside the pickers (mutation-checked: hiding it fails the
  test).
* Four translation keys (`toolRunning`, `loadOlderFailed`, `providersHint`,
  `newConversationHint`) were superseded by later changes and left behind, plus
  `pairedDevices`, which I wrote in #965 and never used. Removed.

Also verified: `thinkingLevel.*`'s six keys are built dynamically
(`t(\`thinkingLevel.${level}\`)`) and are not orphans, and the four orphan keys in
`remote.json` (`connectedAs`, `reconnectingAs`, `connectionHint`,
`agentUnavailable`) predate this work (#123, #242, #554) — left alone.

`make check-docs` reports the same failures before and after this change
(whitelisting of `agent/src/prompt/*.md`, and `docs/architecture/tasks.md` whose
Chinese pair another in-flight branch has not written yet); none of them comes
from these four files.
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