feat(mapgen-studio): wire the shared tuner session through the daemon — one connection, health surface, scoped shutdown#1656
Merged
Conversation
Owner
Author
mateicanavra
force-pushed
the
design/tuner-daemon-wiring
branch
from
June 12, 2026 20:44
6751f10 to
e79176c
Compare
mateicanavra
force-pushed
the
design/tuner-effect-session
branch
2 times, most recently
from
June 12, 2026 22:30
e9a8435 to
c0d8bde
Compare
mateicanavra
force-pushed
the
design/tuner-daemon-wiring
branch
from
June 12, 2026 22:31
e79176c to
8e6cfe6
Compare
mateicanavra
force-pushed
the
design/tuner-effect-session
branch
from
June 12, 2026 22:44
c0d8bde to
f58e2f6
Compare
mateicanavra
force-pushed
the
design/tuner-daemon-wiring
branch
from
June 12, 2026 22:44
8e6cfe6 to
b537b6d
Compare
This was referenced Jun 12, 2026
Owner
Author
Merge activity
|
mateicanavra
changed the base branch from
design/tuner-effect-session
to
graphite-base/1656
June 12, 2026 22:46
… — one connection, health surface, scoped shutdown The daemon resolves the studio runtime's Civ7TunerSession once and injects it into the control-oRPC mount via endpointDefaults (the field is typed Civ7DirectControlOptions — zero control-orpc package changes), so every polling read multiplexes over the ONE managed connection. /healthz gains the tuner block (consecutiveResponseTimeouts, gateOpenUntil, wedgeSuspected); SIGINT/SIGTERM dispose the runtime scope first (graceful FIN) then stop serving. The live soak caught a race the units missed: connect() was only sequentially idempotent — a page-load burst of ~13 concurrent reads each dialed its own socket and leaked all but the last (13 stable ESTABLISHED connections observed). Fixed at the root in @civ7/direct-control with in-flight connect dedup + a concurrent-burst pin (390 package tests). Live evidence post-fix (Civ7 in shell): exactly 1 established tuner connection across 30s+ of app polling, zero CLOSED fds, readiness 'shell' chip live, and on daemon stop the game releases its descriptor entirely (only the LISTEN remains) — the wedge signature's exact inverse. Gates: tsc, studio 204, mod 471, build + worker bundle, OpenSpec --strict. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mateicanavra
force-pushed
the
design/tuner-daemon-wiring
branch
from
June 12, 2026 22:48
b537b6d to
abcc3ee
Compare
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.

The daemon resolves the studio runtime's Civ7TunerSession once and injects
it into the control-oRPC mount via endpointDefaults (the field is typed
Civ7DirectControlOptions — zero control-orpc package changes), so every
polling read multiplexes over the ONE managed connection. /healthz gains
the tuner block (consecutiveResponseTimeouts, gateOpenUntil,
wedgeSuspected); SIGINT/SIGTERM dispose the runtime scope first (graceful
FIN) then stop serving.
The live soak caught a race the units missed: connect() was only
sequentially idempotent — a page-load burst of ~13 concurrent reads each
dialed its own socket and leaked all but the last (13 stable ESTABLISHED
connections observed). Fixed at the root in @civ7/direct-control with
in-flight connect dedup + a concurrent-burst pin (390 package tests).
Live evidence post-fix (Civ7 in shell): exactly 1 established tuner
connection across 30s+ of app polling, zero CLOSED fds, readiness 'shell'
chip live, and on daemon stop the game releases its descriptor entirely
(only the LISTEN remains) — the wedge signature's exact inverse. Gates:
tsc, studio 204, mod 471, build + worker bundle, OpenSpec --strict.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com