has_live_connection() and offline_file_access() decide when raw byte I/O
on a live database is safe (closing any raw fd cancels the process's
POSIX locks on the file; #100519). They only see connections opened
through connect_tracked, and several in-process readers used a bare
sqlite3.connect. The read_file SQLite extractor also open()/close()d the
file to check its magic bytes, which cancels the gateway writer's locks
when the agent reads its own state.db.
Route those opens through connect_tracked with tracking_path (same
URIs, timeouts and flags): gateway readiness, the lifecycle ledger's
integrity and journal-mode reads, the API server response store, the
spillover reference scan, install state, doctor, the repair damage
check, shared metrics, the worktree liveness reads cron's sweep runs in
the gateway, backup verification, the restore destination and epoch
reads, the downgrade guard, approvals suggest (whose hand-built URI also
skipped percent-encoding) and the journal-mode switch. The read_file
magic check goes through read_header_bytes_preopen. Offline opens
(snapshots, staging copies, the stdlib-only backup copier) take a
documented HX015 waiver.
Add HX015, "untracked sqlite3.connect on state.db", an advisory
heuristic rule until a replay shows it can block.
Fixes#149276
The rule text promised migration when a function is next edited; the ratchet compares lines, so an
edit around an old call never required it. Say what it does, and pin it with a test.
Round-2 review findings:
- A raw terminal mapping could still replace the bound profile's policy with
another profile's. Raw policies now go through bind_terminal_policy(policy,
profile_home=...): inside a bound scope only the bound agent's own policy is
accepted. The four callers pass the session's owning profile.
- A partial bind (home_override=False) inherited the home override from an
earlier change, so resetting that change took it away. A bind now copies the
pieces it keeps, so it is whole on its own.
- bind_state switched directly between hosted agents and tenants. Inside a
hosted scope only a bind of the same tenant and agent is allowed.
- Setters whose tokens are discarded grew the state chain without bound. Changes
that can no longer be reset fold together on the next push.
- A cross-profile install_profile_terminal_scope dropped its env_overlay.
- HX016 flagged a bare 'from . import set_secret_scope', whose module it cannot
know.
- The TUI heap-trim ordering test observes the whole-profile release.
Review found three ways around the guards in the first commit: set_terminal_scope
was unguarded (four production callers), set_secret_scope(None) cleared secrets
alone so get_secret fell back to the launch profile, and a stale or out-of-order
reset token moved one piece back while the others stayed. Guards around three
separate context variables leave every unguarded path able to split them.
The four pieces are now one immutable ScopeState in one context variable. Every
setter is a change to that value; a reset removes its own change and replays the
later ones, dropping those made inside a scope the result no longer has, so any
reset sequence lands on a state whole binds produce. Leaving a hosted agent by
any reset other than the bind that entered it refuses.
- set_terminal_scope narrows a bound local scope's own policy; clearing it, or
setting it in a hosted scope, refuses. set_secret_scope(None) inside a scope
refuses.
- bind_profile_scope and bind_state refuse a local bind inside a hosted scope.
- The TUI turn holds one token instead of four; housekeeping still runs under
the session's whole profile scope and the release resets it at once.
- HX016 sees relative imports and no longer flags a local object named like a
setter's module.
- The historical updater reads the override through get_hermes_home_override
when hermes_constants no longer exposes the raw context variable.
Profile state lived in three independent globals (home override, secret
scope, terminal policy) that every entry point set separately, so they could
describe different profiles. 85 call sites set them by hand.
hermes_scope.Scope(tenant, agent, actor) is now the single value, in one
contextvar; actor is Principal(id) or System(reason), and TurnScope adds
session and turn. agent/runtime_scope.py is the one module that turns a scope
into profile state: bind_profile_scope binds and restores all of it together.
The process's own home keeps its launch semantics; any other home is hydrated
from that profile's sources and stamped as routed.
The legacy setters keep their signatures. Inside a bound scope, a call naming
another profile moves the whole scope (local) or raises ScopeSwitchRefused
(hosted). Gateway turns, cron, the TUI, model switch, kanban spawn and the
managed worker bind once at entry. HX016 blocks new direct setter calls;
existing ones migrate when their function is next edited.
`hermes profile create`, `POST /api/profiles` and the Desktop/TUI
`profiles.create` RPC each called `create_profile()` and then ran their own
post-create steps (skills, alias, credentials, model, MCP servers, skill
selection). The same "new profile" therefore came out different
depending on where it was started, and a fix to one surface missed the
other two.
Add `hermes_cli/profile_provision.py` with
`provision_profile(ProfileCreateRequest) -> ProvisionResult`. Every surface
now builds a request and renders the result. `create_profile()` keeps the
folder work (validate, copy, strip channels, stage, publish, notify);
`provision_profile` runs every later step in one fixed order. A failing
later step never undoes the create: it is a warning in the result, as the
dashboard and RPC already treated it.
- The dashboard's model / MCP / skill-selection writers and the RPC's
launch-credential mirroring moved into the module; the routers import
them. Every config read-modify-write during create now holds the
dashboard's `_CONFIG_MUTATION_LOCK` (MCP servers, voice sections,
endpoint seed and base_url restore were unlocked on main).
- Plugins get no step here: since main's 6933155eaf the core create calls
the selected memory provider's on_profile_created hook, so every surface
already gets the provider's per-profile files.
- `scripts/check_profile_create_entry.py` (scripts/check, lint.yml) scans
every production Python file and fails on any use of `create_profile`
outside its definition and the new module: calls, imports, aliases, the
function passed as a value, getattr by name, and files that do not parse.
Behaviour is unchanged on purpose: each surface passes the options it used
before (only the RPC mirrors launch credentials). Two small differences,
both on failure paths: a failing post-create step in the CLI prints a
warning instead of a traceback, and the RPC writes SOUL.md during the core
create (as the dashboard already did), so a failed write fails the create
instead of returning soul_written=false.
Outside CI, HERMES_PYTHON is often inherited from a wrapped hermes (the TUI
sets it for its children) and names a release venv without the dev tools.
scripts/hermes-python ran that interpreter for any unactivated shell, so
just check, just fix and the lefthook ruff hook could run on it instead of
the checkout's environment. The shortcut now also needs
GITHUB_ACTIONS=true, the only caller the header names.
Co-authored-by: Bear Huddleston <196404565+BearHuddleston@users.noreply.github.com>
setup-pm installs the just pm/lock.json pins (python, node and all
toolchains) and forwards just-version and just-path. Three workflows then call
recipes instead of spelling the command out:
- lint.yml: each guard step runs `just check --only <name>`, so the guard list
lives once, in scripts/check. Adding a guard there and forgetting lint.yml
no longer leaves CI running a different set. The ratchet step is
`just check --only health --base HEAD^1`.
- tests.yml: the sliced full-suite step is `just test-all`.
- js-tests.yml: the parallel workspace checks are `just check-js-ci`.
Python recipes run through scripts/hermes-python: on a runner it uses the
interpreter setup-pm exported as HERMES_PYTHON (as run_tests.sh does), so a
recipe never re-runs setup in CI. Elsewhere it goes through run-in-hermes-env.
--require-paths checked positional paths, --files and --files-from, so
`just test --paths tests/agent/` was refused as if it named nothing. A
--paths value other than the default root counts as a named path.
- `just test -v` passed the recipe's one-argument check and then
discovered all of tests/. The runner takes --require-paths, which refuses
a run naming no path or file list, and `just test` passes it.
- `just test-js` ran the TUI tests before @hermes/ink was built. It builds it
first, as the TUI's own `check` script does.
- `just lock` went through run-in-hermes-env, which syncs first; after a
pyproject.toml edit the sync refuses the stale uv.lock before pm lock runs.
scripts/relock.sh runs pm lock with the bootstrap Python, then syncs.
- `just setup` on Windows called pwsh, which a stock Windows does not have.
It uses powershell.exe, as activate.ps1's own caller does.
The justfile held per-workspace eslint recipes that duplicated lefthook and
ran whatever ruff was on PATH. It is now one menu of developer commands:
setup, check, fix, test, the JS workspace checks, the desktop and TUI dev
servers, the website build and the PM re-lock. Each recipe calls an existing
script or tool. Python recipes go through scripts/run-in-hermes-env, so they
work in a shell that never ran `source ./activate`.
`just test` requires at least one path, because scripts/run_tests.sh with no
arguments starts the full suite; `just test-all` is that explicit form.
`python -m scripts.code_health.ruff_runner ARGS` runs the pyproject-pinned ruff
that scripts/check resolves. `just fix` and the pre-commit `just ruff` recipe
use it, so the hook no longer depends on the ruff version on PATH.
lefthook.yml keeps its jobs, globs and roots; each job now runs `just ruff` or
`just eslint`. A shell without `just` on PATH fails the hook with "command not
found" rather than skipping the lint.
CONTRIBUTING.md, the developer guide, the package-management reference and the
desktop and TUI READMEs name the recipes beside the commands they run.
No workflow runs a just recipe yet, so installing just in every setup-pm
job only added a download, and one with no mirror copy until the pin lands
on main. setup-pm goes back to main. The workflow change that first calls a
recipe adds just to CI with it.
scripts/tool_store_pins.py decides whether run_tests.sh may share the
account tool store. It checked the tools cmd_install provisions but not the
developer tools, so a store with a missing or broken just was shared and the
test-environment install could then rewrite it. It now walks them too.
Setup asked for just by name: `pm install --test-environment` and every
setup-pm toolchain. A lockfile without a just pin (an older branch, a test
fixture repo) then stopped setup with "just: not in the lockfile", and
archive_inputs refused it as an unknown pinned package.
Both paths now take the developer tools from the lockfile they read, so a
lockfile without just installs without it. The repository lock pins just,
so developers and CI still get it.
Add a `just` binary package (casey/just 1.59.0, musl on Linux, the static
aarch64 musl build on Termux like ripgrep) and pin all nine targets in
pm/lock.json. Digests come from GitHub's release API, as llama.cpp's do.
They match upstream SHA256SUMS.
The package is optional, so `source_install_packages` keeps it out of
every user install. `pm.testenv.DEVELOPER_TOOLS` names it, and
`pm install --test-environment` (what activation runs) installs it with
the default closure. activation_environment then puts it on the activated
PATH. setup-pm installs it in every toolchain, so every CI job can call
`just`.
Windows ARM64 just.exe imports no vcruntime140.dll (PE imports checked),
so it needs none of ripgrep's VC runtime staging.
run_tests.sh forwarded HERMES_E2E_UPGRADE_BASE and HERMES_E2E_N1_REF
but dropped the suite's other knobs: HERMES_E2E_INSTALL_REF (installs a
patched commit to prove a leg red), HERMES_E2E_GIT_OBJECTS (an extra
object store for the smart-HTTP origin) and HERMES_E2E_KEEP_ROOT. Set
through the runner, they were ignored without a message. None is a
credential.
Part of #150040
install.ps1 keeps its store under HERMES_RUNTIME_DIR, else under HERMES_HOME. run_tests.sh never
forwards HERMES_RUNTIME_DIR (4bc973abd3), so every -Stage repository process the native-calls
tests start with a fresh temporary HERMES_HOME found no Git and downloaded and extracted
PortableGit from github.com: four downloads in that file. The iex-failure tests' empty git.exe
placeholders stopped satisfying Get-PinnedGit once it began checking for git-remote-https
(9976c9b04d), so they downloaded too. On a slow or 504ing github.com the native-calls file
blew the 300 s per-file limit on the Windows arm64 lane (306.9 s; 112-157 s on green runs).
A session fixture hands these tests a ready store: the one setup-pm already staged (the pinned
Git first on PATH, checked for git-remote-https), else one Get-PinnedGit fills once.
The aux, compressor and turn paths each grew "is this a <kind> error?"
helpers that read an exception's status_code or grep its text; every
copy drifted from classify_api_error until the previous commit moved
the aux decisions onto the shared classifier. HX014 keeps new copies
out.
What it flags: a def or lambda with an exception parameter (exc/err/
error/e/ex/exception, *_err/*_error/*_exc, or an *Exception/*Error
annotation; a ClassifiedError parameter is not one) whose own body reads
<param>.status_code (also via getattr or .response) or probes the
exception's text (`in str(exc)`, a local bound to that text,
startswith/endswith, re.search/match/fullmatch, _contains_any). Scope:
agent/auxiliary*.py, agent/context_compressor*.py, agent/turn_*.py,
tests excluded.
Like the other HX rules it ratchets base vs head, so existing hits are
grandfathered. Waiver: `# health: allow HX014 -- <why>`.
Tests: tests/scripts/test_code_health_error_predicate_rule.py covers
flagged and passing shapes, scope and the base-vs-head verdict.
Part of the Code Health plan.
The rule-17 archive scan refused a data corpus tarball because one member
was a .jsonld context (siblings: 34k .json files, two .ttl files). Those are
plain-text RDF serialisations, as reviewable as the .json and .xml already on
the source list, so dike's pinned corpus failed pinned-source-validate for a
reason that is not a payload.
Class bodies and match cases run at import, and the import branch of
an 'if __name__ != "__main__"' guard is the body, not the else. Removals
(remove, pop, clear, del) change the search path too.
scripts/install_root_lint.py scans the shipped packages and root modules. It
counts __file__ path expressions that climb as many directories as the file
is deep (.parent, .parents[n], os.path.dirname, os.path.join with pardir),
and sys.path edits that run at import. Today's 106 climbs and 13 import-time
edits are the baseline; a file whose count rises fails, and the message names
hermes_cli._startup_fast.project_root_str() as the call to make instead.
Wired into scripts/check (install-root) and the lint workflow.
A source module moved under tests/ was skipped, and a test file moved
out of tests/ was compared as source. The base path now decides which
comparison applies. The cap and src/ canaries no longer follow the
values they check.
A renamed file whose path git quotes (non-ASCII) was dropped by the
.py suffix test, and a move out of the source roots was skipped because
only the new path was classified.
Three guards could report success while they checked nothing:
- The public-surface check listed only modified files, so a moved
file (git reports a rename) was never compared. It now pairs each
renamed file with its old path, and treats src/hermes_agent/ as
source.
- The change classifier read file names from the compare API, which
stops at 300 files without saying so and drops the old path of a
rename. A list at the cap now runs every lane, and a rename counts
under both of its paths.
- Tree guards skipped a scan root that did not exist. The config
reader and writer checks, the subprocess stdin check and two guard
tests now fail when a root they scan is missing.
The Python import probe parsed production source, which tests may not do.
Key scripts/bundles/*.py, scripts/build/*.py and apps/desktop/scripts/*.py
by glob, as pm/*.py already is, so a new module or late import there needs
no list edit; shared modules outside them stay listed. The Python test now
reads only sys.modules after importing the entry points, and a new test
proves a module added to a globbed package changes the key.
The Node graph check moves to tests-js, where JS-only PRs run it; it calls
desktop_build_cache.py's CLI for the key, and classify_changes routes an
edit of that owner to the JS lane too.
The previous change keyed the Node half of the preparation graph only.
desktop_prepare.py and the helpers it calls also import, mostly inside
functions, scripts/bundles/{desktop,payload,bytecode,msix_names}.py,
scripts/releases/{versioning,semver,bundle_env,commit_build}.py,
scripts/termux/deb_version.py, and hermes_cli/hermes_constants/
hermes_platform modules. Key those too.
A new test imports the Python entry points in a subprocess, follows the
late imports of the functions that can run (only the names each importer
takes, so setup_toolchain's archive-inputs subcommand stays out), fails
on a broken repo import, and requires an edit to every repo module that
loads to change the key. The Node probe now converts URLs with
fileURLToPath. Both probes miss dynamic import() in functions that do
not run at import time and PowerShell dot-sourcing; those stay listed
by hand.
The desktop dependency-cache digest listed node-deps.mjs and
electron-runtime.mjs but not the modules they import (pnpm-lock.mjs,
frontend-common.mjs, python.mjs, apps/desktop/scripts/utils.mjs,
macos-sysroot.mjs), the Python helpers desktop_build_cache.py and
native_prepared.py import (scripts/ci/pnpm_lock.py, scripts/build/inputs.py),
or scripts/build/windows-deps.ps1, the provider pm/native_build.py runs. An
edit to any of them reused a cache keyed on the old code.
The test resolves the module graph of the preparation programs with Node's
resolve hook and requires an edit to each module to change the key.
The pnpm version lived in pm/lock.json and in root devEngines, kept equal
by a sync writer on every pnpm re-pin. node-deps.mjs, the only reader of
devEngines, now reads pm/lock.json. That drops root devEngines, the sync
writer and its test, and setup_toolchain's workaround for the
EBADDEVENGINES warning npm printed on every command in the checkout.
Core keys left out the importing file and module keys lumped every file
of a module together, so two PRs adding the same target from different
files both ran --update to the same count, merged cleanly, and left main
one above the baseline.
Key every baseline entry as `<importing file> <target>` (repo-relative
path, line dropped). Additions in different files are now different
JSON lines. A file importing one target twice still counts 2 under one
key. Moving an import to another file now reads as a swap and needs
--update.
Totals are unchanged (830 / 29) across 789 + 21 keys.
Known limit: two PRs adding the same target in the same file still
merge to a count one above the baseline; CI on the merged head
catches it.
The baseline held one count per direction, so two PRs that each accepted
a different new import with --update made the same edit (830 -> 831),
merged cleanly, and left main at 832 against a baseline of 831.
Key the baseline per crossing instead: `<module dir> <target>` for a
module's import, the target alone for core's. Two accepted imports are
now two different JSON lines, moving an import between files of one
module (or between core files) keeps its key, and a swap (one removed,
another added) still fails. --check names the new crossing and says how
to accept an intended one.
Totals are unchanged (830 / 29) across 776 + 16 keys.
Also cover dashboard-manifest modules, relative imports and the core-side
TYPE_CHECKING skip in a tmp-tree test.
A core import line naming several modules (`import plugins.web.exa,
plugins.web.firecrawl`, `from plugins.web import exa, firecrawl`) was
counted once. Collapse spellings per alias instead, so each distinct
module counts. Counts on this tree are unchanged (830 / 29).
Also state the ratchet precisely: CI fails when a direction's total
rises above the committed baseline; reductions stick only after
`--update`.
Adds scripts/boundary_lint.py, a report-only import lint in both
directions: bundled modules importing Hermes internals that are not on
the published plugin API (hermes_cli/data/plugin_api.json), and core
code importing a specific bundled module. The current counts are
recorded in scripts/boundary_lint_baseline.json; a test in
tests/scripts fails only when a count rises above it.
Refs HACORE-116
pnpm 12.15.0 (native executable) installs every JS workspace from one
pnpm-lock.yaml, imported from package-lock.json with the same resolved
versions. website/, the WhatsApp bridge and the photon sidecar stay separate
npm projects.
Configuration moves from .npmrc and the root manifest into
pnpm-workspace.yaml: the 14-day minimumReleaseAge and its excludes,
overrides, allowBuilds (the old allowScripts set, with strictDepBuilds
failing any unlisted build script), engineStrict, sideEffectsCache: false
(in-place rebuilds must not write into the store) and
verifyDepsBeforeRun: false (a `pnpm run` never installs).
The pnpm version is pinned in pm/lock.json and in root devEngines.
pmOnFail: ignore keeps that pin out of pnpm-lock.yaml: a leading pin
document makes osv-scanner read zero packages. scripts/build/node-deps.mjs
enforces the exact version instead, and every lock reader refuses a
multi-document lock. A root preinstall refuses `npm install`; devEngines
onFail is warn so npx (MCP servers, the tsc linter) keeps working inside
the checkout.
User-machine installs run --frozen-lockfile --trust-lockfile (release age is
checked when locking, in CI, not per user). node-deps removes npm-era
node_modules trees before the first pnpm install. Nix builds the store with
fetchPnpmDeps and a hash file that CI checks.
Publishing v0.23.0 committed the Microsoft Store submission, and Partner
Center answered POST .../commit with 202 Accepted and status CommitStarted.
The submission API helper only accepted 200, so the publication pass logged
"commit failed: 202 {'status': 'CommitStarted'}" and told the release owner
to check Partner Center by hand, even though the commit had started.
Any 2xx is now success. The fake Partner Center in the tests answers a commit
with 202, as the live API did, so the six tests that commit a submission fail
on the old check.
With MS_STORE_HOLD set after a build was committed Immediate, the API
refuses the switch to Manual and the pass told the operator to select
Publish now, though the build goes live by itself once certified. A
refused switch now reads the committed mode: Immediate reports that it
publishes on its own and that the hold cannot apply.
Committing the Store draft at publication makes every certified build go
live by itself, with no way left to keep one back for a chosen release time.
Setting the repository variable MS_STORE_HOLD=true makes the publication
pass commit the draft Manual instead: it is certified and then waits for
Publish now in Partner Center, with a warning that says so. A rerun of a
held submission is a no-op and never flips it to Immediate. Unset keeps the
auto-publish default.
Also quote the real v0.22.7 refusal (state 'PreProcessing') and update the
stable-releases developer guide, which still described the held commit.
The green run committed the Store submission held (Manual) and the
publication pass tried to switch it to Immediate. Partner Center refuses
to update a committed submission (v0.22.7: 409 InvalidState, "Cannot
update the submission because it is in certification"), so every
release needed Publish now by hand.
stable-store now leaves an uncommitted draft set to Immediate, and the
publication pass commits it. Nothing reaches certification or customers
before the release is published, and the build goes live as soon as it
passes certification.
scripts/releases/desktop_targets.py holds the (electron platform, arch)
triple and derives the manifest spelling and the native handoff legs from it.
channel_artifacts, channel_publish, channel_releases, stable and the builds
table read it instead of five hand-written copies, and NATIVE_LEGS has one
definition instead of two.
read_native_receipts always reads every native leg, so its legs parameter
and _leg_targets go. A claim with includeMacosIntel: true now says why it is
refused. Tests iterate the targets directly instead of skipping a 2x2 case.
Review (BearHuddleston): _run_one_file_once copies os.environ before it calls
start_pytest(), which is where the first file pops the knob. So the first
file, and any others in the opening wave, still carried it: 1-3 files of 200
at -j 32 in every run. A test that starts the runner or run_tests.sh from one
of those files would silently run its nested suite under the fork server,
and _longest_first now puts the slowest cached files, the runner's own tests
among them, at the front of each slice.
start_pytest drops the knob from every file's env, on both launch paths. The
parity probe's first file asserts the knob is absent (it saw '' before), and a
24-file opening wave at -j 12 asserts no file sees it.
Mutation check: with start_pytest returning no process group for a forked
child, every fork test still passed, because the hang probe had no
grandchild and the leftover sweep finds processes by their temp root. The
probe now starts a grandchild without that root in its env, which only the
group kill can reach, and the test asserts it is gone.
Review: the fork probe compared multiprocessing names and fields but never
started a worker from inside the forked file, which is what
_become_main_process() exists for. The probe now runs a spawn Pool and a
default-context Pool and compares each worker's result, TMPDIR and
gettempdir() with the subprocess run.
Review: the fork mode spread its server state, lock, process creation and
process-group rules through the runner, so _run_one_file_once had to know that
a forked child calls setsid() while a subprocess needs getpgid(). The runner
now calls start_pytest() and gets the process and its group back; the fork
server, its lock and the Popen shim live with it. Behaviour is unchanged.
classify_changes lists the launch module and the fork child as test harness
next to run_tests_parallel.py, so editing either starts the lanes a runner
edit starts (the fork child was missing since it was added).
Under the fork server multiprocessing still saw each file as the server's
child: current_process() was ForkServerProcess-N with a parent, every file
after the first inherited the runner's /tmp/pymp-* temp dir, and __main__ was
this runner, re-run in every child as __mp_main__ (~7-20ms per file). A
test's own Process, Pool or spawn context now sees what python -m pytest gives
it: a parentless MainProcess, a temp dir under its TMPDIR, and pytest as
__main__ and __mp_main__; the server preloads the runner once. The fork probe
compares these against a fresh pytest process, from the server's second child.
Also from review: run_tests_fork_child.run takes keyword arguments and one
argv; the start-under-lock is one helper the race test calls, and the test
starts 2000 children (unlocked, ~1 status in 400 comes back 255), so dropping
either lock fails it; kill() leaves a reaped pid alone; the output file is
removed when start() fails; the exit-status note skips exit 1 (tests failed,
already reported) and crashes; the 2.0s default duration is one constant; the
new tests reuse the file's runner helpers. The docstring records the gap left:
a daemon a test forks without exec escapes the leftover sweep.
multiprocessing's Process.start() polls every live child
(multiprocessing.process._cleanup). With the fork server, a child's exit
status is 8 bytes the server writes once on the child's status pipe. When a
worker thread starting the next file polled a child at the moment that child's
own thread called join(), one read got the status and the other got EOF, which
multiprocessing reports as exit status 255. A green file then failed with no
error (CI: tests/agent/test_openrouter_silent_default_purge.py, 5 passed, exit
255). Stress repro: 283 of 3000 children reported 255; 0 with this change.
Wait on the sentinel without reading, then join and read exitcode while holding
the lock that also serialises start().
A file can pass every test and still exit non-zero. Its failure dump showed
only the green pytest summary, so the cause (an exit-time hook, a status set in
sessionfinish, a signal) had to be rediscovered by rerunning the whole suite.
Append the child's exit status to the captured output.
Drives run_tests_fork_child.run from a stand-in server that has its own
variable and has already asked gettempdir(). Without os.environ.clear() or the
tempfile.tempdir reset, the probe file fails.
The pool starts files in submission order, which was path order, so a slow
file late in the alphabet (tests/tui_gateway, ~40s each) ran alone at the end
of a slice while the other workers sat idle. Submit by cached duration,
longest first; the cache is already restored on CI for the timeout scaler.