Repository navigation
feat: add the Process View - #238
Merged
Merged
Conversation
… on linux A Plugin Server was not started in a process group of its own, so killTree could not end its group and ended the Plugin Server alone. A child it started kept running after a restart and after the Host stopped. The test with the stubborn-parent fixture showed it, and now proves the whole tree ends.
…n's facts Every Plugin Server starts with FIRSTMATE_PLUGIN set to its Plugin's name. In a wsl Place the start is env FIRSTMATE_PLUGIN=<name> ./mcp, because Windows hands no variable across. The Supervisor keeps each run's PID, start time and the reason it stopped, and gives them out through runOf.
…linux A Plugin Server that ended on SIGTERM, or on its own, left a child that ignored SIGTERM running. The Host now sends SIGTERM to the whole group, and kills what is left of the group once the Plugin Server has ended. The parting-parent fixture proves it after a restart, a Host stop, and an end of its own.
logs -f took its start from the size of the log after it printed it, so a line written in between was counted as printed and never shown. Under load this made the logs -f test fail.
… firstmate usage GET /processes.json gives FirstMate's own row, then one row per Plugin in the Plugin Order: state, Place, PID, process count, CPU against one core, fair-share memory (PSS), start time, and why when Stopped. Only the App and a terminal may read it. The Host reads /proc when asked, finds a Plugin's processes from its Plugin Server and by FIRSTMATE_PLUGIN, and keeps only the last reading of each process, to count CPU between two readings. With no reading younger than 5 seconds it reads twice, half a second apart. firstmate usage [--json] prints the same rows. The Mate's primer names it.
# Conflicts: # README.md
…figure to a new reading
Once a Plugin Server ends, the Host sends SIGTERM to what is left of its process group, and SIGKILL only to what is still there five seconds later. A restart and a Host stop wait for it. The Plugin guide says so. A start hook that names the App's own PIDs and throws is said once in the log, and again only after it has worked (ADR-0022). Usage takes the home its readers compare against from start.ts, and names whose processes a row counts instead of a null flag. Tests: the tree test matches the child's line on the output after the restart, with no stateful /g pattern; tests share isRunning and untilTrue in tests/helpers/processes.ts; the fake wsl.exe reads only the processes that name a Plugin.
…count only plugins for the place column - /processes.json gets its own 25 s limit, above the Host's own, so the first reading on Windows is not cut off. The other asks keep 5 s. - A fault while a reading is shown is said once, and the polling goes on. - The Place column shows only when the Plugins are in more than one Place, as firstmate usage has it: FirstMate's own row does not count. - The sort asks are escaped in their attribute, as the restart ask is. - The page script runs the source of core's cpuText and memoryText instead of a copy of them. - One type for the sort asks, ProcessesAnswer for what /processes.json said, Polling for the reading's timer, one function for the cells of a Plugin with no Plugin Server, and one list of the App's own views and one map of the views an aside shows.
…and keep the short help under 30 lines
…ss table ADR-0021 gets a dated note: a wsl Plugin Server starts as env FIRSTMATE_PLUGIN=<name> ./mcp (ADR-0032), and ADR-0032 names ADR-0021. AGENTS.md "Testing" says a test may look at the process table to prove which processes run or end, never at a module of the Host, and names the shared helper.
…page A renderer of an App view whose page was blank or still loading, or one Electron keeps ready for the next page, fell out of FirstMate's row, so the row and the process table disagreed on CI.
Electron does not name the broker it starts when the GPU process draws in software, as under Xvfb, so the row cannot count it, like the zygote.
…n the App count differs
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 this changes
Adds the Process View: the App's own page that shows every Plugin's state and Usage (CPU of one core, fair-share memory), and FirstMate's own Usage first. The Host reads Usage when asked and keeps none of it (ADR-0032). The same numbers come from
GET /processes.jsonand the newfirstmate usagecommand.Spec: #228.
Closes #228
Closes #229
Closes #230
Closes #231
Closes #232
Closes #233
Closes #234
Closes #235
Closes #236
Closes #237
Before you ask for a review
pnpm checkis green: types, lint, format, knip and every test.README.mdis updated: new variableFIRSTMATE_PLUGIN, new address/processes.json, new commandfirstmate usage.env FIRSTMATE_PLUGIN=<name> ./mcpstart in awslPlace.ADRs this touches
wslstart now carries theFIRSTMATE_PLUGINmark.Also in this branch
firstmate logs -fnow starts from the last byte it printed. A line written between the print and the size check was lost; it madelogs-command.test.tsflaky under load. No ticket asked for it.smaps_rollup(not dumpable), the Host counts its resident memory (VmRSS) instead of 0. This over-counts shared memory; ADR-0032 says so.app.getAppMetrics()after/procshows it. Two diagnostic commits and their revert (af4316c) are in the history: squash on merge.Known gaps
maintakes with docs: follow Conventional Commits in every commit message #239.