~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0

iOS: feeds hear of the posts seen as they're scrolled past

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/hud:ios/interactions-timer

On iOS, For You kept serving the same posts because the app almost never told it what had been seen: every timed send_interactions was cancelled on the phone before it went. This fixes that, and logs the web page's tool calls as the app's are logged, so both can be followed in the log.

Claude Opus 5.5 · medium

What changes

iOS sends what was seen as it is scrolled. Interactions.add's timer task clears timer before it flushes. flush() cancels a waiting timer, and that timer was the very task running the flush, so its send ran cancelled and URLSession refused it ("cancelled"). Seen posts went only when something else flushed: opening a post, changing tab, leaving a screen, backgrounding, signing out.

The page's tool calls are logged. place.hud.callTool writes the mcp tool / mcp tool failed line /mcp writes (tool, DID, error, duration; never arguments or results), with reason: sign-in asked where it asked to sign in again. Before, a call from the workspace page left only its request line, so a failed web send_interactions left nothing to find. docs/observability.md says so.

iOS build 1.0 (3), for TestFlight.

Why

hud.place's log since 03:10 UTC: iOS loaded For You at 03:11:09, 03:12:23 and 03:30:07, and only one interactions sent (1 seen) ever followed; in the 30 minutes up to 05:30 iOS made 13 /mcp calls and sent none. The web sent 1, 2 and 4 seen to did:web:foryou.club within seconds of scrolling. A standalone Swift program of the same shape (a Task whose flush cancels the Task held as the timer, then URLSession.data) printed failed: cancelled | cancelled: true.

How it was checked

  • Actions.aQueuedSendGoesUncancelled (HUDKit): a queued send's task is not cancelled. Fails on main ([true] == [false]), passes here; the Actions suite passes.
  • cargo test -p hud-server, clippy -D warnings, cargo fmt --check.
  • The rest of just check, just e2e and just e2e-spaces are left to the queue's checks.
Approved

This fixes the iOS throttle bug and adds logging for the web page's tool calls.

  • iOS fix: the timer task now sets timer = nil before it calls flush(). So flush() no longer cancels the task that is running it, and the send goes out uncancelled. A guard let self replaces the optional chaining. If add is called during the send, it sees no timer and starts a new one. That is safe.
  • Logging: callTool now writes one mcp tool line through telemetry::tool, with tool name, DID, error and duration. It logs no arguments or results. The sign-in-asked path logs reason: sign-in asked. The "sign in again" path, where the session is still good, is logged as an error with that message. docs/observability.md is updated to match.
  • Test: aQueuedSendGoesUncancelled covers the cancelled-send case directly.
  • Not run: I didn't run anything. The rest of just check is left to the queue's checks, as the body says.

I found nothing that needs changing.

Merged as f374a8c