Repository navigation
Conversation
…-publication-wiring
…-publication-wiring
…-publication-wiring
The start loop records AllStarted once every service has started and is running or has exited 0 (Compose's rule), before Ready and behind the same deadline and cancellation checks. The graph receipt then moves to a new phase, started-observed, which remembers its start (fresh, restore or restart) in started_from, and the phase checks for a start in progress or a live graph accept it. With the new --report-started flag, graph serve and serve-restore print graph_foreground_started when that phase is saved, before the unchanged ready line. The CLI does not pass the flag yet, so what it sees is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # packages/runtime-core/src/main.rs
… it recoverable From the lead's review of #1110: - AllStarted writes the started-observed phase, saves and reports only when the owner was asked to report it; without the flag it changes nothing on disk; - cross-boot dead-owner recovery accepts a started run, as same-boot recovery and down --recover advice already did; - the CLI's start-status watcher keeps started-observed snapshots, so a timeout after every service started still names the unready service; - down --recover and the stopped-pool recovery accept a started run; - the started line is printed once, not again by a redelivery restore; - HACK_NATIVE_REPORT_STARTED=1 is a test switch for the Mac recovery scenario until PR B makes the flag the default; - restart's text and a misplaced doc comment are corrected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-publication-wiring
…p without the flag From the lead's second review of #1110: - without --report-started the start loop neither checks the extra deadline nor records AllStarted, so a ready exactly at the deadline still succeeds; - a started run never published, so across a boot its prior bridge generation is proved retired by the stopped restore history when its current slots are empty, and recovery no longer refuses it; - the CLI test switch is removed; tests pass the flag directly; - the recoverable-phase comment says only a restored run has a mapping in the started window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-publication-wiring
…iring' into claude-lead/up-started-b-cli # Conflicts: # packages/runtime-core/src/provider/graph/startup.rs # packages/runtime-core/src/provider/graph/startup/runtime.rs
…t keeps ready Native up and restart return once every container has started (Compose's rule); health checks and routes warm up after, and --wait returns at ready as before. The owner always reports started: the run mapping is saved first, in both modes and before the HTTPS lease, so a start killed in the window can be stopped and recovered. Without --wait the rest of the ready chain (lease, up.after, exit watcher, down-hook debt, detached release, closing line) runs at started, and routes are checked when the owner reports ready. While a run warms: ps shows warming and never asks the owner; exec and one-off run wait for ready, bounded; open waits for its service; logs reads through the lock-free path; the owner accepts a stop between start passes, after any publication in progress; a second up reports the warming services. up --json and ps --json carry readiness. Compose up -d --wait passes --wait through. Owner.tla gains the started phase, NoReturnWithoutMapping, DownCancelsWait and NoHalfPublicationAfterStop with their negative controls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omplexity Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Ready for lead: 4471df9 PR B, a draft, stacked on #1110 (6021cfb) and #1101 (0df96b8, which contains #1090), merged as 1f17dc3. It lands only after #1101, and in the same release as PR C. Your decisions, as built:
One thing beyond what you listed: Checks on this head:
macOS-gated files touched: Crash points for your Not in B:
|
- Register the frontend lifetime before the run mapping, so a frontend lost after the mapping is recovered by down and down --recover; the HTTPS lease upgrades the same finalization attempt. - Refuse a ready line without started-observed under --wait. - Read logs and their identity checks lease-free while a run warms. - open waits for a warming target only, refuses a dead or replaced one, and opens after the goal, the publication and the URL answer. - Count jobs and health goals by observation in the started summary; the second up reports readiness and waits under --wait. - Check a stop at every deferred settlement round; serve requests during final verification polls. - Keep a value-free failed_after_started receipt record, shown by graph status, ps and the next up. - Model: split the stop into a queued request and the owner's acceptance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The owner holds the provider lease from its started line until its ready line. The started chain asked for it three times: the run mapping's `graph inspect` (both modes; refused after its 5 s wait, so a cold `up --wait` failed with provider_busy), the HTTPS owner's acquire check (a leased inspection of a ready graph) and build-image reclaim (skipped as busy, so nothing was reclaimed). - Read the mapping through lease-free `graph status`, retrying a journal that moves during the read, bounded. - A started return takes the HTTPS lease and reclaims build images at the owner's ready line; an HTTPS failure there stops the run. - The start test fixture now refuses every leased command between the started and ready lines, and a test runs the whole chain, with HTTPS, against it in both modes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Keep failed_after_started out of the strict receipt: its own file next to it, kept by the owner's cleanup, reported by graph status, removed by hack down (new graph clear-failure-after-started), graph cleanup and the next start. - down finds a start that crashed after registering its lifetime and before its mapping; operation.lock records its holder and a lock left by a gone holder is taken over; a down that captured v2 accepts the same attempt gaining its HTTPS lease. - Cut open waiting and the already-running --wait path back to today's behaviour (own follow-up); the exec/run wait pins its run and treats a success after the deadline as a timeout. - The owner polls for a stop before each whole service publication and between the inspections of final verification. - A foreground failure after started prints its log tails and exits nonzero. - Model: the publication guard is on acceptance; frontend cancellation is its own action (StoppedFrontendCancelled, stop-before-frontend-cancel). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since the started line the receipt is started-observed, and the scoped inspection behind each service's early publication admitted only preparing and restoring. When a service with a published port and a slow health check became ready after the started line, its inspection found nothing and the port was refused (bridge_endpoint_unavailable), ending the start. The check now uses start_phase(), which sees through started-observed to the start it belongs to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
PR B of "native
hack upreturns when containers have started" (owner decision, Nov 20).hack upandhack restartreturn once every container has started, by Compose's rule: running, or exited0for a job another service waits on. Dependency edges keep their conditions. Routes and health checks warm up after the return.--waitreturns at ready, as today.At started, in both modes
The CLI always passes
--report-started. When the owner'sgraph_foreground_startedline arrives:authoritative), then the frontend lifetime is registered (finalizationactive.json, the same attempt later gains the HTTPS lease), then the run mapping is saved, before the HTTPS lease or anything else acts on the line (ensureMapping, idempotent). A start killed in the window therefore has a mapping, with or without--wait. This closes finding B from the feat(runtime): report when every service of a native start has started #1110 review.The owner holds the provider lease from its started line until its ready line, so nothing at started may take it. The mapping is read through lease-free
graph status.Without
--wait, the rest of today's chain also runs at started, except the two steps that need the lease:the HTTPS lease: taken at the owner's ready line (the HTTPS owner admits a lease only after a leased inspection of a ready graph). A failure there stops the run;up.after, as Composeup -ddoes today;readiness: "warming");build-image reclaim: at the owner's ready line (it takes the lease without waiting, so at started it would be skipped as busy).When the owner later reports
graph_foreground_ready, the routes are verified andAll services ready · 12.1sis printed.With
--wait, steps 2 to 10 happen at ready, exactly as today, after the mapping step at started.What users see
… up in 4.6s · native · 2 routes warming;up --jsonandps --jsonhavereadiness: "warming", one field to readreadiness: "ready"; foregroundAll services ready · NspsSTATEwarmingservices.warmingCommands while warming
ps: never callsowner-status(the owner is in its start loop). A test fails by hanging if it does.execand one-offrun:waiting for the project to become ready…. Then they run, soup -d && hack exec api …keeps working;open: unchanged from today: it opens the route at once, and the route may not answer until ready. Waiting inopenis cut from this PR to its own follow-up (lead's call, to keep the size down).logs SERVICEwithout-f: a lease-free snapshot (graph logs, which on macOS reads through the observer and checks the recorded container before and after). The output format is unchanged from a ready run.down: the owner accepts a stop or status request wherever its start loop checks cancellation (option 1): between engine operations, between final verification's listener-exit polls (25 ms) and between deferred-publication settlement rounds (100 ms). A request waits for at most one in-flight step: one engine request (40 s timeout after a 3 s connect), or one service's publication, each also bounded by the start's deadline. A stop never interrupts a publication: it takes effect after that publication commits or is withdrawn.down --remove-datawaits for ready (graph_starting): stop first, then remove.restart: stops through the owner, then resumes.up: says "already running", names the services still warming, and applies no configuration change.--waiton an already running run does not wait (cut to the same follow-up). If a detached run stopped after it had started, the nextupprints one stderr line naming the failure code. This is today's rule for a ready run, with the samehack restarthint. A service still waiting on its health check is warming, not "down".One constant for whether
--jsonand--no-interactiveimply--wait:NATIVE_UP_SCRIPTS_WAIT_BY_DEFAULT = false, pending the owner's answer (Q4).Runtime (Rust)
The owner answers its transport during the start loop, at every cancellation check, without a second lease:
runtime_error: "graph_starting";graph_starting.graph cleanupfalls back to a lease-free receipt read onprovider_busy, so a stop and a restart in the window go through the owner.graph logswhile warming: lease-free on macOS (observer reads, container identity checked before and after).graph logs-follow --no-followstays as a lease-free finite read; the CLI now uses the snapshot instead, so its format matches a ready run.Gates:
logs -fand the service-exec gate acceptstarted-observed(exec only for astartedservice; jobs stay at ready).graph statuslists already-published ports while warming.Failure after started: a run that fails after
upreturned keeps a value-free record,failed_after_started {code, service?, at}, in its own file next to the receipt (failed-after-started.json), not in the strict receipt. The owner's own cleanup keeps it.graph statusreports it lease-free as a top-level key;psshows a blocker line (failed after up returned · CODE, the time, andhack logs SERVICE); the nextupprints it once.hack downremoves it through the newgraph clear-failure-after-started --run-id ID --json(it takes the cleanup lease and refuses, asgraph_failure_record_not_stopped, unless the run is stopped or removed).graph cleanupand the next start remove it too. Compatibility: the receipt is unchanged. An older runtime tolerates an unknown file in the run directory (checked at 1f17dc3), and afterdownthe file is gone.Foreground failure after started: the owner's later failure ends the foreground as a start failure does, with the failed services' log tails and a nonzero exit.
Size: about 229 source lines in the first round, plus about 150 for the review fixes (lease-free snapshots, serving during final verification, the stop check in deferred settlement, the failure record). That is over the 250 limit; the review fixes asked for it.
publication.rsis not touched;publishers.rsgets the one-line stop check the lead allowed.Models
native-startup-owner/Owner.tla:startedphase;PublishMappingat started in both modes;--waitas theWaitForReadyconstant.DownRequestqueues a stop (stopQueued);AcceptStopis where the owner takes it between start passes;DownStopthen cleans up.NoPrematureReturn, the newNoReturnWithoutMapping,DownCancelsWait(a down in the window cancels the owner's wait, thenReadynever happens),DownHooksOnce, andNoHalfPublicationAfterStop(publication modelled as a two-step commit; the stop waits for it).mapping-after-line(yours) andmapping-after-line-wait;down-leaves-owner-waiting(yours, re-pinned toAcceptStop);stop-without-accept(new: a stop that the owner never takes);stop-mid-publication;detached-before-started,detached-before-ready-wait;AcceptStop, not on the request;DownRequestcan queue a stop mid-publication, and the owner starts no new publication once it accepts. The frontend's own cancellation is a separate action,FrontendCancel(controller.abort()), with its own variable;DownStopneeds both. New invariantStoppedFrontendCancelled, new controlstop-before-frontend-cancel;stop-mid-publicationnow accepts mid-publication and still failsNoHalfPublicationAfterStop.native-image-batch negativewith an equivalent witness (verified = {1, 3}against the pinned{1, 2}) under two TLC workers, a second flaky witness in a model this PR does not touch, next to HACK-2574.execution.rssets "published" itself in its test, andforeground/tests.rssupplies its own cleanup reply). Only the VM scenario exercises a stop against a real publication.COVERAGE.mdsays so.COVERAGE.mdmaps every action to the code, including the stop delay. A Pele state chart is added (state.mmd,state.svg,state.png): the label checker and the PNG checker pass, and the PNG was looked at.docs/architecture.mdandtests/models/tla/README.md, anddocs/reference/v5-model-coverage.md, are updated.Docs
docs/guides/native-candidate.md: a new "Started and ready" section, plus the twoupparagraphs.docs/versions/v5/native/start.md, the v5 start-here path.docs/versions/v5/release-notes.md, in section 1 for scripts:up.afterruns at started, and a hook that calls a URL needs--wait.src/agents/instruction-source.ts, with the plugin bundle regenerated.docs/reference/cli.md, regenerated for--wait.Fix after the second VM run
The cold
up -d --waitwith a service whose health check settles 45 s after it starts (and whose port is published only after that) failed after 74 s withbridge_endpoint_unavailable. Since the started line, the receipt isstarted-observed, and the scoped inspection behind each service's early publication (inspect_targets_scoped, used byadmit_ready_service,start_selectedand the upstream check) admitted onlypreparingandrestoring. So when the slow service became ready, its inspection found nothing, and the port was refused instead of published. That check now usesstart_phase(), which sees throughstarted-observedto the start it belongs to, as the start loop's other checks already do. Both modes are affected the same way, because the CLI passes--report-startedwith and without--wait. Test:after_started_a_slow_port_is_deferred_then_published_not_refusedruns the early-port case instarted-observed(frompreparingand fromrestoring). While the health check is starting, the port is pending (deferred, no endpoint, no refusal); once healthy, it has exactly one endpoint. It fails on the old check. The deferred settlement itself is macOS-only; the scenario covers it.Second review (51f6e40), last list
active.jsonand before its mapping:downfinds the one orphan lifetime of the scope (frontend gone, neither completed nor recovered) from its record, which carries the run identity, and recovers it;operation.lockrecords its holder (pid and birth); a lock whose holder is gone, or one left without a holder record for over 30 s, is taken over;downthat captured v2 accepts the same attempt gaining its HTTPS lease (v3) before the stop, and waits on the new token.openwaiting and the already-running--waitpath are back to today's behaviour (own follow-up). Kept forexecandrun: the wait pins the run first seen warming (another run ends it, never a stale success), and a success seen after the deadline is a timeout.Fix after the first VM run (c2a6132)
The first real-VM run of
sc_started_bfailed at its coldup -d --waitwithprovider_busy, recorded holderstart. At started, the mapping step calledgraph inspect --startup-wait, which waits 5 s for the provider lease that the owner holds until ready. The fake invoke in the start tests recorded calls but never modelled the lease, so the suite stayed green. Fixed as above. The start test fixture now refuses every leased command between the started and ready lines. A new test runs the whole chain, with HTTPS, against that lease in both modes, and it fails on 51f6e40. Every other call in the chain is lease-free or local:runtime status,graph observe(exit watcher),graph status(startup status), finalization, admission, the env fingerprint, the down-hook debt and the startup observation.up.afterhooks are user commands.Review fixes (independent Codex review of 4471df9)
downanddown --recoverfind and clean the run (tests for both).--waitis refused; the owner's started line must carry phasestarted-observed.openwaited only when the target is warming at the first look. It refuses on run replacement or a dead, exited or unhealthy target, and opens only after the goal is met, the publication is verified and the URL answers (bounded).upcarriesreadiness, and a running completion job is warming.ps,graph statusand the nextup, as above.--waithelp text is per backend;restart --waitis described as native only.AcceptStopsplit and the new control, above.Tests
tests/native-start-wait.test.tscovers exec waiting, its budget, a failed start, an unreadable observation, a replaced run, success after the deadline, and the constant.tests/native-project-process.test.ts, in both modes:--wait,onReadyruns at started and the ready line callsonAllReady;--wait,onStartedruns beforeonReady.up.afterand the release come before all-ready, and the release reportswarming. The existing tests run the--waitpath, and their expectations say the mapping is saved before the lease.ps: a warming run is never asked forowner-status, and showswarming.up: a warming service is not down, a service that exited is, and the JSON carriesreadinessandservices.warming.downanddown --recover, ready-without-started refused, log tails after started, the started summary, the failure field inps. Rust:snapshots_of_a_warming_graph_complete_while_its_owner_holds_the_lease,a_failure_after_started_is_kept_through_cleanup_until_the_next_start,status_reports_a_failure_after_started_without_the_lease.up-started-bMac scenario covers it.a_stop_during_a_publication_takes_effect_after_it,without_follow_the_existing_output_is_the_whole_read, and the--no-followargument cases;every_cancellation_check_serves_requests_and_a_stop_cancelsandthe_start_loop_answers_status_and_holds_a_stop;Checks
At
7137f3121(Rust gates run on the final Rust tree; only TypeScript changed after them):-D warningson default and all features;cargo test: default library 1609 pass, all-features library 1813 pass, every target passes;bun run typecheck,bun run check(warnings only) andprivacy:check: pass;docs:cli-reference(per-backend--waithelp) andgenerate:agent-plugins(no change).nativeProjectPsis 23 (was 21 at base), the startonReadycallback 26 (28 in the first round),handleOpen23.Notes
provider/graph/foreground.rsand its tests,provider/graph/startup/runtime.rs,provider/graph/foreground/transport.rs. They compile under the macOS cross-lint; their tests run on the Mac.started-windowharness, with the HACK-2511 note on lease-free exec: handoffeng-a3/up-started-b-notes.md.--wait:hack up -d --waitpasses--waittodocker compose up -d. A foreground Composeup --waitand a Composerestart --waitrefuse with a usage error rather than ignoring the flag.All services readyline instead;hack.yaml) native path: it ignores--waitand keeps returning at ready (PR D);🤖 Generated with Claude Code