Skip to content

Agent slice memory limits are sized from RAM at server start and go stale when a VM's memory grows, so new Claude threads time out #36667

Closed as not planned

Description

@muntedcrocodile

What happened

Every new Claude thread failed with "Claude timed out while registering its MCP tools. Retry the turn; if it keeps failing, check Claude and the server logs." It started suddenly, and nothing changed in the T3 Code or Claude setup. Threads whose Claude process was already running kept working. The user connects through the web client to a T3 server running as a systemd user service in a Qubes OS VM that is used only for coding.

Diagnosis

agentScope.ts sets MemoryHigh/MemoryMax on app-t3code-agents.slice once at server start from NodeOS.totalmem() (high = max(total - 6 GiB, total/2)) and never recalculates.

Qubes VMs (like other ballooning/dynamic-memory VMs) boot small and grow. The server started when the VM had ~13.1 GiB, so MemoryHigh = 7.1 GiB. At failure time the VM had 41.8 GiB (~28 GB available) but the slice was still capped at 7.1 GiB.

Agent Gradle/Kotlin builds + Gradle daemons + Codex app-server (2.7 GB, #26171) + 5 Claude sessions pushed the slice to 7.64 GB, just over MemoryHigh. The kernel throttled everything in the slice (~30.7M high events, full pressure ~69%, swap full, no OOM since MemoryMax wasn't hit).

A new claude in a fresh t3code-claude-*.scope couldn't finish startup, never answered setMcpServers, and was killed at the 90 s CLAUDE_MCP_REGISTRATION_TIMEOUT (13-19 s CPU used, ~100 MB). Failed opens never reached McpHttpServer.authenticateRequest. Outside the slice, the same CLI with T3's flags answered in 0.7 s.

Steps to reproduce

  1. Run the T3 server as a systemd user service on Linux in a VM with dynamic memory (Qubes: an AppVM with a low initial memory and a high maxmem).
  2. Start the server while the VM is small (about 13 GiB here). The slice gets MemoryHigh = total − 6 GiB.
  3. Let the VM grow (it reached 41.8 GiB here), then run agent workloads that together exceed the old MemoryHigh, such as parallel Gradle/Kotlin builds.
  4. Start a new Claude thread. It fails after 90 s with the MCP registration timeout, while the VM has plenty of free memory.

Deterministic without a VM: after the server starts, run systemctl --user set-property --runtime app-t3code-agents.slice MemoryHigh=<a little above current usage>, run a memory-heavy agent task, then start a new Claude thread.

Version

0.1.7

Environment

Qubes OS AppVM, Linux 6.6.48 x64, systemd user service, Node 26.12.1, Claude Code 2.1.325 (Opus 5.5), web client

Evidence

ClaudeAgentSdkQueryRunner.open (server.trace.ndjson)
20:56:13   0.6s Success
21:19:44 180.2s Failure (90s + resume retry)
21:31:22  90.1s Failure (new thread)
cause: setMcpServers -> ClaudeMcpRegistrationTimeoutError

MemTotal: 43824684 kB
app-t3code-agents.slice MemoryCurrent=7640686592 MemoryHigh=7620571136 (=13.1GiB-6GiB, sized at boot) MemoryMax=10547266560
memory.events: high 30772894, max 0, oom_kill 0
memory.pressure: full avg60=69.26

Related issues

#23151 (closed; fix #23202 open): same 90 s setMcpServers timeout; a comment there reports MemoryHigh throttling from a runaway process. Here the cap itself is stale. #24708 (host-managed slice limits; no setting in 0.1.7), #18350 (MemoryHigh stalls without OOM), #26171 (Codex app-server in agent slice). None covers limits going stale when RAM grows after start. Possible fixes: recalc on totalmem change, use Qubes maxmem, an opt-out setting, and surface slice pressure in the timeout error.

Fix applied or workaround

  • systemctl --user set-property --runtime app-t3code-agents.slice MemoryHigh=infinity MemoryMax=infinity took effect immediately, without restarting any agents. The user wants no cap because the VM is only used for coding.
  • To survive server restarts (T3 resets the limits at startup), a t3code-dev.service drop-in runs an ExecStartPost loop in the background that lifts the cap again for 5 minutes after each start. A systemd drop-in can't set the limit itself, because T3's --runtime override takes precedence over it.
  • Another option is raising the VM's initial memory, so the boot-time totalmem is realistic.

Filed by

Claude Opus 5.5 (claude-opus-5-5) in Claude Code, via t3 triage

Activity

  1. juliusmarminge commented on Nov 14, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Commit 179c032 (origin/main). This VM cannot grow its RAM, so the stale-cap scenario could not be watched in a running app. Read-only check of the live systemd user manager here: app-t3code-agents.slice MemoryHigh=10326347776, MemoryMax=12576599040 with MemTotal 16375780 kB, which is exactly max(total-6GiB, total/2) / max(total-4GiB, 0.75*total) computed once at server start. I did not lower the slice's MemoryHigh by hand (the reporter's VM-free path) because the slice is shared with this VM's own T3 server and its agents. Unit reproduction: mocked os.totalmem() in apps/server/src/process/agentScope.test.ts, launched an agent at 16 GiB (limits applied), raised the total to 42 GiB, and launched another agent. On main, no new set-property call is made: the last set-property is still the startup one, so the test fails (1 failed, 14 passed). The test is pushed as factory/repro-36667.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  2. VanTanev commented on Nov 16, 2026

    @VanTanev

    Note

    🤖 Claude Opus 5.5 responding on behalf of VanTanev

    This still happens on 0.1.9, and I reproduced the full failure on a Hyper-V VM.
    Your unit test on factory/repro-36667 fails on main for the same reason, so I think this issue needs to be reopened.

    Steps:

    1. Run the T3 server as a systemd user service in a Linux VM with Hyper-V dynamic memory: minimum 12 GiB, startup 16 GiB, maximum 32 GiB.
    2. Let the first agent start while the VM has its minimum RAM.
      MemTotal was about 11.6 GiB, so T3 set MemoryHigh=6232358912 (5.8 GiB) and MemoryMax=9348538368 on app-t3code-agents.slice.
    3. Use the VM for a few days with several Claude threads and builds.
      Hyper-V grows the VM to 32 GiB (MemTotal 33144096 kB), but the slice limits stay the same.
    4. Let the slice go over MemoryHigh.
      In my case it held 6.8 GiB, and its memory.pressure showed full avg10=98.
    5. Start a new Claude thread, or send a turn to one whose process has stopped.
      The turn fails with "Claude timed out while registering its MCP tools" after 90 seconds, or after 180 seconds on a resume, because of the retry.

    What I measured:

    • The failed t3code-claude-*.scope units used about 4 seconds of CPU and a 4 MB memory peak in 90 seconds.
    • Outside the slice, the same claude binary with T3's flags answered initialize in 2 seconds.
    • I set the limits that T3 calculates for the current RAM, with systemctl --user set-property --runtime app-t3code-agents.slice MemoryHigh=27497103360 MemoryMax=29644587008.
      Slice pressure fell from 98% to 15% in 20 seconds.
      After that, a claude process in the slice answered mcp_set_servers in 4 seconds.

    #24717 (T3CODE_AGENT_SLICE_MEMORY_POLICY=host-managed) would give a way around this, but the default still fails on every VM with dynamic memory or ballooning.
    A fix is to calculate the limits again from os.totalmem() before each agent starts, and to call set-property when they change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions