TestGatewayHookDefaultBudgetStillCuts/10000 was red on macOS CI at
c2c2c82ca (run 42819148533): the hook was cut at 9.3s as "cancelled",
not by its own 10s timer as "timeout". The RPC's 11s (gatewayWait)
counts the host's start too, so a start past a second on a busy machine
lets the RPC's deadline land first. Same class as e39ecfec8's chain test.
Now the fixture's first request returns at once and only starts the
host; the second one is measured, with the host's start out of its
margin. The product is unchanged.
Ran on WSL magpie-desktop, go test -tags nogui ./internal/plugin
-run TestGatewayHook: ok.
Broken by hand:
- a 2.5s top-level wait in the fixture (a slow host start): the old test
fails ("wasn't cut by its own budget"), the new one passes;
- the 10000 case given 20000: the new test fails ("a hook past its
default budget was kept").
Not tried: macOS CI itself, until this push's run.
TestGatewayHookChainStillTenSeconds gave each of two hooks 8s and had
both sleep 6s. On macOS CI at 286e3b6d5 (run 42784088261) the first one
ran past its 8s with the host's start counted and was dropped:
"the chain's 10s changed: {"note":"original"}". The first now sleeps 4s
(4s to spare), the second 7s: inside its own 8s, past the ~6s the chain
has left, so only the chain's 10s cuts it.
Run on magpie-desktop: go test -tags nogui -count=3 -run TestGatewayHook
./internal/plugin ok. Broken by hand (chain budget 20s in host.js and
gateway.go): red, "first":true,"second":true kept.
gatewayTimeoutMs was capped at 10000 and the Go side cut every hook RPC at
11s, so a recall hook (Nowledge Mem) asking for 15s was cut at 1s (any
value over 10000 fell back to the default) and could never finish.
- host.js: gatewayTimeoutMs takes integers 100-30000; a value outside is
clamped to the nearer bound, a non-integer gets the 1000 default.
gatewayBudget() is the old chain budget (sum, clamped 2-10s) or the
longest hook's own timeout, whichever is larger. With no hook over 10s
nothing changes.
- gateway.go mirrors both (gatewayTimeout, gatewayBudget, cached with the
HasGateway scan). GatewayBegin's request RPC, Finish's completion RPC
and GatewaySignIn now wait the budget plus 1s, never less than the old
11s; host startup and the lock wait stay bounded at 11s. Caller
cancellation still reaches the hook at once, a failing hook still
rolls back, and the request-state limits are unchanged.
- Docs: gateway-request-hooks subsystem page, plugins docs (en, zh, ja).
site/public/llms-full.txt regenerated with `node llms-full.mjs`; it was
already stale on origin/main (OpenCode 2 keys, billion-context tab,
data-folder move, vendor presets, group rule), so those docs pages'
text lands in it too.
Run on mote at this tree (base 03a800ac6; origin/main has one newer
commit touching none of these files):
- gofmt -l internal/plugin internal/gateway: clean
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./...: rc 0
- go test -tags nogui -count=1 -timeout 45m ./internal/plugin/...
./internal/gateway/...: ok plugin 161.6s, ok gateway 897.0s
- site: node --test worker.test.mjs: 38 pass (llms-full red before the
regeneration)
New tests (internal/plugin/gateway_budget_test.go): a 12s onRequest and
onResponse with gatewayTimeoutMs 15000 both land (24.2s); the default and
10000 are still cut with outcome "timeout"; two 8000ms hooks still share
10s; 130000 is clamped, not dropped; cancelling a 15000ms hook's request
stops its fetch at once (0.07s); the Go mirror matches host.js.
Broken by hand, each red:
- A host.js as on main: SlowRecall red at 1.10s, Clamps red
- B Go RPC kept at 11s: SlowRecall red at 11.04s, Mirror red
- C chain capped at 10s: SlowRecall red at 10.13s
- D default per-hook 30000: DefaultStillCuts/default red
- E caller signal off the begin chain: LongBudgetCallerCancellation red
- F chain budget 30s for every config: ChainStillTenSeconds red
Not tried: a real Nowledge Mem server; the full ./... suite; GUI tests
(no GUI change); a Windows or Linux runtime run (vet only).
Reported-by: aboat0625-cpu