Repository navigation
Conversation
… deadline (HACK-1458) Public adoption dispatch now starts one command deadline before it opens the store. Each store inspection phase takes the time left on that deadline, capped at 60 s, instead of a fixed 15 s clock, and an expired deadline returns E_STARTUP_TIMEOUT with the store's fixed deadline message instead of E_CONFIG_INVALID. Authored startup compiler calls are bounded by the remaining startup deadline (floor 1 ms, ceiling 60 s) instead of a fixed 10 s each. Compiler calls outside startup, including the down-hook acquisition after a cancel, take the 60 s ceiling: the fixed 10 s clock failed the graceful stop under load, which then retained the live owner and host processes until a hard cancel (the "Source5 cancellation after readiness" hang). A start that fails or is cancelled after host processes began and before reservation now stops them: their teardown re-acquires inputs under the hard signal, because the startup inputs refuse once the startup signal aborts. A host process launch that fails part-way ends its owned session through the token it created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nslation An adopted store with a caller deadline still reports a held lock as E_LEGACY_ADOPTION_BUSY; only an otherwise unclassified failure becomes the deadline refusal (HACK-1458). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Refs HACK-1458 (unit G106). Product fix for the four product clocks that kept HACK-1367's loaded runs from passing. Test-side budgets stay with #419 (G52/G105); this PR adds new cases at the end of the two shared test files and edits none of #419's hunks.
Root cause
Public adoption dispatch.
tryLegacyComposeAdoptedCommandopened its adoption store without a deadline, so every store inspection phase (one probe owner) got the default 15 s aggregate clock, whateverHACK_COMPOSE_STARTUP_TIMEOUT_MSallowed. A slow engine expired it asE_NATIVE_COMPOSE_PROBE_TIMEOUT;translate()turned that intoE_LEGACY_ADOPTION_STATE, and the command reportedE_CONFIG_INVALID("state is invalid, unsafe or changed"). The command's own deadline only started afterloadActive, so inspection before it was never bound by the caller.Authored compiler calls.
acquireNativeExecutionInputsnever passed a compiler timeout, so each compiler invocation (and the laterassertFresh/value checks) kept the transport's fixed 10 s default, even with minutes of startup budget left.Source5 cancellation after readiness hang. Reproduced: after
onReadyaborts, the cancel'sdown.beforere-acquires inputs with the hard signal. That acquisition also kept the fixed 10 s compiler clock. When one compiler call took longer,down.beforefailed atacquire(no hook ran),onStopFailurefired, and the start retained the live owner and host processes, waiting for a hard cancel that the case never sends. With a scratch copy whose compiler sleeps 11 s after readiness, the case hung for its whole 420 s budget, with hook eventsdown.before:acquirethendown.before:stop-operationand no down hook, the same symptoms as the loaded report.Failed authored cases leave host process groups running. This is a product path, two of them:
stopUnstartedHostProcessescould never passhostProcesses.stop()'s freshness check (it re-reads inputs with the aborted signal), so the groups stayed up. A loaded local run of a new case showed it directly: startup expired afterhost-process-ready.jsonwas written, the start failed, and the mux window group was still alive afterwards.createNativeAuthoredHostProcesses().start()had no failure path. A failure after the launch intent (cancel, deadline or refused check during the launch) left the mux session running behind an intent that recovery never converts into authority.Failures after reservation still retain host processes on purpose, with complete owner/ready/state records that
hack downrecovery stops (retireNativeAuthoredHostProcesses). Ending those in a test is test cleanup (test: derive load-sensitive harness budgets from named constants #419).Fix
native-compose-adoption-generation.ts,native-compose-adoption-command.ts):deadline. With one, each inspection phase getslegacyAdoptionProbePhaseMs: the remaining time, capped atLEGACY_ADOPTION_PROBE_PHASE_MAX_MS(60 s). An expired deadline refuses asE_LEGACY_ADOPTION_DEADLINE, and an unclassified failure after a probe timeout or past the deadline becomesE_LEGACY_ADOPTION_DEADLINE, notE_LEGACY_ADOPTION_STATE. A store without a deadline is unchanged.HACK_COMPOSE_STARTUP_TIMEOUT_MS) before it opens the store and uses it for inspection, the retained operation, the plain container runner andpsinspection.E_LEGACY_ADOPTION_DEADLINEmaps toE_STARTUP_TIMEOUT. The message stays the store's fixed text, so the closedlegacy-deadlinediagnostic token is unchanged.native-config-compiler.ts,native-project-validation.ts,native-execution-inputs.ts): namedNATIVE_CONFIG_COMPILER_MIN_TIMEOUT_MS(1) andNATIVE_CONFIG_COMPILER_MAX_TIMEOUT_MS(60 000),nativeConfigCompilerTimeoutWithin(remainingMs), and an optionalcompilerTimeoutMsgetter that every compiler invocation of a selection reads, including later freshness checks.native-authored-project-start.ts):native-authored-host-processes.ts): a start that fails after its launch intent calls the controller'sabort(), which ends the session through the ownership token it created. Owner bookkeeping is cleared only when every launched group was recorded and is proven absent within 5 s. Otherwise it stays retained.docs/reference/native-compose-adoption.md,docs/reference/native-authored-commands.md.Tests
New cases, each proven by mutation (product change reverted in a scratch copy):
HACK-1458: public dispatch inspection outlives the former fixed 15 s phase clock while the caller deadline remainsDate.nowjump of 16 s after the first engine probe, 120 s deadlineE_CONFIG_INVALID"state is invalid, unsafe or changed"HACK-1458: an expired public dispatch deadline ends inspection as a startup timeout, not invalid config0(inspection ignored the expired deadline and started the container)HACK-1458: a startup compiler call may outlast the compiler's 10 s default while the startup deadline remainscompilesleeps 10.5 sstage inputs (E_COMPILER_TIMEOUT)after 11.4 sHACK-1458: Source5 cancellation after readiness settles when its down acquisition compiler is slowHACK-1458: cancellation after host processes start and before reservation stops themfrontend-planheld until cancelledprocess-orderisstartedonly and the host group stays aliveHACK-1458: cancellation during the host process launch ends the launched grouplist-panesdelayed 1 sabandonLaunchmade a no-op: the owned mux session (mux.json) staysEvidence
In progress: 10-consecutive loaded runs of both whole files are running locally (M5, Bun 1.4.2, private HOME/HACK_HOME/DOCKER_CONFIG, keychain fallback disabled, unreachable DOCKER_HOST, added CPU load stopped in a trap), on this branch plus #419's test-side budgets. Hosted CI at the exact head is the full-suite evidence. This section will be updated with results.
Gates
dirover agit log -p origin/next..HEADexport: no leaks.bun run check(includesprivacy:check): passed.bun run --cwd packages/cli typecheck: 0 errors. Biome on the changed files: no new warnings (the 8 existing complexity warnings innative-compose-adoption-generation.tsremain).docs:cli-referenceand plugin regeneration do not apply.origin/nextmerged at 246f1b4.Gaps
To be completed with the evidence.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.