Skip to content

fix(station): keep paused commands paused until the memory has eased - #10416

Merged
CommaBot merged 2 commits into
mainfrom
fix/memorywatch-resume
Dec 5, 2026
Merged

CommaBot merged 2 commits into
mainfrom
fix/memorywatch-resume

Conversation

@CommaBot

@CommaBot CommaBot commented Dec 5, 2026 •

Copy link
Copy Markdown
Collaborator

Why

A station VM on a swapless machine restarted twice. MemoryWatch paused a 7.6 GB agent command under high pressure and let it go on 10 s later, either as the queue's head once the earlier 3.3 GB command ended (#queue, which resumed the head while the memory was still pressed, even critical), or on a single look that read normal (#resumeEarliest, no hysteresis). The logs cannot tell which: both print goes on. Within 5 s, before the next PRESSED_MS look, the machine thrashed on page cache and stalled until its supervisor restarted it for missed heartbeats.

What

  • What is paused goes on only after EASED_LOOKS (2) looks in a row without pressure.
  • #queue never resumes while every big command is paused. Under critical the existing stop path stops the largest. Under high, after SETTLE_MS the largest is stopped and its agent told, since a paused command frees nothing and the next one can then go on. This replaces resuming into the pressure; without it the queue would wait forever.
  • PRESSED_MS 5 s → 2 s: a swapless machine goes from high to stalled in seconds. Reads come from /proc (fix(station): detect swapless anon pressure and read Linux /proc directly in MemoryWatch #9669), so this is cheap.

No Pion counterpart: pion/station-host does not pause or resume commands (Node-Station-Only trailer).

The machine side (MGLRU min_ttl_ms so the kernel OOM-kills instead of stalling) is AFK-surf/monoid-machine#164 and losfair/l4h#277.

Tested

station/test/memory-watch.test.ts (36 pass): the queue test now needs two eased looks; a new pair covers every big command paused under critical (stopped at once, never told it goes on) and under high (nothing at once, stopped after SETTLE_MS). tsgo --noEmit.

Model: Claude Opus 5.5 (design reviewed with Gemini 4 Neon). Frameworks: node:test with Effect TestClock.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

CommaBot and others added 2 commits December 6, 2026 04:14
On a swapless machine MemoryWatch let a paused 7.6 GB command go on
while the memory was still pressed (the queue's head after the one
before it ended, or one look that read normal), and the machine stalled
within seconds, before the next look could stop anything.

What is paused now goes on only after EASED_LOOKS looks in a row
without pressure, never while critical. When every big command is
paused and the memory stays high, the largest is stopped after
SETTLE_MS instead of let go on, since a paused one frees nothing.
Under pressure the watch looks every 2 s instead of 5 s.

Changelog: 修复:内存吃紧时,station 不再过早恢复被暂停的大命令,避免整机卡死被重启。
Changelog-parts: station
Co-authored-by: zuozijian <zuozijian@cue.surf>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Node-Station-Only: MemoryWatch's pause queue (SIGSTOP/SIGCONT of agents' commands under memory pressure) exists only in station/src/jobs/memory.ts; pion/station-host has no counterpart that pauses or resumes commands
Review: one look's ease cleared how long every big command had been
paused, so high and normal taking turns kept them paused for good; and
the stop for it could follow a critical stop seconds later. Keep the
wait through a single eased look, count only a read normal as eased,
and stop only SETTLE_MS after the last stop.

Co-authored-by: Heyang Zhou <heyang@cue.surf>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Node-Station-Only: MemoryWatch's pause queue (SIGSTOP/SIGCONT of agents' commands under memory pressure) exists only in station/src/jobs/memory.ts; pion/station-host has no counterpart that pauses or resumes commands
@CommaBot
CommaBot merged commit 51a7482 into main Dec 5, 2026
70 checks passed
@CommaBot
CommaBot deleted the fix/memorywatch-resume branch December 5, 2026 19:44
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.

1 participant