Skip to content

Stop paying for work already done - #12

Merged
My-CMDhub merged 2 commits into
bugsmash/5-telemetryfrom
bugsmash/6-redundant-work
Oct 7, 2026
Merged

My-CMDhub merged 2 commits into
bugsmash/5-telemetryfrom
bugsmash/6-redundant-work

Conversation

@My-CMDhub

Copy link
Copy Markdown
Owner

The per-call context block sat at character 32 of a 26,389-character system
prompt, so every minute rollover changed the prefix and invalidated the
provider's prompt cache for the whole prompt. Moved to the end.

cached_tokens across minute rollovers: [0, 8448, 0] -> [4864, 8448, 4864].


Second commit — perf(voice): stop re-asking Appwrite for the same booking mid-call:

Trace CA591f56d4f5055bd64cb598b2de7a58cd: lookup_booking fired 8 times in
one 204s call. Each firing cost 1-3 sequential Appwrite round trips at
~250ms apiece — a caller-phone miss falls through to a name query and then
a 100-document scan — so tool turns landed at 1.1-1.6s against an 800ms
TTFA budget while the model itself answered in 341ms.

Measured on the dyno: a single reservation query is 1220ms cold and ~270ms
warm, and pooling the HTTP client saves only ~20ms of that. The cost is the
number of round trips, not the connection.

  • Per-call memo in front of lookup_motel_reservation. It caches the task,
    not the result, so concurrent callers join one in-flight request, and it
    drops failed entries so a transient error cannot poison the call.
  • Any tool outside the read-only set invalidates the memo. A tool added
    later defaults to safe, not fast.
  • Prefetch the caller's own booking when the call context is built, so it
    overlaps the first model round instead of landing inside the turn.

The per-call context block sat at character 32 of a 26,389-character system
prompt, so every minute rollover changed the prefix and invalidated the
provider's prompt cache for the whole prompt. Moved to the end.

cached_tokens across minute rollovers: [0, 8448, 0] -> [4864, 8448, 4864].
Trace CA591f56d4f5055bd64cb598b2de7a58cd: lookup_booking fired 8 times in
one 204s call. Each firing cost 1-3 sequential Appwrite round trips at
~250ms apiece — a caller-phone miss falls through to a name query and then
a 100-document scan — so tool turns landed at 1.1-1.6s against an 800ms
TTFA budget while the model itself answered in 341ms.

Measured on the dyno: a single reservation query is 1220ms cold and ~270ms
warm, and pooling the HTTP client saves only ~20ms of that. The cost is the
number of round trips, not the connection.

- Per-call memo in front of lookup_motel_reservation. It caches the task,
  not the result, so concurrent callers join one in-flight request, and it
  drops failed entries so a transient error cannot poison the call.
- Any tool outside the read-only set invalidates the memo. A tool added
  later defaults to safe, not fast.
- Prefetch the caller's own booking when the call context is built, so it
  overlaps the first model round instead of landing inside the turn.
@vercel

vercel Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ovela-ai Ready Ready Preview Aug 19, 2026 10:47am

@My-CMDhub My-CMDhub closed this Sep 18, 2026
Repository owner locked and limited conversation to collaborators Sep 18, 2026
@My-CMDhub My-CMDhub reopened this Sep 18, 2026
@My-CMDhub
My-CMDhub merged commit 5581eca into bugsmash/5-telemetry Oct 7, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
Preview — f51bc666 Deployed Aug 19, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant