Skip to content

Idle app engine CPU down about tenfold; cmd/codeaf suite runs to the end - #1941

Merged
ZeroPoint95 merged 3 commits into
app/v3from
zeropoint95/factory-efficient
Oct 25, 2026
Merged

ZeroPoint95 merged 3 commits into
app/v3from
zeropoint95/factory-efficient

Conversation

@ZeroPoint95

Copy link
Copy Markdown
Collaborator

Cuts an idle app engine's CPU about tenfold, and stops the cmd/codeaf test binary being killed partway.

Factory job budget check

  • Every open job or step chat checks its job's budget every 100 ms.
  • Each check decoded the whole job document, step log included: over half of an idle engine's CPU.
  • It now stats the file and decodes only when the file changed. The budget line it answers is the same.
  • Measured on a copy of a real factory home (296 jobs, largest 543 KB), idle, twice each: 48.9% / 49.1% of a core before, 5.0% / 4.9% after.

App leave bound

  • runApp's 30 s leave bound was started by its own deferred cancel as it returned.
  • Any process that lived on afterwards was ended 30 s later. The cmd/codeaf test binary runs the door in-process, so the suite died about 150 tests in with "still leaving after 30s".
  • The bound now stands down when the door returns. A wrap-up that outruns it while leaving is still ended.
  • A shipped engine was never affected: main exits as soon as the door returns.

How to test

  1. go vet ./cmd/codeaf
  2. make test-focus PKGS=./cmd/codeaf RUN='^TestAJobsChat|^TestADoorThatReturned|^TestALeaving|^TestTheAppDoor'
  3. go test ./cmd/codeaf -count=1 now runs to the end instead of being killed partway.

Known red on app/v3, not from this change

  • go vet false positive at internal/factory/run/chatstage.go:402.
  • Existing cmd/codeaf test failures, several laws and three manual retrieval tests fail on app/v3 with and without these commits.

🤖 Generated with Claude Code

ZeroPoint95 and others added 3 commits October 25, 2026 11:42
…anges

Every open job or step chat checks the job's budget every 100 ms. Each check
read and decoded the job's whole document, step log included, and trimmed the
log again, which was over half of an idle engine's CPU. The check now stats
the file first and decodes the document only when the file has changed; the
budget line it answers is the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
runApp armed a thirty-second bound on its wrap-up, and its own deferred
cancel started that bound as it returned. A process that lived on after the
door was then ended thirty seconds later: the cmd/codeaf test binary runs the
door in-process, so the whole suite died partway with "still leaving after
30s" and no test to blame. The bound now stands down when the door returns,
and still ends a wrap-up that outruns it while the door is leaving.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ZeroPoint95
ZeroPoint95 marked this pull request as ready for review October 25, 2026 16:55
@ZeroPoint95
ZeroPoint95 merged commit 0063de4 into app/v3 Oct 25, 2026
1 check passed
@ZeroPoint95
ZeroPoint95 deleted the zeropoint95/factory-efficient branch October 25, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant