Skip to content

Prototype: patchy init --tier 2, server/, dev on the production engine and a two-artifact publish #314

Closed

Description

@allisonmahmood

Part of #294.

Question

Can a fresh agent go from patchy init --tier 2 to a published two-artifact version without touching anything but the tree? Build a throwaway vertical slice: init lays down server/ and the client, the generated client exposes patchy.server.<fn>, patchy dev executes handlers in the production engine over PGlite with two tab identities, the import check refuses an off-list package with the agreed message, publish builds both artifacts, the manifest carries handler descriptors, and the served page calls a query and a mutation through the real shell. Hand the tree to a fresh agent with only the project skills and record where it stalled.

Output: the prototype on a prototype/<name> branch and a never-merged PR with a Try it section; the stall list in the resolution comment; astra's evaluation recorded beside Allison's.

Activity

  1. added
    wayfinder:prototype
    on Sep 19, 2026
  2. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Astra evaluation (design pair, no tools, 2026-09-25)

    Run on the README, PR body, patchy-server skill and the full diff of PR #380 after the build. Verbatim; the session's verification of its code claims follows in the report comment.

    1. Is the design sound?

    Sound direction; incomplete enforcement. This is a static review of the supplied diff and brief, not independent verification of the reported smokes.

    The pinned-version path is coherent: ServerCall closes over the admitted binding, descriptor and bundle reference; dev replaces the loaded version rather than mutating it. Both artifacts have separate intents, consumed in the recording transaction, and cleanup accounts for the server object. Keep these boundaries.

    Four changes matter:

    • Capability revocation is incomplete. Engine.ts captures the callback before awaiting request.json; deletion from the registry does not revoke that captured reference or stop callbacks already running. Recheck liveness after parsing and give callbacks an invocation-owned cancellation/join scope. Registry deletion alone cannot establish transaction completion.
    • Validation undershoots the types. checkValue(t.row(...)) checks only a string id, not the declared table’s full row. Descriptor validation permits unrecognised fields, and ServerCall casts guest-provided refusal codes while replacing status with 400 and dropping details. Resolve row validation against the pinned manifest; enforce descriptor grammar and host-defined refusal mappings.
    • Discovery remains guest self-description. __describe lives inside the uploaded bundle. Loading identical bytes does not independently establish that its reported inventory corresponds to its dispatch implementation. Document that distinction; keep host enforcement authoritative, and use a trusted dispatch/descriptor representation where correspondence is required.
    • Two-viewer attribution lacks the requested evidence. The README reports distinct console emails, not two stored runtime-log rows. Require that evidence before marking this acceptance criterion complete.

    2. The builder’s design notes

    3. How does this expand?

    • Research: one transaction per mutation across an invocation's callbacks #310 transactions: host admission must open one SERIALIZABLE transaction for a mutation and keep it alive through invocation, result validation and callback settlement. Every callback must join that transaction context—not obtain another connection. Commit only after successful completion; rollback on handler error, invalid result or timeout. Independent callback request fibers need restructuring.
    • Fargate: spawning, health, termination and resource supervision move to the execution supervisor. Version admission, schemas, capabilities and company transactions remain host-side. Split Engine’s process ownership from its invocation transport, rather than move the whole current service.
    • Tier 3: the hard-coded tier-2 gate is not an expansion policy. Add the decided tier-specific admission/capability rules, not merely a wider numeric check.
    • Additional context: callbacks currently accept almost every non-byte sibling handler, despite the table-only SDK. Replace that blanket dispatch with explicit per-kind capabilities. Files need byte transport; ctx.run must propagate binding, deadline and transaction without escalating query privileges.
    • Subscriptions: add host-side dependency capture and invalidation around queries. Polling the current server.call path is not the subscription contract.

    4. What #301 should decide now

    • Scaffold: implement the already-decided The server function contract: queries, mutations, actions, the context object and the generated client #296 Preact/compat recipe. Vanilla proves the transport thread, not that scaffold.
    • Refresh: refresh discovers modules; dev must rebuild its entry when files appear or disappear. Until then, document refresh plus restart, not refresh alone.
    • JSON: keep url and colleagueUrl explicit; publish output should identify both artifacts and the admitted handler inventory. Specify these as contracts.
    • CPU loops: promise execution compatibility, not termination parity. The prototype’s deadline revokes future access; it does not stop CPU-spinning execution.
    • Allowlist: disable the preload injection or allow its exact internal identifier. Check resolved package provenance as well as bare specifiers; importer-location exemptions are not a complete package policy.

    5. Verdict

    Sound with named changes. Allison should know three things: the reported vertical slice supports the architecture, not complete contract enforcement; callback ownership must change before #310 can guarantee atomic completion; and the agent-facing loop still has unproven Preact, module-discovery and stored-attribution seams. Preserve the pinned-binding and two-artifact design, record these gaps, and do not promote the prototype’s guarantees unchanged.

  3. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Report: the slice is built and runs end to end (2026-09-25)

    Built on PR #380 (prototype/tier2-init, never merged; file map, numbers, stall list and design notes in prototypes/tier2-init/README.md). One Fable subagent built it from a brief that astra critiqued first (thin thread publish-first, the patchy-server skill mandatory, host-selected dev identities, bounded handler discovery on publish, server.call resolved from the pinned version, transactions a stated gap). The fresh-agent hand-off runs separately and lands as its own comment.

    What the ticket asked, and what holds

    Asked Result
    init lays down server/ and the client init --tier 2 in 8.9 s; server/notes.ts (a query and a mutation), a vanilla src/main.ts, patchy/_generated/server.ts bound to the config, four skills including patchy-server; the tree typechecks in 1.1 s.
    The generated client exposes patchy.server.<fn> patchy.server.<module>.<export>(args) typed from a type-only typeof import("../../server/<module>"); isHandlerError(e, "empty_title") narrows on the page.
    patchy dev runs handlers in the production engine over PGlite with two tab identities The #311 loader Worker on workerd 1.20260924.1 as one Effect service (packages/execution), used by both patchy dev and apps/server. Dev start 4.6 s, first bind 71 ms, edit-to-rebind 122 ms, an in-flight call finished on its old binding across a rebuild. Two loopback listeners (url and colleagueUrl in dev --json), simultaneous adds attributed to dev@ and colleague@ in dev.log.
    The import check refuses an off-list package with the agreed message zod refused in server/, via a helper under lib/ reached from server/, and via a helper under src/, at module-graph time, naming the importer, with copy it into src/ or ask Patchy for the capability; a non-handler export in server/ fails the build.
    publish builds both artifacts, the manifest carries handler descriptors Repo's Vite 8 library build for the server bundle; publish 1.6 s; .html and .server.js stored under separate intents, server_hash on the version, manifest.handlers recorded; the server re-derives the handler map by loading the exact stored bytes in a throwaway workerd and refuses a disagreeing manifest (422 in 48–104 ms), a top-level throw (422) and a for(;;){} initialiser (422 at 5 s, process gone).
    The served page calls a query and a mutation through the real shell The unchanged broker admits server.call; served page viewer in 121 ms, click-to-relist 66–73 ms, server-side query 5–12 ms and mutation 4–6 ms; runtime_calls rows carry usr_dev, server.call, notes.add.

    Also measured: engine spawn 41 ms, bind 7–12 ms, warm invoke 3–5 ms; guest fetch refused; a query that writes gets access_denied from the callback host; a handler throw is handler_failed with the message only in the log; a bad result is handler_failed; sleep(12000) is handler_timeout at 10 s; a late callback is refused.

    Stalled or left out, on purpose

    • Preact scaffold: not done; the vanilla client proves the transport thread, not the The server function contract: queries, mutations, actions, the context object and the generated client #296 scaffold recipe.
    • Atomic mutations: not held; a row written before a HandlerError persists (smoked with writeThenThrow). Research: one transaction per mutation across an invocation's callbacks #310's design was not bolted on; the README and the skill say so.
    • Stopping a CPU-spinning handler in the serving engine: nothing kills it (no watchdog by decision); not run against the instance for that reason. Publish-time loops are contained by the throwaway inspection process.
    • ctx.shared/files/connections/run, the mutation key, subscriptions and useQuery: not in the slice. ctx.log rides the process log, not runtime_calls columns.
    • Two existing tests are red by design on the branch (the SDK export list now has ./server; the migration ledger now has 0009).

    Design notes for the map (builder's, checked by the session)

    1. Error properties do not survive workerd RPC: a thrown Error with a patchyRefusal field arrived in the guest as a bare Error. Fixed by returning refusals as data and rethrowing in the guest entry. The execution service ADR should say the stub answers with a result, never a throw.
    2. A handler error is a successful wire reply, so its runtime_calls row says outcome = success. Needs a decision on the spec ticket (astra: log a distinct handler_error outcome with the declared code).
    3. The generated client needs the server/ file list: a new file needs patchy refresh (and today a dev restart, since the watcher enumerates modules at startup); an edited export or schema does not. The server function contract: queries, mutations, actions, the context object and the generated client #296 point 10's "no regeneration step" holds for edits only.
    4. optional on an argument field means the key may be omitted; null needs t.nullable; on a column optional means nullable. The skill states both; The server function contract: queries, mutations, actions, the context object and the generated client #296 should too.
    5. Two dev identities are two listeners: the broker posts to a fixed runtime path, so a base path cannot select a principal without a browser-supplied field; the listener is the mount.
    6. Vite 8 library mode suffices for the server bundle; Vite's own vite/modulepreload-polyfill import had to be allowlisted (the prototype allows vite/*, too broad; build.modulePreload: false in the scaffold is the clean fix). workerd's postinstall is off and the platform binary is spawned directly.

    Astra's code claims, verified against the diff

    • Confirmed: the callback listener looks the capability up before awaiting the request body, so a callback that began parsing before the invocation ended still runs (Engine.ts); revocation is registry deletion, not a join on running callbacks. This is the seam Research: one transaction per mutation across an invocation's callbacks #310's transaction needs restructured.
    • Confirmed: t.row("<table>") validates only that id is a string, not the declared row shape (handlers.ts).
    • Confirmed: the import check allows every vite/* specifier, not just the injected polyfill.
    • Partly: two-viewer attribution in dev is proven by dev.log lines, not stored rows, because the dev runtime records no runtime_calls on either tier today; the production path does record rows (owner only, since the instance had one signed-in user).
    • Accepted as stated: discovery is guest self-description (__describe inside the uploaded bundle); the host's descriptor validation is what enforces, and the comparison is a consistency check on the exact stored bytes, not an independent proof.

    Built by Claude Fable 5.1 via Claude Code (one subagent), 2026-09-25.

  4. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Fresh-agent hand-off: two runs, the second clean (2026-09-25)

    The tree from patchy init --tier 2 was handed to astra with tools (omp -p --auto-approve --thinking xhigh) with nothing but the tree, the project skills and one task: a shared follow-up-calls list with a "mark done" that records who did it, built, run as two people, published. It could read nothing outside the directory.

    Run 1 (invalid as a measurement, but it found a real dev-loop bug)

    The agent published in about 8 minutes, but its dev loop rejected every server.call with invalid_request, dev --json had no colleagueUrl, and the handler declarations hit TS2589 ("excessively deep"). Root cause, verified: init installs the release by tarball URL, and pnpm's store caches a URL tarball by its URL, so the builder's earlier smoke had left an older patchy-0.0.1.tgz in the store and every later init installed those bytes although the instance served the new ones. pnpm install --force does not refetch it either; only an empty store does. On top of that I had left the task file one directory up. Kept at /tmp/wf314/fresh-run1; its report is on the session, not repeated here.

    For the repo and dev loop ticket: a re-published release with the same version string is invisible to init; the release id (or the pinned tarball's integrity) must change with the bytes.

    Run 2 (corrected tree, verified current bytes and green typecheck before hand-off)

    • Done in about 8 minutes: server/followups.ts with a paginated list query on a byDone index, add and complete mutations with HandlerErrors, attribution from ctx.viewer never from browser args, a vanilla client with pagination and error mapping through isHandlerError; pnpm typecheck green; exercised as [email protected] and [email protected] in the two dev mounts with the completion attributed to the colleague in dev.log; published as team-followups (tier 2, one table, eight columns, one index, both artifacts, three handlers in the manifest).
    • Hosted check by the session (the agent had no browser session for the published page): followups.add 17 ms and followups.list 8 ms through server.call on the instance, rows in runtime_calls attributed to usr_dev; a blank name answered the handler's own empty_contact error; a malformed id was refused invalid_request.
    • Stalls, its own words, condensed: about two minutes on discovery (it found the run 1 patch followups live and unshared, chose a new name; a detour through a Python subprocess picked up the wrong instance, its mistake); publish --new refused as a file-mode flag; one browser-automation slip. No package was reached for.
    • Missing from the skills: that --new/--name/--patch are file-mode only; the company-scope flag shown only in CLI help; what to do when an unbound repo's configured name already exists in the company; how an agent verifies the published page without a browser session.

    What this says for the question

    A fresh agent goes from init --tier 2 to a published two-artifact version on the skills alone in about eight minutes, touching only the tree, when the installed release is the served one. The stalls it hit are CLI wording and a name-collision rule, not the contract. The typing trap in run 1 was the stale package, not the current Infer (the scaffold typechecks); the stale-store bug itself is the one product finding.

    Recorded by Claude Fable 5.1 via Claude Code, 2026-09-25.

  5. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Astra evaluation, second pass on round 2 (2026-09-25)

    Run on the round 2 README section, PR section, both skills and the round 2 diff of PR #380. Verbatim, then the session's verification.

    I’ll trace the transaction and callback paths, then separate closed fixes from unproven guarantees. I won’t change repository files.

    Static review of the supplied diff. Measurements are builder-reported; failure-path conclusions below are [INFERENCE], not independently reproduced.

    1. Original four points: partly closed

    • Capability revocation: partly closed. The transaction fiber provides ownership and joining, but the diff leaves Engine’s callback listener unchanged: no post-parse liveness recheck. closed becomes true only when the completion sentinel is consumed; earlier queued jobs execute. Recommendation: revoke admission at invocation completion, recheck after parsing, then explicitly settle accepted jobs.
    • Validation: partly closed. Pinned row shapes and host-owned refusal status/details are improvements. However, nullable table columns may still be omitted; descriptorKeys[value.kind] admits inherited lookups such as constructor, whose .has is not callable; issued remembers only the last refusal. ServerCall also forwards handler-error codes without checking descriptor.errors. Recommendation: require complete row properties, use own-key descriptor lookup, correlate refusals with their originating callback, and enforce declared handler codes host-side.
    • Discovery: diagnostics closed; trust gap unchanged. diffHandlers supplies useful paths, but guest-produced __describe remains self-description. Recommendation: document that limitation; use a trusted dispatch representation wherever correspondence is required.
    • Stored two-viewer attribution: not closed. Neither report supplies two stored rows. Recommendation: obtain those rows before declaring acceptance.

    2. Transaction shape: right seam, incomplete lifecycle

    A dedicated host transaction fiber, serialized callbacks and nested savepoints are the right direction for #310/#298. Opening at admission is reasonable—but open currently forks acquisition rather than awaiting successful admission.

    Four corrections matter:

    • Readiness and failure settlement. If the transaction fiber fails before entering its loop, queued callback replies have no failure cleanup. Await BEGIN/isolation readiness, and close/refuse pending jobs on every fiber exit, including interruption.
    • Deadline coverage. The timeout wraps engine.invoke, not scope.finish; joining a running callback can outlive it. The reported timeout smoke sleeps after an insert, not during a callback. Apply one invocation deadline across admission, retries and settlement; exercise a genuinely in-flight callback timeout.
    • Sticky serialization failure. serialized becomes serialization_failure only when finished is already rolled_back. A caught 40001 followed by a valid return still requests commit. Mark the attempt abort-only; settle callbacks, roll back, then retry regardless of the guest’s returned value.
    • Outcome classification. finish uses requested choice/error tags rather than actual commit phase; CompanyDatabaseError is classified unavailable even on the commit path. Track commit submission and acknowledgement before assigning unknown_outcome or confirmed completion.

    Finally, remove the second pool borrow. Two invocation permits are a prototype workaround, not the requested four-slot company capacity policy.

    3. Retry contract: authors need retry-safe handlers, not duplicate-write prevention

    “Safe to run twice” is both misleading and inconsistent with three attempts. A counter increment remains valid: failed attempts must disappear through rollback, not author-written deduplication.

    Recommendation: keep all serialization attempts inside the same #299 mutation key and expose only the final outcome. The skill should say:

    A mutation may execute up to three times within one call. Aborted attempts leave no database writes; only the successful attempt commits. Keep effects within transactional capabilities; external effects belong in actions. Logs may repeat.

    Transport deduplication and serialization retry remain separate responsibilities.

    4. Preact: keep #296; tighten enforcement and wording

    The reported +9.7 KB gzip is an explicit compatibility cost, not evidence against the decision. Externalizing Preact avoids embedding another runtime; synchronous transitions/no scheduler are correctly disclosed.

    Recommendation: retain patchy/preact, but enforce forbidden subpaths and resolved package provenance, not just selected bare specifiers. Remove the remaining vite/modulepreload-polyfill exemption to match the round-two brief. Qualify the skill’s scaffold description: it is served on tier 1, whose scaffold remains vanilla. Externalization alone should not be described as proof of single-copy resolution.

    5. Watchdog: responsiveness recovery, not invocation termination

    Health-probe recovery is reasonable for dev and this single-process prototype. A healthy probe, however, clears overruns without establishing that overdue invocations ended. Restart failure is swallowed after overrun.clear(), removing the recovery trigger.

    Recommendation: retain version/digest rebinding and process-loss notification. #298’s supervisor should own process generations, replacement admission, restart failures and resource limits. Keep transaction-outcome classification host-side. Exercise the late-sibling ProcessKilled path; the reported sibling timed out independently.

    6. Verdict

    Keep the architecture; do not call enforcement complete. Allison should know: (1) Preact now has useful compatibility evidence; (2) transaction ownership has the right shape but still needs lifecycle, retry and outcome corrections; (3) watchdog recovery is not containment, and stored attribution remains unproven. Nothing here warrants reopening the decided Preact, transaction or mutation-key direction. These are implementation and acceptance gaps—not reasons to redesign those decisions.


    Verified by the session against the diff: no post-parse liveness recheck in the callback listener (the registry lookup precedes the body read); serialization_failure is only reported when the transaction already ended rolled_back, so a caught 40001 followed by a valid return would request commit; the descriptor-key table is a plain object index; declared handler errors are not enforced host-side. All four stand as build fences, none blocks the question this ticket asks.

    Stored two-viewer attribution, now produced: on the fresh agent's published patch, followups.add called as the owner and as the colleague through server.call on the instance left two runtime_calls rows, usr_dev (23 ms) and usr_colleague (8 ms), each on its own invocation. The dev loop still proves it by dev.log lines only, because the dev runtime records no runtime_calls on any tier today.

  6. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Round 2 report: Preact scaffold, atomic mutations, astra's points, a watchdog (2026-09-25)

    Allison asked for the learning round 1 left out. Same builder, same branch, three more commits on PR #380 (2334a2f Preact, f69269e transactions and astra's points, e3b040e watchdog); the README's ## Round 2 has every number. Astra's second pass is the comment above.

    What holds now

    Asked Result
    Preact scaffold per #296 point 14 src/main.tsx + src/App.tsx, exact pins in dependencies, jsx: react-jsx + jsxImportSource: preact beside oxc.jsx.importSource, modulePreload off; patchy/preact loads compat once and re-exports what a patch needs; a patchy-preact skill served on both tiers; the import check refuses react, react-dom and preact/compat. onChange fired 5 of 5 keystrokes, forwardRef focus works, add through the form 112–114 ms, built document 14.5 KB gzip against 4.8 KB vanilla.
    One company transaction per mutation Opened at admission on its own fiber; callbacks are jobs on it (serialised, joined, then refused at completion); the table handlers' own withTransaction becomes a savepoint; commit only after the validated result; SERIALIZABLE with up to three whole-handler re-invocations on 40001, a fresh capability per attempt. On Postgres: writeThenThrow 0 rows, ten-callback mutation p50 14 ms, insert-then-timeout rolled back (0 rows), eight concurrent bumps on one row total 8 with 3 serialization retries. On PGlite: 0 rows, p50 22 ms, no retries (one connection).
    Astra's round 1 points t.row validates the pinned row shape; descriptor grammar closed; refusal codes from the host's own record; discovery disagreement names the path (notes.add.kind: declared "query", bundle says "mutation").
    Watchdog (stretch) A timed-out invocation makes the engine probe its workerd; an unanswered /healthz after the margin is the kill evidence; for(;;){} inside a handler is handler_timeout at 10.03 s, the process is replaced 18 ms after the kill, in-flight work rolls back and reports handler_timeout. Execution compatibility, not containment.

    Stalls: the company bound is two invocations (each callback borrows a second pool slot) until the borrow is folded into the held connection; the ProcessKilled path exists but the measured sibling hit its own deadline first; tier 1 keeps the vanilla scaffold.

    Fresh agent on the Preact scaffold

    Same set-up as run 2 (astra with tools, only the tree and its skills, a verified-current install), task: a Friday-lunch sign-up form with a meal dropdown, a confirmation, the list, and no duplicate emails.

    • Run 3 did not build: the agent obeyed the standing mocks-before-UI rule, published three static design options and stopped for a pick. A harness fault, not a product one: the task now states the design is decided.
    • Run 3b, about 9 minutes: server/signups.ts with list, find and add (three declared HandlerErrors), a byEmail unique index, the unique_violation from a racing insert caught and mapped to duplicate_email (this rides the new savepoint: the invocation continues after the refused statement); a Preact page with controlled value/onChange inputs, useState, useRef for reportValidity(), type="button" plus Enter handling. Zero React imports, zero onInput, no package reached for; typecheck green; exercised as both dev identities; published.
    • Hosted check by the session: signups.add as the owner (19 ms) and the colleague (8 ms), [email protected] from the colleague answered the handler's duplicate_email, signups.list returned both rows, four runtime_calls rows attributed to usr_dev and usr_colleague.
    • Its stalls: browser-automation slips (its own), and one real one: t.array results are readonly and the skill does not say so (the scaffold showed it). It could not open the published page: the offline session fixture's patchy.invalid domains do not resolve in a browser, so hosted verification stays with the session.

    For the map

    • Nothing in round 2 reopens Preact, the transaction model or the mutation key (astra agrees). What it adds are build fences, carried on resolution: the execution service ADR (refusals as data; post-parse liveness and a join at completion; abort-only after any 40001; commit outcome tracked before unknown_outcome; the second pool borrow folded away for the four slots; the watchdog is recovery, the supervisor owns generations and limits), the contract's skill facts (optional on args versus columns; readonly results; "a mutation may run up to three times, aborted attempts leave no writes, keep effects inside transactional capabilities"), and the repo and dev loop ticket (the scaffold recipe as built; refresh for new server files; a content-addressed release tarball URL, since pnpm caches by URL; the CPU-spin promise wording).

    Recorded by Claude Fable 5.1 via Claude Code, 2026-09-25.

  7. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Round 3 report: fences, ctx.shared/ctx.run, load numbers, a subscription (2026-09-25)

    Allison chose all four candidates for a last pass. Five commits on PR #380 (9548a9e fences, 7ebeb9c context, d40626d load knobs, 6aada97 subscriptions, 889f9ce README); steps 1–2 by the round 1–2 builder, steps 3–4 by an Opus 5.5 subagent after Allison moved builders off Fable. Every table is in the README's ## Round 3; the PR body carries the summary.

    What holds now

    Step Result
    Astra's fences Post-parse liveness recheck; completion revokes, joins the running callback, refuses the queued ones, then finalises; abort-only after any 40001; outcome from the commit phase (unknown_outcome only on a lost COMMIT reply); callbacks reuse the invocation's held connection so four slots carry four invocations; one deadline over admission, retries and settlement with SET LOCAL statement_timeout on callbacks; declared errors enforced host-side. Re-measured: 0 rows on write-then-throw and insert-then-timeout; ten-callback p50 12 ms; a timeout while a callback is blocked on a lock cancels the statement the same millisecond; a caught 40001 followed by a valid return never commits.
    ctx.shared, ctx.run A query reading another patch's shared table 9.4 ms p50; a mutation reaching it access_denied; an action running two sibling mutations and a query through ctx.run 20.5 ms p50, each nested mutation its own transaction and slot under the parent's remaining deadline. ctx.connections unexercised: the connect path wants verify-full TLS and a non-superuser role, which the embedded Postgres has neither of.
    Load, one company 4 slots / 4 connections: 20 viewers 155 calls/s (p50/p95/p99 82/343/530 ms, 1,269 busy); 50 bumps on one row: 30 commit, 20 exhaust three attempts; 30 s sustained at the slot count 302 calls/s, 12.5 ms p50, 0 busy. 8 / 8: 241 calls/s at 20 viewers, 357 calls/s sustained. Nothing leaks from the pool or the registries; workerd RSS grows 129 → 451 MB over ~19k calls and is not returned when idle; the Node host is the bound at about 3.1 ms CPU per call; a bare busy retried through full admission halves throughput.
    Subscription patchy.server.<m>.<query>.subscribe(args, onSnapshot) on the plain client; dependencies traced from the table calls the host already sees, shared aliases resolved to the owner's key; a tier 2 commit, a tier 1 write and a dev rebind all wake. Owner click to colleague snapshot 91 ms p50 on the published page; 50 writes → 16 re-runs; 0 after unsubscribe; owner-patch write to subscriber 42 ms; a server/ edit in dev reaches the live subscription on the new bundle in 79 ms. Not built: #313's v1 fences (durable revisions, up-to-date watermark, desired/admitted reconciliation, a separate re-run bucket, hidden-document suspension, the per-company semaphore).

    The colleague fresh agent (shared data)

    On a second checkout at the step 2 commit, with its own instance holding the round 2 lunch tool (its signups table marked shared, four sign-ups seeded), astra with tools was handed a fresh init --tier 2 tree and the task "a caterer view over the existing lunch sign-ups, without changing that tool". About 7 minutes: found lunch by patchy list --json, checked declarable: true, declared pnpm patchy add shared-table <id>/signups --as signups, read it from a query through ctx.shared.signups.list with pagination and aggregated on the server, kept its own orders table (unique byLunchDate), exercised both dev identities, typecheck green, published. No sign-ups copied, no package reached for. Stalls: truncated discovery output (its tool), the readonly-results fact again (now in the skill), and a domain gap (the sign-ups carry no week, which it disclosed rather than guessed).

    Design notes for the map

    • Dependency tracing for tier 2 queries is nearly free: the host sees every table callback. A wake that lands mid-run is kept and checked after the run returns, because the run's dependencies are unknown until then.
    • Two wake points exist (tier 1 writes in the runtime, tier 2 commits in the handler path); a build wants one rule: whoever owns the transaction announces the touched tables after commit.
    • server.call counts as a mutation on the wire, so subscribing to a query needed a shell exception; queries may want their own operation.
    • A bare busy sends clients through full admission again; the limits ticket should bound waiting (a short queue or client backoff), not only admission. Doubling the pool bought 18% throughput and doubled p50; the host's CPU per call is the lever.
    • A mutation that exhausts its three attempts on a hot row reports source_unavailable, indistinguishable from an outage; it needs its own code.
    • workerd memory needs a bound (the residency budget on the limits ticket), since the serving engine never returns it.

    Recorded by Claude Fable 5.1 via Claude Code, 2026-09-25.

  8. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Astra evaluation, third pass on round 3 (2026-09-25)

    Run on the round 3 README, PR section, brief and both step diffs of PR #380. Verbatim. Its four remaining gaps in point 1 and the correctness gap in point 3 are carried to the tickets named in the resolution below.

    Static review of supplied diffs. Measurements are builder-reported; [INFERENCE] marks failure-path consequences not independently exercised.

    1. Enforcement fences: partly closed — execution-service ADR (The execution service: engine, containment unit, invocation capability and the callback path #298).

      The diff closes post-parse liveness lookup, own-key descriptor grammar, declared handler errors, and callback connection reuse. Readiness is awaited on the successful acquisition path; callback 40001s now force rollback/retry despite a valid guest return. Fiber.await joins the running work. Four top-level transactional invocations no longer require eight pool borrows.

      Four gaps remain:

      • Transaction.finish enqueues a FIFO sentinel without first closing admission or refusing pending jobs. The loop never checks abortReason. [INFERENCE] queued callbacks still execute after completion or serialization failure.
      • Readiness cleanup wraps body, inside withCompany. [INFERENCE] acquisition failure before entering body leaves ready unresolved.
      • statement_timeout is assigned once and applies separately to each statement; acquisition and settlement have no absolute deadline. [INFERENCE] a callback starting near second nine can run substantially past second ten. The immediate-lock measurement does not cover this.
      • phase = "committing" precedes driver submission; there is no acknowledgement phase. SELECT 1 detects an already-aborted transaction, not the actual commit outcome. [INFERENCE] a known non-40001 commit rejection can become unknown_outcome.

      Recommendation: require lifecycle acceptance covering revoke/join/refuse ordering, acquisition failure, late-starting SQL, and driver-observed commit submission/acknowledgement.

    2. Load: decide backpressure, not laptop capacity — limits ticket (Limits and safeguards before billing: CPU, memory, wall time, concurrency and subscriptions #304), RSS ownership in The execution service: engine, containment unit, invocation capability and the callback path #298.

      The 1,269 busy replies demonstrate expensive retry traffic; they do not isolate its causal throughput cost. Both invocation admission and pool size changed between configurations, and sustained-run concurrency changed too: this is not a pool-only experiment.

      Twenty exhausted calls out of fifty make source_unavailable materially misleading. Zero invocation registries do not establish memory stability; 129→451 MB RSS remains unresolved. The ~3.1 ms host CPU/call is useful sizing evidence, not a profile proving which host components dominate.

      Recommendation: specify bounded waiting/backpressure, distinguish retryable serialization exhaustion from outages while keeping attempts inside one mutation key, and require supervisor memory limits; treat absolute throughput and optimal pool size as prototype-specific.

    3. Subscriptions: the tracing approach is sound, but recovery is incomplete — reactive queries build (Reactive queries: dependency tracking, invalidation after commit and the stream to every open client #297/Prototype: the reactive query loop across two browsers #313).

      Host-observed table dependencies, shared-owner keys, and retaining wakes during an unknown-dependency run are the right shape. The shell exception is acceptable only because ServerCall independently enforces query kind.

      A new correctness gap: ServerCall exports dependencies only for committed outcomes. A declared query HandlerError rolls back but returns a successful runtime envelope; the stream replaces dependencies with just the version key. [INFERENCE] subsequent table changes cannot recover that subscription.

      Action writes also notify only after the action settles, not after each independently committed write.

      Recommendation: build around transaction-owned durable revisions and a watermark fence, preserve recovery dependencies on handler errors, reconcile desired/admitted subscriptions, and design separate rerun rate limits, company/patch budgets and hidden-document suspension now—not as polish.

    4. ctx.run: separate transactions are sound; admission and target restrictions are incomplete — The server function contract: queries, mutations, actions, the context object and the generated client #296/The execution service: engine, containment unit, invocation capability and the callback path #298.

      Reusing the pinned binding and passing the parent’s absolute deadline are correct. A sibling mutation’s committed work survives a later action failure, as action semantics require.

      However, the host checks the caller is an action, not that the target is a query or mutation; nested actions remain possible. [INFERENCE] four parent actions can occupy every company invocation slot and make every child return busy. Passing a deadline also inherits point 1’s unbounded settlement.

      Recommendation: restrict sibling targets host-side and specify parent/child admission accounting alongside the shared deadline.

    5. Verdict — close the prototype; carry acceptance into the builds.

      Three rounds demonstrate scaffold-to-publish compatibility, rollback/conflict handling, and cross-viewer reactive happy paths—not complete enforcement. Preserve three fences: host-owned transaction completion; viewer-bound capability authority; durable after-commit subscription truth. Nothing warrants reopening the decided Preact, transaction, or mutation-key direction. Recommendation: close Prototype: patchy init --tier 2, server/, dev on the production engine and a two-artifact publish #314 as evidence, attach the gaps above to their destinations, and retain TLS-backed ctx.connections, dev shared-fixture reads, and stored two-viewer attribution as explicit acceptance work in the repo/dev-loop ticket.

  9. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Resolution

    Yes: a fresh agent goes from patchy init --tier 2 to a published two-artifact version touching nothing but the tree, and the decisions the map made on the way hold under running code. Allison's verdict on 2026-09-25 after three rounds: accept and call it done. Astra's three evaluations ("sound with named changes", "keep the architecture, enforcement not complete", "close the prototype, carry acceptance into the builds") stand beside it; nothing in three rounds reopens Preact, the transaction model, the mutation key or the execution service decision. The prototype stays on PR #380, never merged.

    What three rounds proved (numbers in the README and the round reports above)

    • The repo and the loop. init --tier 2 lays down server/, the Preact scaffold per The server function contract: queries, mutations, actions, the context object and the generated client #296 point 14 with patchy/preact loading compat once, patchy/_generated/server.ts bound to the config, and the patchy-server and patchy-preact skills; the tree typechecks in about a second. patchy dev runs the production loader Worker and workerd binary over PGlite with two viewer mounts, rebinds a server/ edit in about 120 ms, and keeps in-flight calls on their old binding. Publish builds both artifacts through the repo's Vite, runs the import check on both graphs with the agreed message, records handler descriptors, and the server re-derives the handlers from the exact stored bytes in a throwaway process and refuses disagreement, a top-level throw and a non-terminating initialiser.
    • The contract. Queries, mutations and actions as module-qualified exports; a grown t with full row-shape validation; HandlerError distinct from refusals with declared codes enforced host-side; ctx.viewer, ctx.tables, ctx.shared (queries and actions), ctx.run (actions, each nested mutation its own transaction under the parent's deadline), ctx.log. One company transaction per mutation held host-side with callbacks as jobs on it, savepoints under the table handlers, commit only after the validated result, abort-only after any 40001 with three attempts: write-then-throw leaves zero rows, eight concurrent increments total eight.
    • The wire and the shell. One server.call operation through the unchanged broker; a subscription on a tier 2 query with dependencies traced from the table callbacks the host already sees, owner-to-colleague snapshot in 91 ms on a published page.
    • The agents. Four fresh-agent runs on the skills alone: a follow-ups tool (8 min), a Preact lunch form with a savepoint-mapped duplicate error (9 min), and a colleague's caterer view over the lunch tool's shared table (7 min); no package reached for in any of them; every stall was CLI wording, a readonly-results fact (now in the skill) or the agent's own tooling. The one product finding from a failed run: pnpm caches the release tarball by URL, so a re-published release with the same version installs stale bytes.

    Decided here

    1. The init --tier 2 shape, the two-artifact publish with server-side re-derivation, and patchy dev on the production engine are proven and go into the spec as built; the repo and dev loop ticket writes the recipe from this branch rather than re-deciding it.
    2. The transaction is owned by the host in the execution seam (Transaction.ts shape: one fiber per invocation, callbacks as jobs, savepoints from the table handlers, the invocation's connection reused by its callbacks so four slots carry four invocations), never by the guest or the primitives.
    3. Refusals cross the loopback as data, never as thrown errors; the ADR says the stub answers with a result.
    4. A handler's declared errors are enforced host-side; an undeclared code is handler_failed; a handler error rides a successful wire reply and gets its own runtime_calls outcome (the spec names it).
    5. optional on an argument field means the key may be omitted and t.nullable means null; on a column optional means nullable; handler results are readonly; a mutation may execute up to three times within one call, aborted attempts leave no writes, external effects belong in actions. All four are skill facts.

    Carried forward, with their destinations

    Resolved by Claude Fable 5.1 via Claude Code with Allison, astra as the design pair, 2026-09-25.

  10. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Resolved above; decision line added to the map, addenda on the execution service, limits, spec, repo and dev loop, composition and reference CRM tickets. PR #380 stays open as the prototype, never merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

wayfinder:prototype

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions