processes: queryable guest process-tree plugin + bulk OSI walk (epic B slice 1) - #897
Open
lacraig2 wants to merge 3 commits into
Open
processes: queryable guest process-tree plugin + bulk OSI walk (epic B slice 1)#897lacraig2 wants to merge 3 commits into
lacraig2 wants to merge 3 commits into
Conversation
lacraig2
force-pushed
the
workspace/proctree-ux
branch
from
July 18, 2026 14:12
eb7cb17 to
a0c521a
Compare
…B slice 1)
Adds a `processes` analysis plugin giving users and the MCP agent a model of
the guest process tree, with two surfaces:
- Live query API (portal generators, MCP-shaped stable returns): get(pid),
tree() -> {roots:[...]}, snapshot(). Built on a single kernel-side bulk walk
(osi.get_all_procs -> HYPER_OP_OSI_PROC_ALL) rather than 1+N per-pid reads.
- DB-backed lifecycle -> derived artifact: exec_event -> ProcStart,
exit/exit_group -> ProcExit (identity read off syscall.pid, denormalized by
the driver -- zero round-trips, no read of the dying task). At teardown the
plugin flushes + queries the DB and renders system_map.yaml
(ProcStart LEFT JOIN ProcExit on (pid, create_time); structured records +
an ASCII tree literal block).
Supporting changes:
- osi.get_all_procs(): paginated decode of the slim osi_proc_node array.
- pengutils.events: lean ProcStart / ProcExit event types.
- loggers/db.py: synchronous flush() + query() (plugins unload in reverse load
order, so a consumer's uninit runs before the DB's own final flush).
Tests (host-side, penguin.testing harness): test_processes.py (event->DB,
DB->render, live join via doubles), test_osi_bulk.py (real-ISF ABI roundtrip,
skips unless a driver build with the op is provided), test_db.py flush/query.
Depends on rehosting/igloo_driver#88 (HYPER_OP_OSI_PROC_ALL + syscall_event
pid). The live query API needs that driver; the DB-backed system_map works
today. Bump IGLOO_DRIVER_VERSION once #88 is released.
test_osi_bulk now FAILS (not skips) when the pinned driver ISF lacks the op -- a host plugin calling an op its pinned driver doesn't carry is a real incompatibility, and a silent skip reads as green. The testing harness now version-keys the ISF cache (.isf_cache/<version>/...) so a driver-pin bump can't be masked by a stale cached ISF. Documents the release-ordered ABI-test rule in PYPLUGIN_COVERAGE_PLAN.md. (Driver pin itself now rides main: 0.0.93.)
lacraig2
force-pushed
the
workspace/proctree-ux
branch
from
July 30, 2026 18:34
a0c521a to
f36f7d2
Compare
Add exit_monitor (surfaces the do_exit kprobe's exit_event over IGLOO_HYP_PROC_EXIT, decoding wait(2)-status) and wire processes to it behind an opt-in `use_do_exit`. When enabled it is the single exit source: it captures fatal-signal deaths (SIGSEGV/SIGKILL/...) that the exit/exit_group syscall hooks miss -- those die via do_exit and issue no exit syscall -- with the real exit code, and supersedes both the syscall hooks (now not even registered, so no redundant per-exit firing) and the host-side signal heuristic (no caught-signal false positives). Disabled by default; the driver arms the kprobe lazily on enable, so an un-opted-in run pays nothing. Bumps IGLOO_DRIVER_VERSION to the release carrying the hook and adds test_exit_hook_abi as a forcing function (fails until the pinned ISF carries HYPER_OP_REGISTER_EXIT_HOOK / IGLOO_HYP_PROC_EXIT / exit_event), mirroring test_osi_bulk. Unit suite 691 passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Slice 1 of the "system cartography" epic (epic B): a genuinely usable way for both users and the MCP agent to engage with the guest's process tree. Inspired by #699 (Proctree) but a cleaner, DB-backed design.
Two surfaces
AI / MCP — stable, documented, JSON-serializable live query API (portal generators,
yield from):processes.get(pid)→ flat record orNoneprocesses.tree()→{"roots": [node, …]}(nested)processes.snapshot()→{"processes": […], "tree": {…}}These read the whole process set in one kernel-side bulk walk (
osi.get_all_procs→HYPER_OP_OSI_PROC_ALL) — one RCU-consistent snapshot instead of1 + Nper-pidget_procreads that could tear.Users — a legible artifact. Lifecycle is recorded to the event DB and
system_map.yamlis materialized at teardown: structured per-process records plus an embedded ASCII tree.Persistence (DB-backed)
exec_event→ProcStart(identity/genealogy: pid, ppid, create_time, comm, ids). argv/env stay on the existingExecevent.exit/exit_group→ProcExit. Identity comes offsyscall.pid/syscall.create_time(denormalized by the driver) — zero portal round-trips, no read of the dying task.system_map.yaml=ProcStart LEFT JOIN ProcExiton(pid, create_time), re-exec coalesced. Because plugins unload in reverse load order (this plugin'suninitruns before the DB's final flush), teardown calls a new synchronousDB.flush()thenDB.query().Supporting changes
osi.get_all_procs()— paginated decode of the slimosi_proc_nodearray.pengutils.events— leanProcStart/ProcExit.loggers/db.py— synchronousflush()+query().Driver-side safety
Live walk + exit path touch only kernel
task_struct(comm, skip!mm); neveraccess_remote_vmon userspace, so nothing faults on an exiting/stopped context.Tests (host-side,
penguin.testing; no PANDA/guest)tests/unit/test_processes.py— event→DB emission, DB→render, live tree/get/snapshot join (via doubles).tests/unit/test_osi_bulk.py— real-ISF ABI roundtrip ofget_all_procs(skips unless pointed at a driver build carrying the op).tests/unit/test_db.py—flush()/query().Full
tests/unitsuite green.Live validation
Booted an armel/6.13 guest with the driver from rehosting/igloo_driver#88:
system_map.yamlcaptured 72 real processes with correct genealogy, re-exec, and exit codes (proving thesyscall_event.pidpath), and a probe exercisedget_all_procs/snapshot()live throughHYPER_OP_OSI_PROC_ALL.Dependency
Requires rehosting/igloo_driver#88 (
HYPER_OP_OSI_PROC_ALL+syscall_event.pid). The live query API needs that driver; the DB-backedsystem_map.yamlworks today. Follow-up: bumpIGLOO_DRIVER_VERSIONonce #88 is released (thentest_osi_bulkruns unskipped in CI).Scope / follow-ons
Slice 1 only. Deferred: thread/kernel-thread enumeration, fd/peer graph, maps/lib inventory, CPU/scheduling,
get_ptregs.