acpmux: _acpmux/info answers while logs load
Root cause
#22916 made _acpmux/info wait for logs_ready, which a restarted daemon sets once the deferred chat-log load (load_logs, after its ready line) is done. On a large log store that load takes longer than 2 s. The app daemon (cmux-tui-core) calls info with a 2 s timeout, and it reads only what the saved session list already holds:
agent_message_acpmux.rs: the pump's hand-over checks the session id. A timeout makes itHandover::Unreachable, so the message stays queued. The withdraw path'sNoSessioncheck also reads only the id.agent_session_link.rs: the message policy's workspace lookup readssessionEnv.CMUX_WORKSPACE_ID. A timeout givesNone, so an agent's send is held asworkspace_unknown.
Other callers do read what the logs fill in (queue, turn, status): the acpmux CLI, restore-journey.py, chat-transfer-live.py. Making info stop waiting for everyone would undo #22916 for them.
Fix
Option (1), opt-in:
_acpmux/infotakeswaitLogs: false. With it, info answers at once. Every answer now carrieslogsLoading, which is true while the logs are still being read; then the queue, turn and status come from the saved session list.- Without the flag, info still waits for the logs, as #22916 made it.
- The three cmux-tui-core calls above pass
waitLogs: falsethrough oneinfo_paramshelper. Their 2 s timeouts are unchanged. - An older acpmux ignores the unknown param and behaves as it does today.
docs/acpmux-schema.jsondocuments the param and the field.
Not changed: agent_transfer/ask_first.rs already gives info 15 s.
The seam ACPMUX_TEST_DELAY_LOAD_LOGS_MS is debug-only and capped at 10 s. It lives in daemon.rs, before load_logs_async, so this PR does not touch hub/mod.rs, where #23118 adds its LogsReady drop guard. Both PRs add a test to tests/durable_agents.rs, in different places (#23118 after a_dequeued_prompt_survives_a_daemon_crash, this one at the end of the file).
Red, then green (fleet, cmux-ci run --class isolated --script scripts/ci/cmux-tui-rust-check.sh --arg=test --arg=<filter>)
| Filter | Commit | Step | Result |
|---|---|---|---|
info_answers_while_the_chat_logs_load | 6cc5cb781eb9 (test, red) | e5fe9a0f2e3fb12ffa1ec7c4 | FAIL, failed alone too: _acpmux/info {waitLogs: false} answered within 2 s while the logs load: Elapsed(()) |
while_acpmux_reads_its_chat_logs | 4fc39d65df14 (test, red) | e5ff731e5a393053a8d1e4cb | FAIL: the delivery never happened: … "state":"queued","attempts":"0" |
info_answers_while_the_chat_logs_load | dbc73521fbd2 (fix; same acpmux tree as head) | f364da01b7ce18c671119d83 | 1 passed |
while_acpmux_reads_its_chat_logs | 2d331b3d67ef (head) | 4a90b26576acc5e0f104a95b | 1 passed |
info | 2d331b3d67ef (head) | aacece8c86c0dfc6bcc25a9a | 22 passed, including info_answers_while_the_chat_logs_load |
survive | 2d331b3d67ef (head) | f87ba700080859d262939b50 | 116 passed |
attach | 2d331b3d67ef (head) | d1e54bceda87a78dfb32f41e | 380 passed, 4 failed. The 4 are known base reds: attachment_tests::bad_types_sizes_and_hashes_are_refused_before_any_bytes and three host_scrollback::sized_attach tests |
Observed / Not run
Observed:
- All the runs above, on the fleet.
- The acpmux test fails on the test commit for the right reason: info does not answer within 2 s.
- The cmux-tui test fails because the pump never delivers; the message stays queued.
Not run:
- The full CI suite. CI runs it on this PR.
- No test covers the workspace lookup (
agent_session_link.rs) or the withdrawNoSessionpath with logs loading. I first wrote a policy test for the lookup, but an agent sender needsacp_credential, andcredential.mintis refused on base (origin.forbidden,credential_owner_only). That same refusal is behind the knownqueuebase reds (agent_message_pump::*,deliveries_start_queued_…). So the lookup change is covered only by reading the code. It reuses the same helper as the hand-over, which is tested. - No live run against a daemon with a real large log store.
Changelog
- Fixed: agent messages reach an acpmux chat, and their workspace is found, while a restarted acpmux is still reading large chat logs.
Follow-up to #22916 review
Agent session: cosmic-gray
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes _acpmux/info timing out the cmux-tui app after an acpmux restart while the deferred chat-log load is still running. The app daemon's info calls (pump hand-over, withdraw check, workspace lookup) only need the session id and env from the session list, but info waited for the logs, which on a large store takes longer than the 2 s timeout.
_acpmux/infonow acceptswaitLogs: falseto answer immediately, and every answer includeslogsLoadingwhile the logs are still being read.- Callers that read queue, turn, or status continue to wait as before.