Repository navigation
Waits: a unit wait on a unit systemd does not know is refused when asked (#852) - #1377
Conversation
…ked (#852) A unit systemd does not know counted as ended, so a wait asked before the unit started (a parent waiting on its child's unit) was met at once, every time it was asked: each one a paid turn and no real wait. At registration such a unit is now refused (`invalid`, with the way out). `unit.missing: "ended"` keeps the old answer for a unit known to have run and been forgotten. A stored wait still ends when systemd forgets its unit, and the default is left out of the stored spec, so older waits keep their key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The wait_for description now says a unit systemd does not know is refused, and its input gains unit.missing, so the fork's MCP tool list grows from 4873 to 5025 bytes. Set forkAgentContextBudget.json to the measured value, as ForkAgentContextBudget.test.ts asks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
lens: code · reviewer: claude (code lens, round 1) · read at: a18fd33 blocker: none Reproduction (unit judge that sleeps 10 s for Checked and fine:
State question: run again, so the same request after an upgrade has the same key and finds its stored wait. Stops half-way, so a refusal stores nothing, and a late answer fails closed as 🤖 Generated with Claude Code |
…s busy (#1407) When both unit check places stayed busy past the registration limit, a unit wait was stored without systemd being asked, and its first sweep ended an unknown unit as `ended` at once: the answer #1377 removed. Such a wait is now refused (`too_many`, try again) and nothing is stored. With `unit.missing: "ended"` an unknown unit ends anyway, so that wait is still stored for the sweep. `missing` stays in the key only as "ended", so older waits keep their key; the tool text and docs now say the two forms are separate waits. The fork tool list grows from 5025 to 5063 bytes. Co-authored-by: Claude Opus 5.5 <[email protected]>
Part of #852 (the second point of the 11-22
unitwait comment).What
A
unitwait on a unit systemd does not know (LoadState=not-found) counted as ended. So a parent that asked for its child's unit before the child started it was woken at once, every time it asked: each wake a paid turn that re-reads a large context, and no real wait.invalidand the way out: "systemd does not know the unit X: it has not started yet, or it ended and was forgotten. Ask again once it runs, or with unit.missing "ended" if it is known to have run". Nothing is stored.unit.missing: "ended"(new, optional; defaultrefuse) keeps the old answer for a unit known to have run and been forgotten: met at once.context.waitId === null, which only the registration path passes. A permanent judge failure may now carry its refusalcode; without one the old mapping stays (not_supportedfor a unit wait without systemd,invalidotherwise).wait_for's description anddocs/fork/README.md(server.waitFor) say so.State question
missingfield and is read as a stored wait, so it ends when its unit is forgotten, as before. The defaultrefuseis never written into the stored spec, so asking the same wait again after the upgrade gives the same key and finds the stored one (tested:missing: "refuse"and nomissingvalidate to the same target).check_errorwith the same text, never asended. It fails closed.Left in #852
signalwait (child sends a named signal, the parent's wait is met only then).unit.missing: "wait"mode (wait for the unit to appear, then end), if wanted.Tests
Red on main, green here:
apps/server/src/waits/WaitJudges.test.ts: at registration an unknown unit is a permanent failure with codeinvalid; withmissing: "ended"it is met; known units at registration are judged as before.apps/server/src/waits/WaitService.checks.test.ts: the real unit judge over a fakesystemctlthat answersnot-found:registeris refused withinvalidand stores nothing; withmissing: "ended"it is met and stores nothing; a stored wait on the same unit endsended.packages/shared/src/waitFor.test.ts:missing: "ended"is kept in the spec;missing: "refuse"gives the same target as nomissing.Run locally: those three files plus
apps/server/src/waits/,apps/server/src/mcp/toolkits/waits/and the contracts wait tests (17 files, 339 passed, 1 skipped).vp run check:changed(fmt, lint, typecheck) is clean, and so are the fork schema, upstream-files and seam checks.🤖 Generated with Claude Code