Repository navigation
fix(brainbar): tolerate torn ps rows in the activation scan - #1538
Conversation
One malformed row from /bin/ps (a process exiting or exec-ing mid-scan)
raised ValueError("unreadable process table"), which escaped
_defer_for_brew and made main() latch an immediate
"BrainBar activation monitor refused" alert that nothing auto-cleared.
- brew_processes skips rows without a decimal pid and comm, and still
checks 3-field (empty args) rows by comm.
- A table with zero parseable rows stays a ValueError for the automatic
activate child, and _defer_for_brew counts it as ProcessScanUnavailable
(alerted only after 12 ticks).
- A successful scan auto-clears the latched
"monitor refused: unreadable process table" alert.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: b43593dc-08ac-4a00-82c0-daaea5dc8889) |
BrainLayer ratchetEvery Value below was measured by this run. A row this machine cannot measure says Hosted success gives no verdict on mapped bytes, search p50/p95, idle CPU, or fallback replay debt.
🟢 GREEN measured, within budget · 🔴 RED measured, out of budget — a finding to clear before merge · ⚪ n/a not measurable on this machine, never guessed. No RED rows. Measured on Linux/x86_64 · measured |
Summary
Etan sees a latched critical alert,
brainbar-activation => "BrainBar activation monitor refused: unreadable process table". It fired at 2026-10-27 10:46 and 2026-10-28 06:49 local, both host-stall moments (load 13-16, swap ~10 GB).Root cause
brew_processes()runs/bin/ps -axo pid=,ppid=,comm=,args=and raisedValueError("unreadable process table")on ANY row that did not split into 4 fields with a decimal pid. One transient torn row was enough, for example a process exiting or exec-ing mid-scan with empty args. (A live scan had 871 rows and 0 malformed ones, so the error is transient.)_defer_for_brewconverted onlyOSError/SubprocessErrorinto the countedProcessScanUnavailablepath, which alerts after 12 consecutive ticks. TheValueErrorescaped tomain(), which reportedBrainBar activation monitor refused: {exc}immediately.[Errno(one-shot legacy),>=12 ticksandCommand '['/bin/ps',prefixes, so this reason latched until a human cleared it.Fix (
src/brainlayer/brainbar_auto_activation.py)ValueErrorfrombrew_processes, so the automatic activate child (brainbar_activation._activate->brew_active(), which catchesValueErrorand boots out what it attempted) behaves as before._defer_for_brewturns thatValueErrorintoProcessScanUnavailable("unreadable process table"), which is counted and never refuses immediately.BrainBar activation monitor refused: unreadable process table, so today's latched alert clears on the first good tick after install.Test plan
origin/mainbefore the fix (5 failed, 42 passed).pytest tests/test_brainbar_auto_activation.py tests/test_brainbar_activation.py:76 passed.ruff check+ruff format --checkon both changed files are clean.BRAINLAYER_PREPUSH_SCOPE=changed-only: BrainLayer test gate passed.Loop-record: implementer=claude/claude-opus-5-5/medium reviewer=none rounds=0/0 defects=0 role=worker
Review: pending Codex inner-loop review (routed by the BrainLayer P0 lead). No bot reviews requested.
— brainlayerClaude (worker) · claude-code/claude-opus-5-5
🤖 Generated with Claude Code
Note
Medium Risk
Changes BrainBar auto-activation gating and alert lifecycle during process scans; behavior is narrower (more tolerant) but still affects when activation runs and when critical alerts fire.
Overview
Fixes a latched brainbar-activation critical alert (
BrainBar activation monitor refused: unreadable process table) caused when a single torn/bin/psrow during host stress made the whole table "unreadable."brew_processes()now skips malformed rows (missing pid/comm, non-decimal pid) instead of failing the scan; three-field rows with empty args still participate in Homebrew detection viacomm.ValueErroris raised only when no parseable rows remain._defer_for_brew()maps thatValueErrortoProcessScanUnavailable("unreadable process table"), so failures accumulate over ticks and alert only after 12 consecutive failures—matching other scan outages—rather than escaping tomain()as an immediate monitor refusal. A successful scan also clears the latched "monitor refused: unreadable process table" alert.Tests cover mixed valid/torn rows, wholly unusable tables (counted, not refused until tick 12), and auto-clear of the new refusal reason.
Reviewed by Cursor Bugbot for commit cac3054. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
brew_processesto tolerate torn rows in BrainBar activation scanbrew_processesnow skips rows with fewer than three fields or an invalid PID, and treats a missing args field as empty. It raisesValueErroronly when no rows are readable.AutoActivator._defer_for_brewconverts thatValueErrorinto aProcessScanUnavailabledeferral instead of an immediate refusal, and adds the unreadable-table message to the alert-recovery prefixes.Macroscope summarized cac3054.