Skip to content

Hosted agents: refuse a mail that would wake a session with a cold prompt cache - #3

Merged
ANcpLua merged 1 commit into
mainfrom
cold-wake-gate
Dec 4, 2026
Merged

ANcpLua merged 1 commit into
mainfrom
cold-wake-gate

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Alexander asked for this on 2026-12-04: a hosted chat should not have to ask him which agent is idle, and a mail must not wake a session whose prompt cache is cold without saying so.

What changes

  • mail_send from a hosted chat to one idle Claude Code session whose prompt cache has expired is refused. The answer names the idle time, about how many tokens the wake would re-read at full price and the sessions that are live.
  • wake_cold in the call sends anyway, for the one session the person named. It is refused together with all.
  • Live sessions, idle sessions with a warm cache, broadcasts, other inboxes and unknown addresses behave as before. A session without a readable transcript is let through.
  • The cache state is read from the tail of the session's transcript with PromptCacheParser, the reading the Agents rows show.

Not in this change

  • Mail between local agents through agent-mail is not gated. That lives in the dotfiles, which this session could not open.
  • The relay passes wake_cold through in ANcpLua/agents-relay; without it the override is simply never set.

Verification

  • Written in a cloud session without a Swift toolchain. This pull request exists so that ./pack.sh check on macOS is its first build; hosted-agents-selftest covers the gate, the transcript reading and the wake_cold argument.
  • Installing it on the Mac is a local step and waits for a local session.

Generated by Claude Code

…ompt cache

mail_send from a hosted chat to one idle Claude Code session whose prompt cache has expired is refused with the idle time, the tokens a wake would re-read and the live sessions. wake_cold sends anyway. Asked for by Alexander on 2026-12-04; written from a cloud session without a Swift toolchain, so CI on this branch is its first build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nXBkm9upAoTWX1BhWGVFd
Copilot AI balanced review requested due to automatic review settings December 4, 2026 09:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@ANcpLua
ANcpLua merged commit edde095 into main Dec 4, 2026
2 checks passed
@ANcpLua
ANcpLua deleted the cold-wake-gate branch December 4, 2026 09:35

ANcpLua commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Merged on Alexander's word as edde095. CI on main for edde095 is red, and one re-run was red too. What I found:

  • Both runs stop in clipboard-panel-selftest with "One left click did not copy the clicked row and close the panel." about six seconds after the previous check, so the panel was still open when the five-second wait in ClipboardPanel.swift ran out. hosted-agents-selftest comes later and did not run.
  • The same check failed the same way on main at dbe021a on 2026-12-03 (run 47167963844, attempt 1) and passed on its re-run. That was before this change existed.
  • This change does not touch the clipboard panel. The same code passed the whole gate, hosted-agents-selftest included, in this pull request's run (47305805757).
  • A re-run of the commit before it, 1874565, passed today on the same runner image (macos-15-arm64 20261130.0572.1).

So the red result is the clipboard selftest's synthetic click timing out on the runner, not the cold-wake gate. I used the one re-run and did not revert. The check posts a mouse-up and then enters the table's tracking loop; a fix would be to make that click independent of event delivery on the runner, which needs a Mac to try.


Generated by Claude Code

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.

3 participants