Skip to content

Answer a live call in one request, reuse the precompiled standard library on cloud builds - #48

Merged
qfeuilla merged 1 commit into
mainfrom
deploy
Oct 4, 2026
Merged

qfeuilla merged 1 commit into
mainfrom
deploy

Conversation

@qfeuilla

@qfeuilla qfeuilla commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

What changes

Live calls in one request

  • /connect/<tenant>/<path> checks the caller, starts the run and passes the call to the worker in the same request. There is no more 307 and no more curl -L.
  • The ticket now reaches the worker in a private header instead of the URL.
  • The caller's raw path and query reach the worker exactly as sent, so escaped characters and signed queries keep working.
  • If no worker gets the call, the run and its entry slot are erased at once, so a retry on a one-at-a-time route isn't refused.
  • A browser socket still asks for a ticket URL first, because browsers can't put a credential on a socket's opening request. /live now only opens sockets.

Cloud worker builds reuse the precompiled standard library. The compiler judges a package stale by file dates. A fresh checkout dates every file at checkout time, so the builder base (built from one checkout) and a cloud build (staging from another) always disagreed, and every cloud build recompiled all of it. Every staged package file now carries one fixed date. That is safe because each package compiles in a folder named after a hash of its exact files.

Infrastructure

  • A scale-to-zero supervisor runs one pass at a time. Two simultaneous wakes used to run the same command twice.
  • A starting unit now says what it is doing: machine being created, booting, images downloading.
  • A cloud machine's agent answers from boot and starts its unit in the background. A failed start is reported until the unit runs whole as asked.
  • weft infra start and the VS Code bar show these steps.

Deploy flow

  • The GCP install waits for GitHub's sign-in grant to take effect.
  • weft target export runs the install's own activation check and lists the connections still to fix.
  • Refusals print as plain lines instead of JSON.
  • The deployer may store a key the project issued itself from .env with --set-env, never reading the value.
  • weft frontend add --repo prints progress while it waits.
  • Database pool connections stay open for the life of the process. Each process already holds one open to hear the database's change notifications, so closing the others early never let a serverless database sleep.

Sockets beyond an hour

  • The docs and Tangle explain that a connection on a cloud install lasts an hour at most, and teach the session-id reconnect pattern.
  • The connect library gains openLiveSocket, which reconnects with a session id. A program ends the conversation for good by closing with code 4000.
  • Both extensions now count packages/weft-connect toward their version bump, and both are bumped.

Tested

  • Workspace clippy is clean.
  • Unit tests pass for every changed crate, plus the graph and connect-library tests.
  • The database test for the new erase passes.
  • End-to-end, these pass:
    • an HTTP route, and a CORS call from another site;
    • a websocket chat and a socket loop;
    • the browser ticket's lifetime;
    • API keys and signatures;
    • streaming disconnects;
    • infrastructure start and Postgres.

The cloud machine agent and the build-date fix only show their effect on a GCP deploy.

🤖 Generated with Claude Code

…rary on cloud builds, and make slow starts and missing connections legible

- A call to a program's route is passed to its worker in the request that made it: the dispatcher checks the caller, births the run and relays the call, the ticket riding a private header to the worker. The raw path and query reach the worker as sent. A call no worker got erases its run and entry slot at once. A browser socket still asks for a ticket URL first; the live door now only opens sockets.
- Every staged package file carries one fixed date, so a package the builder base compiled from one checkout is reused by a build staged from another; cloud builds no longer recompile the whole standard library.
- A scale-to-zero supervisor runs one pass at a time, so two wakes no longer run the same command twice.
- An infra unit says what it is doing while it starts (machine being created, booting, images downloading); the machine's agent answers from boot, applies in the background, and reports a failed apply until the unit runs whole. `weft infra start` and the editor show it.
- The GCP install waits for GitHub's sign-in grant to take effect; signing waits are shared.
- `weft target export` asks the install's own activation check and lists the connections to fix; structured refusals print as lines; the deployer may store a project's own key from `.env` with `--set-env`.
- Database pool connections stay open for the process's life (each process already holds one for its announcements).
- The connect library gains `openLiveSocket`, which reconnects with a session id; docs and Tangle teach the one-hour connection limit and the reconnect pattern. Both extensions count the connect library toward their version bump, and both are bumped.
@qfeuilla
qfeuilla merged commit 5679b98 into main Oct 4, 2026
11 checks passed
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