Repository navigation
feat(resources): run btop itself, embedded and focused on coding agents - #28
Conversation
Vendor the btop system monitor and its bundled fmt headers under vendor/btop so the project can build against a pinned copy instead of relying on a system install. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a header that exposes the interface needed to embed btop's collection and drawing routines into another application. This lets callers drive btop without going through its standalone main loop. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new header under the vendored btop include directory to expose the medulla integration interface. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds the btop embedding source file to the vendored btop tree so the embedded build path can be compiled. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The resize handler short-circuited on the width comparison, so the height exchange was skipped whenever the width was unchanged. Both exchanges now run before the early return so the stored dimensions stay in sync. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The vendored btop no longer installs signal handlers or calls quick_exit from clean_quit; fatal errors now throw Embed::Fatal so the host can report the message and unwind btop's thread instead of terminating the process. The standalone main entry point and its CLI, config and TTY setup were removed since Medulla drives btop through the embed API. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds btop_embed_main, an entry point that runs btop's main loop on a host-created thread without argument parsing, controlling terminal or signal handling. It reads config and themes from a host-chosen directory, pauses drawing while the host hides the view, and unwinds cleanly when the host requests a stop. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Replace direct terminal writes, stdin polling, and signal-based interrupts with Embed calls so btop can run as an embedded pane driven by a host process. Quit requests now go through Embed::request_leave instead of exiting directly, letting the host decide when to tear down the session. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The terminal resize loop now exits early when the embedded instance is stopping or hidden, preventing it from spinning while the UI is not visible. The ctrl_r reload shortcut sets the reload flag directly instead of raising SIGUSR2, so reloads no longer depend on signal handling. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Declare an atomic reload_conf flag alongside init_conf in the Global namespace so configuration reloads can be signalled across threads. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Delete the vendored btop command-line parser implementation and header, which are no longer referenced by the build. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed the btop_cli.hpp include from the vendored btop source since nothing in the file references it, keeping the vendored tree free of a stale dependency. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Register the new btop crate as a workspace member so it is built and tested alongside the existing crates. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wire the vendored btop crate into the workspace and the TUI so the host Resources tab can drive it through its C ABI. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a build script that compiles the btop sources and wires up the native build so the integration can be built as part of the crate. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The build script's module docs referenced `Btop::start` via an intra-doc link, which cannot resolve from a build script and would warn during doc builds. The reference is now plain code text, and the trailing link definition was dropped. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new Rust crate exposing FFI bindings so btop's types and core library can be consumed from Rust. This provides the foundation for integrating btop functionality into Rust-based tooling. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new handle module that wraps btop process interaction, giving the rest of the code a single place to start, stop, and query btop instances instead of duplicating that logic. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Registers the new medulla-btop package and wires it into the medulla dependency set so the workspace lockfile reflects the added crate. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a proc_agents option that narrows the process box to coding-agent processes and their children, toggled with the A key and exposed in the options menu. Tree view and the filter are enabled by default so the process list starts focused on agents. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The agents toggle now waits on the active runner before changing the proc_agents config, since the box title depends on the mode and the boxes need to be rebuilt safely. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce an agents mode that narrows the process box to processes belonging to coding agents reported by the host, marking each process with its agent label and whether it is the agent root or a descendant. Agent ownership is resolved by walking each process up its ancestry with memoisation, and the filter is recomputed whenever the agent set or the toggle changes so the visible tree stays current. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The macOS collector now re-runs filtering whenever the agent set or the agents toggle changes, and the filter pass also applies in agent mode even with an empty filter string. This keeps the process list consistent when switching agent mode instead of leaving stale filtered state. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The process box now shows an Agent column in agents mode, labelling each agent's own process and dimming its descendants, and displays a hint instead of a blank list when no agents are running. The box title and filter controls shift to accommodate the longer title. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The resource sampler, plot rendering, and their configuration types have been deleted along with the associated tests and the resources tab feature test. This removes the resource monitoring subsystem entirely. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The resources tab plan and its overview screenshot have been deleted now that the feature has shipped, and the corresponding module no longer needs the leftover code. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new btop-inspired UI module with its own types and renderer to display system resource usage in the TUI. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce feed and input handling for the btop view so it can consume and respond to data. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new pane module that renders btop-style panes in the TUI, giving the interface a richer, boxed layout for displaying system information. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Drops the ResourcesConfig and ResourcesThemeConfig types along with the resources field on TuiConfig and the theme's resource color overrides, since the Resources tab they configured no longer exists. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The render loop now calls hide_resources_unless_shown before drawing each frame so the resources pane only collects and draws while its tab is on screen, matching btop's behaviour. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed the remaining references to the retired `theme.resources` table from the theme tests and updated the persistence test's doc comment to explain that the table is now an unknown section that must still survive a save. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test module covering the btop UI rendering so its behaviour is verified and regressions are caught. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add unit tests covering the app resources module to verify its behaviour and guard against regressions. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The resources pane is now hidden as soon as it reports that the user is leaving, so it no longer stays visible while the tab switches to Sessions. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The cursor positioning, save, and restore sequences were switched from HVP, CSI s, and CSI u to CUP, DECSC, and DECRC, and the clear sequence now homes the cursor with CUP, because the host's vt100 emulator does not implement the former forms. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Extend the btop tab test to check that the emulator applies btop's absolute cursor moves, verifying the cpu box title sits on the first row and the frame stays on the left edge. Without this, boxes would run together and the test would still pass. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Extract a helper that checks the cpu box frame and title on the first row, and wait for that frame rather than the bare word "cpu", which the agents box's sort label also contains. The left-edge check now skips the title row explicitly instead of relying on the consumed iterator. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Apps without a medulla home now resolve their btop config to a single fixed scratch directory instead of a per-process one, so tests and other home-less runs reuse the same location. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a macOS CI job that builds and tests the vendored btop crate so Apple-clang issues surface on pull requests instead of at release time. The native-deps action now installs g++-14 because the vendored btop requires C++23 ranges support that Ubuntu 24.04's default g++ 13 lacks. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Cargo reads every workspace member's manifest, including path dependencies, even when building with `-p`, so the submodules must be checked out before the embedded btop test job runs. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The release script now updates the lockfile entry for medulla-btop alongside the other workspace members, so its version stays in sync when bumping the shared version. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The fixture lockfile now includes a medulla-btop package and the expected version count is raised to four, so the test exercises the newly added workspace crate. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Expands the repository layout notes to cover the vendored C++ btop source and the medulla-btop crate that compiles and embeds it, plus the TUI host side behind the Resources tab, so contributors know where the btop integration lives and that its patches are tracked in vendor/btop/MEDULLA.md. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added a note to the development guide explaining that building requires a C++23 compiler because the Resources tab compiles btop from vendor/btop, and listed the minimum GCC, Clang, and Xcode versions along with the Windows exception. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a test asserting that a config still containing the old `[resources]` and `[theme.resources]` tables parses successfully, since those tables are now ignored after the Resources tab moved to btop. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The TOML fixture in the retired-resources-tables test now uses double-hash raw string delimiters so the embedded quoted values no longer terminate the literal early. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted long expressions, import lists, and closures to satisfy rustfmt, with no behavioural changes. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The navigation test now expects "Feedback" instead of "Resources" after moving down from the nav, matching the current subpage ordering. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adjust the number-key navigation test to expect the Feedback subpage on key 6 and Account on key 7, matching the current subpage ordering. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The event loop now hides the btop pane instead of shutting it down when a session ends, since a relogin re-enters the loop in the same process and btop can only start once per process. An atexit handler stops and saves btop before static destructors run, the runner thread is joined on stop, and the error query checks the length before allocating a buffer each frame. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
Warning Review limit reached
This review includes 156 billable files and costs up to $39.00. View limit details
Comment |
Tiny Sweeper reviewVerdict: Incomplete · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): feat(resources): run btop itself, embedded and focused on coding agents. Tiny Sweeper completed its review of feat(resources): run btop itself, embedded and focused on coding agents. The latest-push-delta evidence is unavailable. Unreviewed paths
Partial review reasons
Review snapshot
Completeness: Incomplete What changedResources is now btop embedded in-process. `src/btop/` (`medulla-btop`) compiles `vendor/btop` via `build.rs` with C++23, preferring `g++-14` on Linux when the default is older, and exposes `Btop` (`start`, `resize`, `send`, `set_visible`, `set_agents`, `drain`, `take_leave`, `error`, `stop`) over `vendor/btop/include/medulla_btop.h`; on unsupported targets nothing is compiled and `start` returns `StartError::Unsupported`. `src/tui/src/ui/btop/` hosts one process-wide pane: a `vt100` emulator, a cell-for-cell blit, key/mouse byte encoding, and an agent feed thread that classifies processes with the SDK classifier joined to the launch registry and hands btop `{pid, label, launched}`. `src/tui/src/ui/app/resources/mod.rs` draws that pane in the Resources tab, routes keys and mouse to it except Tab/Shift-Tab and the global chords (⌃C/⌃O/⌃T), returns to Sessions on btop's quit, and pauses btop off-screen; the event loop's waker sends `AppMsg::Redraw` instead of resource snapshots. The Rust sampler, plot widgets, panels, Agents table, Settings › Resources page, `[resources]`/`[theme.resources]` config, plan doc and screenshot, and remote-serve usage annotator are deleted; release tooling, CI and docs are updated for the new crate and compiler requirement. Features
Tests
FindingsNo active actionable findings. Before merge
Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The build script now distinguishes a missing modern compiler from a usable one and falls back to the unsupported stub with a warning instead of failing, so older toolchains like Debian 12's g++ 12 can still build the workspace. CI lanes set MEDULLA_BTOP_REQUIRED to turn that fallback into a hard error, and the shell test writes its record file atomically to avoid reading a partial file. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The Resources tab was a hand-written btop clone in Rust (~11.7k lines: sampler, plots, CPU/mem/net/disk panels, an agents table). This replaces all of it with btop itself, vendored as C++ source, compiled into the
medullabinary, and run in-process. Its process box is narrowed to coding agents.What changes
Vendored btop (
vendor/btop, v1.4.8, Apache-2.0). This is plain source, not a submodule. It was imported unmodified first (1e647da7), sogit diff 1e647da7 -- vendor/btopis exactly our patch set.vendor/btop/MEDULLA.mdlists every change.btop_embed.{hpp,cpp},include/medulla_btop.h). btop no longer owns a terminal:SIGUSR1;qand menu Quit hand control back to the host instead of callingquick_exit;$MEDULLA_HOME/local/btop/, so a standalone btop's config is never touched.CSI y;x f) andCSI s/u, which thevt100crate doesn't implement. It now emits CUP andESC 7/8.proc_agentsoption (default on, toggled withA, also in Options):agentsand shows only the agent processes Medulla names, plus their descendants (tree view on by default);◆ Claudefor agents Medulla launched, plainCodexfor external ones,↳ Claudedimmed on child processes;A.atexithook stops btop and saves its config before C++ static destructors run.medulla-btopcrate (src/btop):build.rscompiles btop withcc(C++23). On Linux it picksg++-14when the defaultg++is older, which is the case on Ubuntu 24.04.Btopis a safe handle over the C ABI:start,resize,send,set_visible,set_agents,drain,take_leave,error,stop.startreturnsUnsupported.TUI (
src/tui/src/ui/btop/,ui/app/resources/):vt100emulator fed from btop, blitted cell by cell into the ratatui frame.sysinfo, runs the existing SDK classifier and launch registry (discover_registered_agents), and hands btop{pid, label, launched}.Removed:
event_loop/resources.rs;[resources]and[theme.resources]config. Old configs still load and those tables are ignored (pinned by a test).usagewire field stays and is now always empty, so mixed-version hosts keep working.Build and release:
g++-14added to the Linux native-deps step;cargo test -p medulla-btop), so an Apple-clang gap shows up on the PR rather than at release time;medulla-btopadded toscripts/release/bump-version.sh, without which the next release's--lockedbuild would fail;DEVELOPING.mddocuments the C++23 compiler requirement.Not carried over
Esc/o).Validation
cargo fmt --all -- --check: passcargo clippy --locked --all-targets -- -D warnings: passcargo test --locked --no-fail-fast: every TUI, btop and link target passes. The SDK lib (no logic changes here; only config types removed) had one different timing test fail per full-parallel run on a loaded box (a_dead_socket_is_reaped,an_abort_interrupts_the_turn…,the_sweep_spans…). Each passes alone, and the whole SDK lib passes with--test-threads=8(2406/2406).bash scripts/release/test-bump-version.sh: pass. It fails without themedulla-btopentry.bash scripts/check-public-boundary.sh: passqhands back, second start refused);Atoggle,qback to Sessions, pause and resume);--mock, 170×45 and resized to 120×36): btop renders natively, the agents box shows the live Claude and Codex trees,Aand Esc work,qreturns to Sessions, btop's threads sit idle while hidden, and ⌃C exits 0 withbtop.confsaved.