ForgeDocs

Source exchange

nforge exchange checks out hosted source, restores retained checkpoints and migrates older archives. Saves and landings use the hosted Lane APIs. Exchange push and automatic exchange are retired.

Run nforge login DEPLOYMENT_URL and approve the device in Forge. Saved credentials are used automatically; FORGE_AUTH_TOKEN remains an environment override for CI, bound by FORGE_DEPLOYMENT_URL (or a saved default/login origin). Never put credentials in request files. Owners can migrate retained archives. Contributors can read accessible checkpoints and upload immutable proposal objects. A scoped source grant cannot upload.

nforge host ROOT creates a project through a one-time paged hosted seed. A plain directory is first captured into local Forge-native source without invoking Git; normal ignore rules apply, with exact file bytes and executable modes retained. Git worktrees keep their Git source and history in a verified bundle. Git's progress renews the local wait budget during bundle creation and verification. A bundle that stops reporting progress still returns WORK_GIT_TIMEOUT. This path uses Git's --no-lazy-fetch option, available in upstream Git 2.45 and later. Hosting pins native main and its actual acceptance receipt (or explicitly records the bootstrap State when no acceptance exists), portable Work bytes/revision, and journal-only commands, attempts, waits and unknown outcomes in recovery format 1. Immutable objects and Work records reuse the missing-object upload layer and R2 presigning. Source/record validation pages contain at most 100 references and 128 KiB of metadata; source/record bodies use a 2 MiB action window, with an oversized individual body handled alone. Each committed page saves its cursor. Retrying resumes that cursor and the original local capture, even when local Work has since advanced. A completed seed returns its original checkpoint without uploading again. Native schema-2 seeds retain their paged-validated records catalog for compatible reads and recovery.

Partial seeds select neither a checkpoint nor hosted main. The final action reads and hashes hosted native main, compares it with the pinned native digest, then atomically selects the checkpoint and main and records seed completion. It checks the authority mode/epoch and selected source/journal pins captured at seed start. New native hosts pin server birth in the original hosting and seed request. The final seed transaction selects matching server authority and schema-2 main together; partial seeds never expose server authority. The resulting project can be cloned and its first Lane started immediately, without an index rebuild. Existing hosted projects and interrupted older seed requests keep their original authority; switching those projects still requires their existing cutover path. No seed polling or scheduled continuation runs. The command drives the finite pages itself; rerun the same hosting command after an interruption. --wait remains accepted, with no first-host background history backfill.

Use nforge host ROOT to create and bind a hosted project. Bound pull checks out selected hosted main:

nforge exchange ROOT pull --target NEW_DIR

Omitting --target uses a sibling named ROOT-hosted-main. Full Work recovery is the separate restore command below. A project without a hosted copy moves to one with nforge host; the local landing driver is gone (one client mode).

Source return and exchange push are removed, including push preparation, whole-closure missing-object negotiation, whole-Work publication fallback, bound push queues, automatic exchange and its spend pause. Old CLI push commands and the former publication RPC addresses return structured CLI_UPGRADE_REQUIRED errors before source or transport work. Stored local requests and historical receipts remain recovery inputs; these tombstones do not replay publication.

Rollback folds hosted work through recover before reverse CAS at a higher epoch. It never pushes or invokes source return. Historic journal events, table definitions and stored-document validators remain readable.

Explicit project IDs and original request files remain supported:

nforge exchange NEW_DIR pull --command-file forge-pull.json
nforge exchange ROOT migrate-archive --command-file forge-migrate.json

Supported repository envelope

Hosted source steps currently materialize logical State manifests in memory. Before loading a State, its recorded logical file count and manifest bytes must fit both bounds for the operation:

OperationFiles per StateLogical manifest bytes per State
Save122,40019,360,000
Compose68,80011,200,000
Sync, conflict sync and conflict resolution56,8009,200,000

These are manifest bytes (paths, hashes, modes and State metadata), independent of file-content sizes and of raw, packed or recipe storage. Long paths can reach the byte bound before the file bound. To use every phase, keep each State within the smallest pair. The boundary itself is accepted; exceeding either number returns SOURCE_STATE_TOO_LARGE, the phase, measured dimension and limit, one next step (split the repository), and this documentation link. CLI, MCP and web retain the same error. The refusal is terminal: it does not retry, publish a State or change a Lane. Its control receipt is retained through the ordinary failure path.

Sync reserves the conflict-sync envelope because the same sync request can be clean or conflicting; deciding which requires reading its source. Both bounds include a 20% margin below the smallest fitted conflict crossing. Save and compose use the same margin against their own crossings. The measurement and margin derivation are local risk evidence, not a guarantee for every content or ancestry shape.

New States record both dimensions in their existing metadata write. A legacy State without them proceeds as before, with no extra read or backfill job; its next successful load records them in the step's existing completion write. Until then the early guard cannot cover that State. Hosting and import record dimensions on the existing seed/import completion, and use the same guard wherever they run these source steps. This adds no Convex call or R2 request on the healthy path; idle work remains zero. Logical source bytes remain in R2.

The P8 streaming source-steps Issue owns replacing whole-manifest work and relaxing or removing these temporary bounds.

Long actions

Index rebuilds yield after committed batches. Pending responses continue the original request with continuation:true; unchanged saved progress stops with EXCHANGE_ACTION_STALLED. Long transfer actions retain seven-minute header and total deadlines, including Node's HTTP dispatch deadline. Reads, archive migration, initialization and object-recipe completion retain their existing retry and validation behavior.

CLI upgrade

Installed clients calling retired push, publication or source-return functions receive CLI_UPGRADE_REQUIRED with the cutover upgrade command. Install the matching Forge CLI release, preserve local edits and operation IDs, and resume saves and landings through hosted CAS. Existing object downloads, checkout, restore, export and archive migration remain available. Source recovery never treats an old publication receipt as new write authority.

Repair a completed hosted seed records marker

For a native project seeded before records validation was recorded, the lead can run this bounded internal repair after deploying the updated functions. Substitute the existing dogfood project ID and select its deployment through the usual Convex CLI configuration. The dry-run lists exact backup and seed operation IDs; apply changes only that completed seed's backup and is idempotent. It confirms the schema-2 catalog through bounded metadata reads, without loading full Work or scanning the deployment's backups. Git, schema-1 and incomplete seeds are excluded.

npx convex run projectHostedSeedRecords:backfill '{"projectId":"PROJECT_ID","dryRun":true}'
npx convex run projectHostedSeedRecords:backfill '{"projectId":"PROJECT_ID","dryRun":false}'

Work record exchange

Schema-1 byte trees and schema-2 stable-key record catalogs remain readable for retained checkpoints, Work projections, journal reconstruction and recovery. Hosted seeds use bounded metadata pages and validate their selected source before committing. Shared record readers verify exact Work and manifest pins, preserve canonical digest semantics and recheck current access at the underlying storage boundary.

The exchange publication delta planner and its continuation/attempt stores no longer execute. Their table definitions and document validators remain until the separate table purge. Shared byte-tree, upload, download and record-reader modules remain because hosted checkout/save/seed, proposal import, archive migration, cleanup and read projections call them.

Recovery

Hosted metadata reconciliation and exchange baseline hints have been removed. Hosted Work is the current record; recovery restores a pinned source and Work pair into an independent owner. Historic companion receipts and journal replay remain readable.

restore builds a new owner from backupId (also accepted by the legacy pull request). Optional cacheRoot reuses source bytes from another owner, and journalPath supplies the hosted Work journal. Restore checks every hash, never runs repository commands, and never overwrites an existing directory.

Migrate an older archive

migrate-archive converts one native .tar.gz backup to shared objects. It needs backupId, archivePath and originalDigest. The converter verifies the archive, uploads missing content and switches the same backup ID to the object form. Only then is the old compressed copy removed. A failure before the switch leaves the archive selected.

Retries

Keep each original request and operation UUID after an unknown outcome. Hosted seed and archive migration reconcile their original retained operations; metadata reads and replay-safe transfers retain bounded retries. Stable authorization and changed-operation errors remain structured and do not silently change source pins.

Exchange HTTP requests bound response headers, body inactivity and total request time. Object transfers and Convex queries/mutations allow 30 seconds without headers or body bytes, with a two-minute total per attempt. Long Convex actions (journal export, logical-manifest reconstruction, index preparation, initialization, object-recipe completion and archive migration) allow seven minutes both before headers and in total, with 30 seconds of body inactivity after headers. Quick checkpoint and download actions keep the short transfer deadlines. Long actions also override Node's underlying HTTP header deadline to seven minutes; extending only the application timer would still stop them at the transport's five-minute default. Reads and replay-safe actions retry three times after 100, 200 and 400 ms; each retry keeps the exact payload and operation ID. Prepared save, sync and compose submissions whose HTTP request window ends subscribe to the original operation's progress instead of treating the timeout as its outcome. The wait reports the server's real receipt or the existing same-operation continuation when its own budget ends. Successful submissions add no read or subscription. Landing admission retries its identical retained request after a lost timeout reply; it never generates a replacement operation or raises HTTP timeouts. Exhausted network failures report EXCHANGE_REQUEST_TIMEOUT or EXCHANGE_REQUEST_FAILED with the call name, never a signed URL. Structured Convex function errors keep their original code. Upload POSTs to Convex storage are bounded but not blindly replayed: retrying the original transfer reconciles its existing nonce-bound objects. Redirected Convex storage downloads and recipe leaf reads also buffer the complete response inside these deadlines; a partial body never outlives its timer. Legacy archive metadata and ancestry keep their streaming/early-cancellation behavior inside the same deadlines. Server-side R2 and archive range reads use the same 30-second/two-minute bounds with one retry; range-less archive responses still discard their prefix and cancel the unused suffix.

R2 signed GETs are checked for every uncached object, even with new R2 writes disabled. Signing returns no URL for Convex-stored objects, which retain their existing download fallback. Every new object is written to R2; there is no write flag or project opt-in.

Journal export pages hosted events and streams checkpoint byte reconstruction. Schema-1 Work reconstruction reads four byte chunks at a time; record checkpoints keep their bounded record windows. Export hashes parsed Work with a streaming JSON digest rather than building a second complete Work string. Export still materializes complete parsed Work and the returned journal; it is not a proportional metadata read API.

Zero bytes uploaded does not mean zero work. Validation and hashing still happen locally. To time one request, run node scripts/measure-exchange-latency.mjs REQUEST_JSON RESULT_JSON.

Object proposals and browser imports

The Backups and Proposals pages accept local export files and upload logical objects rather than compressed archives. Identical content is reused. New backup imports use the finite paged hosted seed; original operation IDs resume the same project and seed after an interrupted response. Existing archive uploads remain resumable. Existing archive downloads and independent checkpoint recovery remain available; current hosted edits use clones and Lanes.

For an object proposal, download its receive request ({url,projectId,proposalId,operationId}), then run:

nforge exchange ROOT receive-proposal --command-file forge-proposal-receive.json

This downloads and validates the proposal, then imports it into a separate Lane in the existing owner using the original operation ID. pull-proposal with {url,projectId,proposalId,cacheRoot?} is also available to retain an unpacked export in a fresh directory. The receive command supplies the pulled directory, manifest SHA-256 and original source pins to the retained contribution importer. Its compatibility fields also accept local archives with their original compressed digest. The importer validates complete source closure and creates a separate Lane; contributor Work and check claims never become owner evidence.

Hosted main client checkout

The normal clone refresh is nforge pull ROOT; use nforge status ROOT for its freshness and the distance in accepted source revisions. Agent pull {} uses the same implementation (MCP forge_task, without a new tool). Root/address receipts remain beside the checkout and its installed .forge/hosted-main.json advances after changed source files are durable. The original clone-operation receipt remains pinned to its original selection; it is not the installed-baseline record.

Pull validates the full checkout and stages changed files. It keeps ROOT and surviving directories in place, so existing shells and editors retain their cwd. It refuses tracked edits with a next step to move them into a Lane, preserves disjoint ignored artifacts/dependency links, and never merges local source. Recovery retains the original operation. A sibling publication journal backs up changed files before renaming their replacements from the verified stage. The marker publishes last; interrupted publication restores changed paths before validation and retries. Occupied paths with different bytes surface as conflicts. Completed retries cannot rewind a newer root. Initial clone and legacy interrupted swaps retain their prior recovery path. Completion follows durable publication and backup cleanup. Main clone roots remain outside Lane prune; the sibling Lane cache is untouched.

Pull uses its recorded protocol to select the current-authority head API directly, without discovery or fallback: one query, zero GETs when current; otherwise two head queries plus 100-object descriptor pages for a missing target manifest and changed blobs. Unchanged source is reusable from ROOT even after cache eviction. Refresh skips full source packs. Actual request counts and transferred bytes are returned as cost; recipe metadata and physical chunks add their own bounded calls/GETs. Access is checked even for cached/completed retries, then again after transfer/staging before publication. All new bytes come from R2. No Work owner, background refresh or idle network call is added. Lane sync semantics are unchanged.

State-bound readers verify an optional physical manifest against the selected State before using its raw, packed or recipe bindings. A missing or invalid manifest reports catalog fallback for that same State; complete point authority keeps this fallback available after dense catalog pages are retired. Content continues through the shared hash, size and exact-range verifier. See physical source manifests for the reader and writer boundaries.

The low-level exchange commands below remain available with explicit requests.

Large downloads stream to private files and validate their complete hash; recovery creates independent writable root/Lane files before publishing the new owner. Source bytes are content-addressed objects in R2. A checkout missing 500 or more objects takes the project's latest source pack instead of object pages, and falls back to objects if the pack is unavailable (see data placement). The owner repair nforge x ROOT source-pack '{}' packs the current hosted main from this machine and publishes it to R2, so checks and Lane opens read one pack; run it after seeding, cutover or importing a large repository. Ready indexes keep the same public generation ID, preserving browser query identities. CLI cursors pin the source revision and return WORK_STALE when it changes; multipart payload reads compare revisions before returning a record. Root receipt digest and logical manifest digest are distinct. Original-operation retry uses its pinned payload and asks for the exact existing receipt before rediscovering content; preserve that operation until reconciled. A receipt lookup rechecks current authority and does not rewind a later selected checkpoint or establish fresh storage health.

projectMain:current is the client contract for current hosted main. Its schema-1 reply names projectId, the selected source generationId and backupId, the native State head, and receipt (id, kind, previousHead, previousReceiptId). A hosted receipt takes precedence over the uploaded native Channel receipt. With no hosted move, the latest accepted native main receipt is the seed. A project without an accepted main receipt is not yet checkout-ready. The generation's record partition is an implementation detail, not a source pin. The query checks current project access and observes selection and receipt in one transaction. Optional expected: {head, receiptId} refuses stale observations with CHANNEL_CHANGED, including a different receipt selecting the same head. This read expectation does not change acceptance semantics or grant write authority.

Open an empty directory without an owner checkout:

nforge exchange CLIENT_DIR open --command-file main-pull.json
nforge exchange CLIENT_DIR pull --command-file main-pull.json
{ "url": "https://DEPLOYMENT.convex.cloud", "projectId": "PROJECT_ID",
  "operationId": "ORIGINAL_UUID",
  "expected": { "head": "STATE_SHA256", "receiptId": "CHANNEL_RECEIPT_ID" } }

Omit expected to select the current observed main. The client durably pins that selection under the original operation ID; interrupted retries continue that exact head even if hosted main advances. A completed retry returns its original receipt without rewinding a newer checkout. Use a new operation ID for a new pull. Current read access is checked on every invocation, on each object read and again before publishing files; a cache never grants access.

Only the selected State and its file blobs are downloaded, using the existing project object bindings and storage transport. The sibling CLIENT_DIR.forge-client cache retains verified SHA-256 objects and operation receipts for resumption. Unchanged pulls transfer zero objects; a changed file fetches its new blob and new State. Every downloaded object's size and hash are verified before installation. Files and executable modes are staged, then the directory is replaced under a local publication lock. An interrupted replacement recovers the previous directory or recognizes the installed checkout on retry. Local modified, deleted or untracked files are preserved with WORK_CONFLICT. The selected contract is recorded in CLIENT_DIR/.forge/hosted-main.json; this directory is a source client, not a native Work owner, and does not acquire independent acceptance authority.

Bound nforge exchange OWNER pull --target CLIENT_DIR uses this same checkout (default sibling: OWNER-hosted-main). For explicit, repeatable operation identity, use the command-file form above. Full retained history/Work recovery remains separate: nforge exchange NEW_OWNER restore --command-file restore.json takes {url, projectId, backupId, cacheRoot?, journalPath?}. The older pull request with backupId remains a compatible spelling of independent-owner restore. Restore continues to materialize the uploaded native head; it does not claim to track hosted-selected main. Git interoperability remains a derived projection of native source, not an additional main authority.

Pending saved work

Hosted Lane saves and finish submissions retain their current durable journals and exact source pins. Native owner saves no longer write pending-exchange.json, start an exchange worker or run a spend observation. Old local auto-exchange/spend/progress sidecars and policy fields remain readable historical data and do not launch work. Status no longer advertises automatic push or spend-pause actions. Idle exchange costs zero Convex calls and starts zero local processes. Explicit recovery exports and the recovery inventory remain separate.

Recovery inventory

nforge host ROOT --status includes the read-only recovery inventory. The exported readRecoveryInventory(root, now?) function returns the same typed data for other status consumers. It performs no network calls, export, check recovery or Work mutation. It reports completed seed/exchange/export capture times, root source and accepted main heads, exact Work revision/hash, manifest pin, complete-history state and each check evidence path's included/unavailable status. Source/Work capture time is separate from evidence sampling and successful completion time.

A successful local export is listed separately and does not prove an off-machine copy. Completed seeds and exchanges with complete retained history establish the inventory's off-machine baseline. First hosting records a complete seed capture only after seed finish succeeds and the pinned main digest is validated. Failed or unknown finish outcomes add no capture until a retry confirms completion; completed replays reuse the same receipt. Missing logs/artifacts remain unavailable even when source and Work publication succeeds. Nothing here blocks export, manual push, checking or acceptance.

Pending saves compare canonical record fingerprints against that baseline, including unlanded Lane checkpoints, check completions and changed Work records. These are saved records, not a count of every intermediate editing operation. Evidence fingerprints detect later running-log bytes even without a Work revision change. Oldest pending age uses recorded save times; un-timestamped replacements, unknown capture times or pending evidence with no save timestamp produce null, not zero. oldestKnownPendingAgeMs preserves the oldest known save age separately. Unsaved filesystem edits and running processes remain outside this inventory.

The durable inventory and capture timing are local sidecars under .forge/work, not canonical Work or additions to the archive/exchange wire format. They survive process restarts without triggering another save. Existing captures without timing report unknown time; restored owners without those sidecars have unknown prior coverage. Preserve an export's returned recovery receipt alongside an off-machine archive when recording its identity. Receipts describe observed successful capture, not current remote storage health or a promised backup cadence. A reporting write failure returns RECOVERY_INVENTORY_UNAVAILABLE without changing publication success; missing/corrupt inventory never establishes coverage.

Guided existing-project recovery

Native-owner recovery/reconnect is removed. Use hosted runner/cache recovery or restore a verified deployment snapshot; hosted main remains authoritative.

The server gate is sourceAuthority(binding).mode === 'server' || state.authorityTransition?.mode === 'server'. Under server authority, recovery creates a runner/cache from selected hosted main and exact paged Work, queue, acceptance, completion and source-return receipts. It creates no native accepting owner, and its only hosted mutation is ordinary runner registration. This path takes {operationId,url,projectId}; native archive options do not select an accepting server owner. The retired native reconnect RPC returns CLI_UPGRADE_REQUIRED without writing. Keep the operation ID and destination across interruption.

Hosted source recovery seeds an iterative queue from exact State registration pins before walking ancestry. Missing registrations are resolved explicitly; incomplete projections never establish that source is absent. Discovery receipts retain parent pins and deduplicated unknown file hashes without retaining parsed historical trees. Unique missing file pins use 100-digest project lookup pages; already retained file bytes and completed closures need no repeated lookup. Downloads reuse the existing batched signing/byte transport in bounded windows, with large opaque files streamed to private storage. Completed State receipts point at a shared immutable inventory of the retained closure. An interrupted walk resumes discovery and completed downloads under the same operation. Completed retries reuse their original inventory roots, including completed folds created by the prior recovery implementation.

These local receipts are byte/inventory caches, not access grants. Source closure finishes before the second hosted-table scan, which rechecks current access and the selected authority/main/epoch and verifies every table's captured hash before publication. Object resolution and signing retain their existing authorization. Recovery starts no timer, poller or background work while idle.

A weekly deployment ZIP first restores its application/backend, then the same guided command follows the restored authority mode. See Route B and the recovery drill for commands and measured fixture times.

Hosted main clone loads the shared State and byte-tree formats without loading native Work, ancestry, graph or archive-construction services. Exchange metadata reconstruction loads those services only when a manifest is requested. Checkout bytes remain bounded by the existing transfer concurrency and recipe chunk sizes; file manifests still scale with the selected tree.

Hosted Lane editing checkout

nforge exchange NEW_DIRECTORY open-lane --command-file REQUEST.json opens an exact hosted Lane selection without restoring a Work owner. The request is {url,projectId,laneId,operationId,expected?,paths?}. Optional expected pins {head,sourceVersion,version}; stale pins return WORK_STALE. Use the existing login or FORGE_AUTH_TOKEN, never a token in the request file.

Omit paths for all files, or select relative file/directory paths for a sparse checkout. An empty array initially opens only the baseline marker. Later calls expand the selected paths; omitting paths expands to a full checkout. Existing materialized paths and directory scopes remain selected. Paths describe editing scope and confer no access or landing authority.

.forge/hosted-lane.json retains the full baseline State, exact schema-2 Lane selection, deployment URL, operation UUID, scope and actual materialized paths. Each baseline entry includes its digest and mode. Missing paths outside that set are unchanged, never deletions; a missing materialized path is a local deletion. Save clients must use that distinction when constructing an explicit delta. Hosted save publication is a separate API; checkout itself changes no server head.

Verified objects and original-operation receipts live beside the directory in NEW_DIRECTORY.forge-client. Membership and R2 signing use windows of at most 100 missing objects; full source/Work archives and Channel histories are not read. An unchanged checkout downloads zero new source objects. Source files are writable independent copies; executable modes, binary bytes and symlink target bytes are preserved, including dangling links. The same symlink handling applies to hosted main checkout.

Warm checkouts use machine objects directly, avoiding another per-Lane object-store copy before cloning the independent editing files. Each object is hashed once, as its clone enters the stage; a mismatch drops that machine entry and fetches it again. Older per-checkout object stores are still reusable when a machine object is missing. Copies are staged and hash-verified before a separate bounded durability pass fsyncs every regular file; directory flushes still precede the atomic install. Local clients for the same OS user share one I/O worker budget per volume. Workers take recoverable FIFO permits across processes; cache verification/fill, copy/hash and both durability passes use those same permits. Each volume also has one editing write pass at a time, covering independent copies, durability and publication; parallel cache verification and network preparation take no editing-pass lease. This preserves transaction locality across trees without a CPU-derived count of full open pipelines. Copy/hash and durability use separate volume epochs, so a flush cannot repeatedly commit metadata another open is concurrently cloning or changing. FIFO phase admission drains the previous epoch before starting the next; unrelated volumes proceed independently. The aggregate budget is one filesystem worker per OS-assigned CPU, using availableParallelism() across processes. Each open's local dispatcher also stays within Node's filesystem pool (four by default, or the runtime's UV_THREADPOOL_SIZE). These are worker bounds, not counts of complete pipelines. Between I/O phases, CPU work and network waits do not retain workers. Ready I/O reuses worker tickets until a queued peer needs capacity, checked at the existing one-second wake cadence before rejoining FIFO; idle permits are retired immediately. Spare-worker probes use that cadence too, avoiding per-file queue metadata. No idle worker, watcher or timer survives an open. Pack streams acquire permits per bounded chunk; source bytes still stream rather than accumulating a whole tree in memory.

Cache and destination devices are acquired in sorted order when they differ. The queue location is independent of XDG_CACHE_HOME, project and object-cache location. Every open is admitted and retains its selection and operation while waiting. Dead process tickets use kernel process start identities for recovery. No hosted calls, digest checks, independent writable inodes, durability barriers or checkout recovery steps change.

Each attempted local open appends a bounded kind: checkout receipt to the existing <root>.forge-metrics.jsonl operation journal, including on failure and replay. It retains milliseconds for local worker stall (pending I/O with no active worker), cache verification/fill, copy/hash, durability, stat indexing and publication, plus total time, file count and process peak RSS and the selected host/local worker budgets. Cache time includes downloads on misses; other local setup remains in total time. Phase times exclude recorded worker stall; the phases, stall and remaining setup/selection time account for the total. writePassWaitMs identifies the shared editing write-pass wait within slotWait; it is a subset, never another phase to add to the total.

prep covers the hosted command through checkout completion. startupMs is the process monotonic origin through hosted CLI dispatch (module loading, validation and address discovery included, plus any release-check wait), or null for direct library checkout callers. Executable agent commands begin observing before freshness checks, so their RPCs are retained too. rpc groups complete SDK calls by function name, with call/failure counts and summed wall milliseconds, including queueing, retries and response decoding. rpcAttempts counts actual HTTP attempts, including retries; a queued SDK call cancelled before sending contributes no attempt. Overlapping RPC walls do not add up to elapsed time. These are client calls, not server-internal executions or a billed-usage meter; dependency linking and later command bookkeeping are outside the receipt's scope.

transfer retains successfully cached ordinary-object counts and logical bytes, source-pack object counts and compressed pack bytes, the pack outcome, and summed transport download milliseconds (including failed attempts). Download spans may overlap and remain included in cache time. Pack bytes and logical object bytes are different units; neither includes HTTP/TLS overhead or provider billing. These fields reuse local clocks, counters and the existing receipt; they add no Convex calls, tables or idle work. Opening verifies source hashes without building syntax or line summaries for the whole tree. On save, overlap evidence for changed paths is derived lazily from the retained baseline objects, with their digest and private-file identity checked again. Successive saves reuse those compact original-baseline summaries; missing or corrupt baseline bytes leave evidence unavailable under the existing advisory rules. No extra server request is needed to build a summary.

The install stages a complete selected directory before replacement. Dirty files, mode/link changes, local deletions and untracked content return WORK_CONFLICT with content preserved. Interrupted downloads leave the existing checkout intact; retry the original request UUID to resume its pinned selection. Install recovery restores the previous directory when replacement stopped between renames, or reconciles the installed operation marker after a lost completion receipt. An older unfinished checkout cannot overwrite a newer marker. Completed retries recheck access and return their original receipt without rewinding newer edits.

Hosted Lane save API

saveHostedLane(root, {operationId, message}, exchange) saves a thin hosted Lane checkout through the hosted save APIs. The hosted agent CLI uses this same source-client helper; browser editor wiring is separate. The operation retains its command, captured bytes, full baseline and delta pages in the sibling .forge-client/saves cache. Only changed files are captured to disk; unchanged files are hashed in memory (up to 1 MiB each) or through a temporary file that is removed. Once prepare succeeds, the server holds the request and every staged blob, so the save removes its staged blobs and writes acknowledged. Once its outcome is applied, it keeps only command.json, request.json and terminal.json, and a retry answers from terminal.json. The next save of the checkout also removes staged blobs left by earlier saves that were acknowledged, or that were prepared and are no longer pending (older clients kept a full tree copy per save). A save that was never acknowledged keeps its bytes. Retry the original operation after a lost upload, commit or response. Later local edits remain on disk; retry uploads the captured bytes. Successful reconciliation advances only the matching checkout baseline marker, without installing files.

Saves self-repair a stale checkout. A save whose source job finished after its reply leaves a save-baseline-* file pinned to the old marker; the next save (or abandon) settles it first with one progress read (none when no file exists), so it never captures against the old head. If preparation is refused WORK_STALE (the Lane moved on the server, for example a sync whose local apply was refused), the refused operation began nothing: its retained capture is dropped, the checkout is rebased onto the current Lane (one Lane read, plus the new manifest and changed blobs in page-sized batches) and the same operation saves again. Rebase only rewrites paths the server changed whose working file still equals the old baseline. Otherwise SAVE_REBASE_CONFLICT changes nothing and prints one repair command: abandon with keepPatch:true. A save made while the earlier one still publishes returns SAVE_PENDING; retry the same save.

A delta names each changed path's exact prior blob/mode and its replacement or explicit deletion. Unmaterialized absent paths remain unchanged. Local additions, rename-as-delete/add, executable modes, symlinks and binary bytes use the same contract. Small captured files (up to 2 MiB) use raw lazy upload windows: one batch preparation and commit, without reading bytes for stored members. Larger files retain missing-only file-backed chunk/recipe upload. Recipe validation resolves descriptor frontiers in pages of at most 100 and rechecks current access after each consumed window, while verifying each pin and the complete logical hash. Ordered delta metadata pages contain at most 100 changes and 128 KiB. These windows do not limit the total source size. An unchanged save records success without moving the head or launching a worker.

projectHostedSaves:prepare, stage and progress retain the original operation, baseline, counts and exact linked page root. Preparation also returns the original server-timestamped worker input, allowing its upload to share the delta-page window before staging. The worker batches changed-blob read grants and State/result output commits. projectHostedSaveJobs:submit accepts an optional {index,page} (contract feature save-submit-page) and stages that last page in the same transaction, so a one-page save makes no stage call. It creates one child source job pinned to the internal Convex source worker and its fixed runtime. The trusted worker verifies the baseline State and each prior delta entry, downloads changed blobs with bounded buffers/private disk, preserves other paths and constructs the native State with server-selected parent/time. It never materializes or executes repository code. State metadata still scales with the file manifest in worker memory.

The authenticated source-control ingress maps the worker's grant and commit requests to internal projectHostedSaveTransfers functions, passing the exact serialized dispatch, execution ID and content pin. Each call rechecks current project/contributor access, authority epoch, worker lease and fence. Read grants sign committed project objects, including verified recipe leaves; output grants use the existing configured R2 path and create-only checksum-bound PUTs. Commit performs HEAD verification and then rechecks authorization and the exact storage key before binding the bytes. Source bytes do not pass through a Convex action. The fixed worker also uses describe-batch, grant-batch and commit-batch. The authenticated ingress routes these to projectHostedSourceTransferBatch's describe, grant and commit, deriving the project from the authenticated dispatch. Requests carry digests or pins arrays of at most 100 in original order; description replies decode canonical JSON to descriptor arrays. Every batch independently rechecks the same current authority/epoch/execution/lease and each exact object binding; post-HEAD commits recheck every storage key. Signed read grants are consumed immediately for that page, not retained as an authorization cache. Single-object endpoints remain available to pinned workers. These functions are internal: deployment, authenticated ingress routing, key and provider provisioning remain required operator integration, not an enabled public HTTP endpoint or a live end-to-end qualification.

A signed terminal source-job callback schedules projectHostedSaveJobs:complete. That action reads only the small result manifest; the final mutation binds it to the original input and signed job output, checks committed State membership and atomically registers the State, CAS-updates the Lane, appends one save and retains the original receipt. Two changed saves racing on one baseline have one winner; the loser receives retained WORK_STALE evidence and keeps its delta. A new save or sync can use that preserved source. Completed retries return their original receipt and never rewind later Lane work. No main, Candidate or landing authority is granted by a source upload or save.

Hosted compose API

These APIs compose saved hosted source without a local Work owner. The hosted agent CLI stages the same exact selection pages; browser controls are separate. projectHostedComposeSelection:page({projectId,inputs,dependencies}) reads up to 100 selected canonical Lane/Candidate records and their deduplicated State descriptors in one authorized call, preserving selection order. Inputs accept optional exact expected head/version/source/lifecycle pins; dependencies accept an optional exact clean head. Staging still rechecks all selected pins and authority. No catalog or Work history is loaded to assemble a selection.

  • projectHostedCompose:prepare({projectId, request}): request is JSON matching composeRequestSchema: original operationId, intentId, authorityEpoch, expectedMain:{head,receiptId}, message, and inputs/dependencies manifests. Each manifest is {root:{sha256,size},pages,count}. Even an empty selection uses one canonical empty terminal page. Select a Lane or dependency overall.
  • Input page entries bind {laneId,head,version,sourceVersion,lifecycleVersion,state}. Dependency entries bind {candidateId,head,state} to a clean immutable Candidate. state is {object:{sha256,size},recipe:{sha256,size}|null}. All selections and objects belong to this project. buildComposePages automatically splits the ordered entries into canonical forge-hosted-compose-page objects; upload these through the existing missing-object path before staging.
  • stage({projectId,operationId,kind,index,page}) accepts the next exact JSON page for kind:"inputs"|"dependencies", with a zero-based index. Each page contains schema:1, kind:"forge-hosted-compose-page", entries, and next pin or null. progress({projectId,operationId}) returns the retained staging state, terminal receipt, and server-pinned input once both manifests have been staged.
  • Upload the exact canonical input returned by progress, then call projectHostedComposeJobs:submit({projectId,operationId}). Retry the original operation and payload after unknown replies. Completed retries return the original Candidate rather than computing or publishing another one.
  • projectHostedCompose:candidate({projectId,candidateId}) reads the canonical Candidate under current source access. The Candidate pins its Intent, original main head/receipt, ordered input/dependency roots and algorithm plus runtime. Its result is {status:"clean",head} or {status:"conflict",conflicts:{sha256,size}}. composeConflictPageSchema describes the linked conflict pages. Exact side States remain available for resolution; no resolution or sync is performed here.

The trusted authenticated source-control ingress must also route describe to projectHostedSaveTransfers:describe, deriving projectId from its authenticated pinned dispatch. Its internal result is canonical JSON text; the HTTP response carries the decoded descriptor object. It returns only committed project object/recipe descriptors, rechecking current execution, fence, lease, epoch and contributor authority. The existing grant/commit transfer functions accept H08-owned compose jobs as well as saves; bytes continue to travel directly to/from object storage. A compose upload grant can return {stored:true} for an already committed logical object, including legacy or recipe storage. The fixed transport consumes and verifies its exact bytes without a redundant PUT/HEAD. Save-job grant replies retain their previous contract for already pinned worker images. Sync and compose fetch missing State parents as frontiers and batch descriptors and read grants for merge objects. Blob prefetch selects differing paths among the visited exact States; unchanged blobs remain unread. The native merge reducer retries after a fetched frontier instead of after each individual blob. Verified bytes stay on private job disk, source streams are consumed one at a time and generated uploads use 100-object/8-MiB windows (an oversized member runs alone). Only operation-local State/path metadata is retained; no Work collection is read. The small signed result schedules projectHostedComposeJobs:complete; no client needs to remain connected and no recurring idle worker is created. Only the small result manifest crosses the finalizer action. Rebuild and pin the fixed image with the compose reducer and descriptor transport before enabling this route. Ingress provisioning, remote deployment, resolution/sync, live check dispatch and landing remain separate work; these APIs alone do not enable a live end-to-end hosted loop.

Hosted check API

The check APIs operate on canonical hosted Candidates without a local owner. They accept/return canonical JSON text for versioned request/result contracts. The provider contracts have local fake coverage; these endpoints alone do not start live compute. Existing native check requests are unchanged.

  • projectHostedCheckDefinitions:configure({projectId,request}) takes an original operationId, authorityEpoch, expected digest (null to create), and change. For kind:"definition", provide checkId and command using the local check fields: name, executable, args, environmentLabel and optional environment-name, credential-name, artifact-path, static/resource and declared-input settings. For kind:"import", provide the existing check with its UUID, definition and timestamp. For kind:"runner", provide configuration with provider:"github-actions", repository:"owner/repo", installationId, runsOn, runtime, environmentFingerprint and a credential-use reference {secretId,version,operation} for an existing GitHub App installation token. runsOn is the exact GitHub-hosted or Blacksmith runner label. hostedActionsRuntime exports the fixed Actions harness runtime fingerprint. No credential values are accepted. Settings use existing project-owner authority. Each mutation retains its exact original receipt; replay cannot rewind a later setting.
  • projectHostedCheckDefinitions:current({projectId,checkId}) returns the selected check, runner configuration and configuration digest. list({projectId,cursor}) pages definitions. Current readers can inspect them; contributors can enqueue against the selected pins.
  • projectHostedChecks:enqueue({projectId,request}) takes operationId, authorityEpoch, candidateId, expectedHead, checkId, expectedDefinition, expectedConfiguration and expectedEnvironment. The Candidate must be clean, canonical and registered, and its exact State must match. Fresh requests require current definition/configuration/environment pins. The result retains a run UUID, stable dispatch key, frozen Candidate/definition/configuration and unknown initial cost. Original retries return that run after later source/configuration changes; they do not create another paid execution or switch its provider.
  • projectHostedCheckRead:status({projectId,runId}) reads one compact record with counts and exact pins, independently of shard/history size. list accepts a Candidate UUID and cursor. shards({projectId,runId,cursor}) pages current shard metadata in automatic 100-row/128-KiB transport windows. Continue continueCursor until isDone; these windows are not a total run/shard/output limit.
  • projectHostedChecks:cancel({projectId,request}) takes its own original operationId, authorityEpoch and runId. The requester or project owner can request cancellation. Live queued/checking/ready landing consumers preserve a shared check. Otherwise it becomes terminal cancelled before or after dispatch, refuses late evidence and requests provider cancellation. This local result does not assert remote compute has terminated.

The internal projectHostedCheckApi:control mutation takes project/run identity and a strict JSON command: claim, prepare, reserve, empty or observe. The adapter prepares and uploads a complete immutable plan/selection outside Convex, then supplies head, definition, runtime, environmentFingerprint, lockfile, selection/manifest {sha256,size} references and positive shardCount. The plan includes every selected job, including static checks. Indices cover [0,shardCount). Plan preparation checks committed object bindings and frozen runtime/source pins. The provider must verify the actual source/lockfile/selection bytes and execute that exact manifest; client claims cannot call this internal boundary.

dispatchHostedCheck runs a short controller tick through that mutation. A lease owner/token fences responses. Dispatch intent is durable before external I/O. Adapters must bind lookups to the complete original request and deduplicate submissions by dispatchKey, including lost responses. Unknown lookups stay unknown. One recovery requires two distinct fresh authoritative empty lookup receipts under the current lease and reuses the original execution key/plan. Eventually consistent absence is not authoritative. A rejected recovery retains unknown status, since the original submission could still be running. The controller does not choose a replacement provider or start an idle polling loop.

Trusted collection ingress calls only the internal projectHostedCheckApi:callback with exact callback JSON and its signature. The backend pins FORGE_HOSTED_CHECK_KEY_ID at enqueue and resolves FORGE_HOSTED_CHECK_KEY_<keyId> itself. Runner-machine runs verify with that machine's key, derived per project and machine from the deployment key and issued at registration; the deployment key stays server-side. Signing uses the forge-hosted-check-provider-v1 domain. Keep this signing authority in fixed collector/control code, isolated from project commands, source workers and account credentials; never pass a signing key in a dispatch payload or project environment. Provider integration owns ingress provisioning and pending-work wakes. Nothing here deploys or provisions those integrations.

hostedCheckCallbackSchema binds project/run/operation, epoch/fence, provider and execution, source/definition/configuration/environment, runtime, plan digest, lockfile and selection. kind:"shard" carries index, ordered attempt, provider execution, status/exit code and optional output reference. Running-to-terminal transitions retain the same shard execution; replacement attempts retain older callback receipts. kind:"complete" carries terminal/unknown status, exit code, optional output reference and unknown or receipt-backed cost. Overall success with missing, running or unsuccessful selected shards stays unknown. Late events cannot rewrite a terminal outcome, and even duplicates recheck current authority. No stdout or artifact byte field is accepted; R2 chunk/manifest transfer is H12.

H13/H14 can call requireHostedCheckEvidence inside their final transaction. It requires the exact passed run, complete successful shard counts and current definition/configuration/environment/epoch pins under current authority. Landing still checks its own policy and main head plus receipt. A check result does not move main or add a check requirement to person-selected acceptance.

For new runs pinned to R2 report storage, fixed runners negotiate check-report-detail in the existing control/claim and callback requests. The existing reply supplies a private, run/fence-bound immutable reportUpload target. Before completing, the runner uploads canonical report bytes and includes reportDigest with the original reports in its signed callback. A lost upload reply reconciles the same bytes; a different digest fails rather than replacing accepted evidence. Targets are transient and do not enter public run headers. The callback derives the bounded header and pointer without another RPC. Batched Actions results instead fold slots once in the existing collector action.

Hosted explicit sync and conflict resolution APIs

These APIs operate on hosted source records, without restoring a native owner. There is no automatic recurring sync or added UI in this source API layer. Every request has operationId, authorityEpoch, message, and one variant:

  • kind:"sync", laneId, exact expected Lane pins (head, version, sourceVersion, lifecycleVersion), and target: {kind:"main",head,receiptId} or {kind:"candidate",candidateId,head} for a clean immutable Candidate. Main's receipt distinguishes same-byte ABA moves.
  • kind:"resolution", candidateId, and exact conflicts:{sha256,size} from that conflict Candidate. This selects the original conflict, even after its input Lanes save again.
  • kind:"resolve", laneId, and exact expected pins for the saved resolution Lane. This completes its pending merge against the retained original inputs.

Call projectHostedSync:prepare with {projectId,request:JSON.stringify(request)}. projectHostedSync:progress takes {projectId,operationId} and returns the original input plan, staging state and optional terminal receipt. Commit the canonical plan bytes as the exact project object, then call projectHostedSyncJobs:submit with that identity. Source transfers and signed callbacks reuse the existing job-authorized descriptor/grant/commit seam. Rebuild and pin the fixed worker image with sync support before provisioning it; this code does not deploy or configure a provider. Server finalization is short and independent of a browser, coding host or native-owner process.

A completed terminal result contains status (up-to-date, merged, conflict or resolved), exact schema-2 lane selection, the original from Lane pins (or null), resolution provenance (or null), and original time/operation ID. Conflict returns a new resolution Lane; its original Lane stays unchanged. Its resolution retains candidateId (null for a direct sync conflict), exact conflicts, left, right, draftHead and status:"pending". Read/open that Lane with the existing Lane checkout API. Text uses the local native sync markers; binary and path conflicts retain the Lane side.

Save chosen resolution files through saveHostedLane or the existing paged save APIs, then drive resolve against that saved head. The worker verifies draft ancestry and the same unresolved-marker rule as local sync. Resolution can explicitly choose unchanged binary bytes or delete a conflicted path. Success retains the saved resolution head and original right input as parents and returns resolved; it never resolves against silently newer source. A pending resolution cannot be used as a completed compose input. Callers may drive this API phase within their existing save/resolve action; it requires no new person approval.

For the next composition, first compose only the resolved Lane with empty dependencies, producing a clean resolution Candidate. Prepend that Candidate to the original ordered dependencies, then retain the original ordered Lane inputs (including the suffix after the first conflict), using explicitly observed heads. Dependencies execute before Lane inputs, so this prefix also resolves conflicts that occurred during dependency composition. When there are no dependency-stage conflicts, selecting the resolved Lane first among the original inputs can avoid the intermediate Candidate. Later disjoint changes merge through ancestry; later overlap creates another explicit conflict. These are source API phases that callers drive, not extra person approvals. The Candidate and any required check/landing remain separate operations under their current contracts. H15 finish and H17 compensation can reuse these pinned phases; none of these receipts authorizes main movement or reuses a check on new bytes.

A same-Lane save while sync/resolve runs fails the final CAS with a retained WORK_STALE receipt; its newer source and the original attempt remain available. A fresh attempt uses a new operation UUID and explicit observations. Retry an unknown result with the original request, including all expected pins. Current access is checked even for completed retries, which return their original receipt without moving source or starting another job.

For optional local application of a clean sync/resolved result, call applyHostedSync(root,{operationId,url,status,from,lane},transport) using LaneTransport. from is {laneId,head,version,sourceVersion} from the result. This helper pins both the previous client marker and exact server selection. It preserves sparse scope, downloads only missing selected objects, and stages installation before checking local bytes and marker again. Local edits, deletions, link/mode changes and untracked contents are preserved on WORK_CONFLICT; a newer client baseline is WORK_STALE. The original server result remains successful when local install cannot proceed. Obstruction errors name the relative path and state that source already completed and only local apply is pending; replay the same original operation after resolving the obstruction. Completed apply retries check current access but do not overwrite later edits. There is no filesystem watcher, background pull or recurring timer.

Fast paths (fea47345 B; each falls back to the full path when it cannot prove its case):

  • Up to date in prepare. A main sync whose Lane base is exactly the target main (head and receipt), whose head is a registered State, and whose head provably contains that main through the parents the trusted worker recorded on object rows (at most 16 rows read) is settled by prepare itself with the same up-to-date terminal its job would write: no input upload, no source job, no Lane write. Stacks, restore, revert, resolution or an owner-provenance change always take the job.
  • No-op apply. When the checkout marker already holds the exact result selection and the checkout is at the target, applyHostedSync returns alreadyApplied:"target" with no call, download or tree walk.
  • One-trip apply. A merged or resolved sync's submit reply carries delta: the result State as changes from the Lane head the client holds (at most 32 KiB; reply only, never stored). The client rebuilds the State and uses it only if its digest is exactly the result head; it then skips the Lane access read and the State download. Anything else reads the State as before.
  • One tree walk. An in-place sync apply walks the checkout once (the publish-time walk under the checkout lock, which refuses metadata changes); the earlier pre-check walk is gone (2ccb2322 F6).
  • Server R2 writes. A 200 create-only PUT whose response echoes the exact signed x-amz-checksum-sha256 is verified by that echo; a 412 or a missing/different echo still does the HEAD check. This drops one R2 request per new object a source step writes.
  • Split save (fea47345 C). With contract feature save-settle-background, the agent save calls projectSourceRun:submit with settle:"background". One action commits the uploads and submits the save; that same transaction records the save's changed paths on the Lane's overlap row (also for a first save from the base), and the step is scheduled at once instead of running inline. The client keeps a background marker in the save's cache folder and returns settling. Every later agent command in that checkout names that save in its capability call (settling), and the reply carries the outcome (settledSave), so no call is added. Other callers read projectHostedSaves:progress once, and only while that marker exists, so idle costs nothing. A completed save advances the marker; any other outcome raises SAVE_SETTLE_FAILED once (recovery.failedSave) and the command does nothing. The same check runs where a later save, sync or preflight settles the earlier save. Saves that need their head (land, finish, lifecycle) keep the inline step. A terminal background failure independently appears in projectBoard:read as saveFailures and in the Lane head, detail and list as saveFailure. These views carry the operation and attempt IDs, failure code and timestamp. Capability discovery and checkout board or Lane reads that see their exact failure acknowledge it. Other fast reads keep their existing call paths. An exact retry clears its own notice, and projectHostedSaves:dismissFailure accepts the displayed identity from the project owner or the failing account with project write access. The web Lane review and Lanes list include that viewer's canDismiss capability in the existing failure reply. An explicit wait leaves the notice available for the next command. The retained save receipt still answers exact reads and retries. A newly committed save preparation clears the older notice and fences late failures in that Lane. Publication adds up to three metadata lookups and three writes only on a terminal background failure. The Lane-scoped board reuses its existing Lane lookup. Healthy saves make the same calls and document reads, with one additional index on the existing save row. The projection reads no source bytes and schedules no work.

Hosted check output API

The provider-neutral output contracts are in src/hosted-check-output.ts. collectHostedOutput redacts before the durable OutputSink.retain call; hostedOutputPublisher connects the sink to internal signed R2 transfer APIs. The adapter provides a durable redacted spool, credential/root redaction inputs and its fixed trusted transport. Project-code processes receive none of the collector key or upload-signing authority. No live provider ingress is enabled.

Internal projectHostedOutputApi functions take {projectId,message,signature}. message is canonical JSON with schema 1, run/operation IDs, epoch, fence, execution ID, source head, plan digest and a strict body:

  • kind:"chunk" carries {stream,sequence,offset,object:{sha256,size}}. The stream pins shard index, attempt, execution ID, kind and redacted display name. The collector also sets a stable opaque identity digest before name redaction, preserving separate artifacts when their redacted display names coincide. Use the returned descriptor when verifying or replaying chunks. prepare returns an exact signed R2 target; PUT the redacted bytes directly. A create-only 412 reconciles through commit, which checks HEAD and current run authority before appending metadata. Retry the same chunk after a lost ack.
  • kind:"seal" carries {stream,chunks,bytes,sha256} for the complete redacted stream, including an empty stdout/stderr/artifact. commit requires all chunk sequences and offsets. A missing chunk remains a recoverable gap.
  • kind:"final" carries root from the current manifest response. After the check has a terminal result and every declared stream is sealed, upload the canonical root JSON using prepare, then commit. The root binds run/execution, revision, index hash-chain and stream/chunk/byte totals. It is immutable; original retries succeed without replacing later work. Final collection must declare every output stream, including prior attempts. No verdict implies that an incomplete collector has retained the entire log.

projectHostedOutputBatch:{prepare,commit} takes {projectId,entries:[{message,signature}]} with up to 100 signed records and returns ordered target/receipt arrays. Fixed collectors use workerPrepare/workerCommit with the same signatures. Commit does one authorize mutation, external HEADs, then one atomic apply mutation that rechecks current authority and every signature/pin. Each original chunk keeps its revision and duplicate receipt. Batch replay replies also include the current aggregate root for duplicate chunks/seals, so a lost seal acknowledgement can still complete final collection. Retry the exact retained window after unknown acknowledgements. The collector buffers up to 32 chunks/2 MiB, retaining each before publication; seals may share that window. Live input flushes still publish available redacted output without a timer.

Public metadata APIs use current project reader authority, including anonymous public reads. They return canonical JSON text:

  • projectHostedOutputRead:manifest({projectId,runId}) returns check status, execution ID, complete, sealed-stream count and the current root. It reads constant-size records, without scanning chunks or signing URLs.
  • streams({projectId,runId,cursor}) pages retained stream metadata/seals. Continue continueCursor until isDone.
  • chunks({projectId,runId,after}) starts at after:0 and returns a page plus the next after revision and more. Resume this revision when a status subscription observes new chunks. The cursor orders commits; each chunk retains its own stream sequence and offset. Transport pages use 50 rows/128 KiB with continuation, without a total log/stream/history ceiling.
  • downloads({projectId,runId,entries:[{streamId,sequence}]}) signs up to 100 requested committed chunk/root objects after one fresh access check. It returns targets in request order. The Check panel uses one window per stream page.
  • download({projectId,runId,streamId,sequence}) signs one exact committed chunk after a fresh access check. A null streamId selects the completed root object. Missing sequences return NOT_FOUND for recovery from the original collector. Signed URLs use the existing five-minute expiry. Revocation prevents new URLs; already issued capabilities remain usable until expiry. Verify direct bytes with HostedOutputReader, which also checks the final sealed-stream digest.

completeOutputManifest is an internal transaction helper for consumers such as landing; it reports complete retention separately from exact passing-run evidence and grants no acceptance authority. It adds no new acceptance requirement. Readers and collectors do not poll or schedule timers. The UI must gate metadata subscriptions and automatic byte downloads through its existing idle gate. The legacy retained-log API remains available for historical native runs.

Hosted Actions export and dispatch

HostedActionsProvider implements the H10 provider contract over projectHostedActions:control. Supply a run-bound store, hostedActionsRemote and an exporter calling exportHostedActions on the fixed source worker. The exporter receives the current mapping/lease as its third argument. It reads project objects through sourceWorkerHttp with input {kind:"forge-hosted-actions",runId,dispatchKey,owner,token} and executionId:owner. The trusted ingress derives project/lease identity from its authenticated worker request and routes describe/grant/commit to the internal projectHostedActionsTransfers functions. Actions exports additionally route describe-and-grant to projectHostedActionsReadBatch:describeAndGrant with {projectId,input,executionId,sha256s}. At most 100 unique digests select ordered {descriptor,target} entries; recipe descriptors have a null target and their leaves retain exact grants. Export deduplicates paths by content before requesting windows, consumes grants immediately and streams hash-verified bytes to disk/Git. No grant or cached file authorizes a later window. They recheck current project/actor, epoch, dispatch key and live lease on every descriptor/grant and post-HEAD commit. Repository and bundle bytes transfer directly to object storage; Convex sees only exact {sha256,size} pins. Worker heartbeats renew the lease during export.

The immutable plan manifest is a hostedActionsRecipeSchema JSON object: {pin,head,definition,selection,groups,standard,interaction,command}. pin is checkPin of those fields excluding pin. Its selection must match the separately committed selection object; command, lockfile, runtime, shard membership and State are verified by the worker. shardCount is groups.length + 1, including static. The worker reuses the existing workflow generator and runner script. Generated workflow/recipe bytes belong only to the harness commit, not the Candidate State.

Each invocation performs one export, one ref publication, or a bounded lookup/dispatch step and returns pending without waiting for a runner. The mapping's nextAt carries lookup/rejection backoff. Adopting a run arms an indexed, generation-fenced projectHostedActionsWake fallback for that run, due in five minutes. Existing signed exact provider callbacks update check progress and postpone fallback reconciliation; terminal callbacks and authorized cancellation wake the controller immediately. One bounded controller tick retains its next fallback before HTTP to survive lost replies. Terminal branch cleanup stops the wakes. Active runs do not poll every 10–60 seconds; no idle project scan runs. Provider terminal-job settling keeps its existing bounded recovery rule. The adapter reports eventually consistent absence as unknown to H10, so H10 cannot add another recovery. Its own twelve lookups plus a fresh empty branch lookup permit the local path's one recovery after an ambiguous response, including HTTP 400. Accepted acknowledgements never permit redelivery. GitHub does not provide atomic dispatch deduplication against arbitrarily late run visibility; duplicate exact matches remain explicit evidence errors.

ActionsCredentialUse privately resolves the pinned credential reference for the selected installation/repository. Missing registration or repository permissions produce GITHUB_APP_UNAVAILABLE / GITHUB_APP_ACCESS with actionable messages; no App registration, personal token, gh or local checkout fallback occurs. Current authorized readers can call projectHostedActions:status for the retained mapping and structured setup error. A definitive rejection before any Actions dispatch becomes H10 runner-unavailable; an earlier ambiguous dispatch stays unknown even if later credential/access checks fail. cleanupHostedActions first checks a committed terminal H10 result and exact execution mapping, then deletes only the unchanged run-owned branch. Lost delete replies are safe to reconcile; the State/export/run mapping stays retained. reconcileHostedActions reads the exact retained recipe bytes, observes the mapped run and pages its latest jobs on the fixed worker. Run ID, run-owned title, export commit, original attempt and selected shard membership must match. Its stable signed H10 callback identities reconcile lost shard/terminal replies. projectHostedActionsReconcile:evidence checks current actor/epoch, worker lease, State, export commit and run mapping before invoking the existing H10 callback reducer. A native State is never replaced by the generated harness commit. Finished/undispatched checks make no provider calls. Incomplete job lists settle through bounded backoff observations; after the local controller's thirty observations, stuck status can pass only with complete actionsJobLogEvidence and a successful run with no contradictory job conclusion. Missing or failed logs cannot pass. Installation credentials are never forwarded to a signed log storage redirect. Export/dispatch success alone supplies no passing evidence.

An unneeded H10 check becomes locally cancelled immediately; the legacy adapter retains its provider-stop request until the mapped run settles. A successful cancel POST records acknowledgement; a lost reply can retry that idempotent provider cancellation for the same run. It never starts another execution or claims compute stopped. Transient observation failures retain the original run and backoff. The durable wake re-arms before calling the fixed worker, respects its lease/nextAt, ignores duplicate generations, and stops after terminal provider evidence. A locally cancelled run can still need this existing provider cleanup. There is no project sweep or recurring finished-job observation. The fixed controller ingress is provisioned through FORGE_HOSTED_ACTIONS_CONTROLLER_URL and its backend-only FORGE_HOSTED_ACTIONS_CONTROLLER_KEY; it receives only project/run/dispatch identity and must use the existing installation credential-use resolver.

runHostedActionsJob is the fixed runner supervisor integration, outside exported project code. Trusted runner bootstrap supplies the original run/mapping and provider-attested job/commit/State/shard pins, an explicit command environment, and H12 hostedOutputPublisher sinks. No output signing or installation key is passed to the project command. Stdout and stderr stream through the H12 redactor and collector, flushing available bytes while the command is alive. The private HostedActionsOutputSpool atomically fsyncs redacted immutable chunk/seal records before direct R2 publication. Storage failure leaves pending output on disk; a replacement collector replays those exact records without executing the command again. Interrupted collection without seals stays incomplete. Trusted bootstrap must preserve spool storage and supply redaction settings; the module is not a sandbox against arbitrary code under the same OS account.

Completion-only provider logs never enter that live-output path. The existing H12 Check panel reads the same paged chunk protocol; no new screen or viewer poller is added. After all runner streams are sealed and the H10 result is terminal, trusted final collection publishes the existing H12 root, separately from check evidence. These modules do not deploy the controller ingress, install the runner supervisor on a live runner, or provision its authenticated H12 transport. The lead must wire those fixed services to the generated workflow's check command and perform a real owner-runner smoke after landing/deployment.

Hosted landing queue API

Browser acceptance can set finish.reviewedSource instead of finish.composeOperationId. This person selection pins the canonical Candidate's Intent, main receipt and immutable input/dependency roots; it cannot select another actor's mutable composition or follow later Lane saves. Agents retain the original composition requirement. Final acceptance uses the same authority, policy, check evidence and Channel CAS. projectHostedLanding:candidate is an indexed, read-only subscription over the selected Candidate, its current attempt, check, receipt and any compensating submission. New queue rows carry optional Candidate and revert-receipt keys; older rows remain valid without a backfill. A revertOf link is validated against the canonical reverse Lane's receipt provenance and its completed composition. It is not acceptance authority.

projectHostedLanding:enqueue({projectId, request}) accepts JSON metadata:

{
  "operationId": "<original UUID>",
  "authorityEpoch": 1,
  "channel": "main",
  "expectedMain": { "head": "<State SHA-256>", "receiptId": "<main receipt>" },
  "candidateId": "<canonical Candidate UUID>",
  "expectedHead": "<clean State SHA-256, or null for a conflict Candidate>",
  "agent": true,
  "check": { "kind": "run", "runId": "<exact H10 run UUID>" }
}

check may instead be null, or {kind:"request", checkId, expectedDefinition, expectedConfiguration, expectedEnvironment} using the current H10 pins. The latter atomically enqueues one H10 check under a retained child operation. It does not run project code inside Convex or replace the H11 provider adapter. Account/device identity determines actor kind; agent:true explicitly downscopes an account. Person-selected clean unchecked Candidates remain representable. Existing agent check/policy requirements still belong to final acceptance, not queue admission.

A fresh request selects the current hosted main head and receipt and the Candidate's exact base. Reusing an operation with different pins returns WORK_OPERATION_CHANGED. Authorized original retries return the retained submission/current progress after later main, definition or epoch changes, without replacing source/check pins. Current project write authority precedes replay; current read authority precedes status, list and attempts. Stale/foreign Candidate/run selections fail explicitly. Source/file/log bytes are not accepted by this API.

status({projectId, submissionId}) returns the current request and exact attempt. list({projectId,channel:"main",phase?,cursor}) and attempts({projectId,submissionId,cursor}) return complete continuation contracts in 100-row/128-KiB transport pages. Keep following continueCursor until isDone; partial pages do not establish absence. Immutable attempt IDs, Candidate roots, main receipts, policy context and run pins remain available for later review.

projectHostedLanding:cancel({projectId,request}) takes JSON {operationId,authorityEpoch,submissionId}. Current contributor/owner authority is checked before new cancellation or receipt replay. The operation retains its original outcome: a pending request becomes terminal-failed with LANDING_CANCELLED and the shared rejected cause. Its original request, attempts and source pins remain readable. An already terminal failure stays unchanged. Cancellation releases only this request's queue claim and fences its pending finish metadata IO. It leaves Lane lifecycle and source execution alone; a shared check stays live while any queued/checking/ready submission needs it. Once the last consumer leaves, the check becomes cancelled and its provider stop is requested. Late callbacks cannot revive the request. Final acceptance and cancellation race transactionally: acceptance first returns the actual landed receipt; cancellation first prevents publication. Accepted source is never undone. Retry the same operation and parameters after an unknown reply to get its retained result, including after later main or authority changes.

The scheduled driver returns after metadata preparation, with phase checking, ready or terminal-failed; queued/checking/ready observations remain pending. A fake-provider test seam exercises H10 completion and lease recovery. ready is not acceptance evidence and is not a claim that current policy permits publication. No hosted Channel is moved by H13. H14 supplies final CAS/receipt/lifecycle handling; H11 supplies actual check dispatch. Nothing here enables a native-owner cutover, UI, deployment or real provider configuration.

For integration, claimReadyLanding/requireLandingLease fence H14's final transaction. pinLandingAttempt, insertLandingAttempt and writeLanding support named agent child attempts under that fence, preserving the original request and check identities. Final settlement must accompany H14's actual canonical receipt. releaseLandingQueue wakes later runnable work in the same transaction. A named internal projectHostedLandingDriver:recover repairs pending/leased queue work; it is an event/startup hook, never a scheduled scan of idle projects. Failed wake receipts also reconcile on original enqueue replay. Check waiters wake from H10 result events in bounded byte-aware windows; they do not poll provider status.

Hosted final acceptance API

H14's projectHostedAcceptance:prepare({projectId,submissionId,attemptId}) retains a plan under the attempt's original accept UUID. stage adds {kind:"inputs" | "dependencies",index,page} where page is the JSON H08 compose metadata page. Stage inputs first, then dependencies, following each committed hash/size/next pin until null. Pages automatically split under H08's 100-entry/128-KiB transport window; there is no total Lane/history ceiling. Replays require the exact original page. Staging reads immutable included Lane versions, so later saves remain possible.

accept takes the same selection and uses the shared Channel fence/final CAS. publish is its internal fenced primitive for H15, taking the retained claim {projectId,channel:"main",owner,token,submissionId,attemptId}. These return {status:"landed",receipt} only after actual atomic publication, or pending queue/ review observations. Stale main head/receipt, epoch, policy and exact-run evidence return structured errors without consuming the request or replacing its source. An agent request needs current exact-run evidence; an account can submit an exact person request without a check. Devices always retain agent authority.

receipt({projectId,receiptId}) returns immutable evidence and completion progress under current project read access. The acceptance ID also selects its source-snapshot delta and staged input ledger. Original retries authorize current access first and return the original receipt, without moving later main or repeating effects. Run references use H10 IDs; no dependency on H12 output-manifest internals is introduced.

When the existing lifecycle policy enables completion, publication activates the staged exact-head ledger and schedules finite complete({projectId,receiptId}) materialization. It writes at most twenty Lane status versions per invocation and resumes its retained page/entry cursor after a lost reply or stopped task. A named internal call can repair a failed task; there is no idle scan. Completion never closes a newer saved/reopened version or an entire Intent. Accepted-source receipt and completion-ledger visibility do not wait for these canonical status projections.

Hosted saved-work lifecycle API

projectHostedLifecycle:transition({projectId,request}) accepts JSON validated by hostedLifecycleRequestSchema: original operationId, authorityEpoch, action: abandon | reopen, and a target. Abandon requires a retained reason; reopen's reason is optional.

  • Lane: {kind: lane, laneId, expected: {head,version,sourceVersion,lifecycleVersion}, dirty?, saveOperationId?}. A known dirty client uses an explicit save-first child. saveOperationId pins H07's original save on the same actor, project, Lane, epoch and original baseline. The parent can return pending while that save runs. Its terminal callback wakes the retained parent without a client; successful publication compares the child's exact resulting pins before abandonment. A failed child is retained as a failed parent with no lifecycle write. A later save/reopen makes the original parent stale.
  • Intent: {kind: intent, intentId, version, cascade?}. Abandon with cascade stages every active child in twenty-row/128-KiB transaction windows. Source saves, starts, completion and lifecycle changes invalidate its Intent revision. One final marker activates the complete staged selection, with no all-child final read. Reopen changes only the Intent. Completed/abandoned siblings stay as they were; no source or history is deleted.

Results use hostedLifecycleResultSchema: original receipt/time, pending/applied/ stale/failed status, selected target, child count, optional exact applied Lane pins, retained save child and cancellation: not-requested. Current write access is checked even on replay; successful replay returns its original receipt without rewinding newer source or reapplying lifecycle. Pending work also checks the current authority epoch at each step. Ordinary source saves remain available on retained work; no new lifecycle access policy is added.

progress({projectId,operationId}) is a finite status read with projection progress. advance explicitly resumes the same operation after a stopped scheduler. Normal cascade work runs in bounded internal ticks and stops at terminal/projection completion. history({projectId,kind,key,cursor}) pages retained applied events under current reader access. Staged/stale events are not exposed as applied; continue opaque cursors even for an empty filtered page. Canonical Lane reads and parent pages resolve all applied children before background head-index promotion finishes. Status-filtered internal Lane pages evaluate effective state over bounded indexed pages; an empty page is not end of history.

transitionHostedLane(root,{operationId,action,reason?,saveFirst?,keepPatch?},exchange) is an API helper for an ordinary H04 checkout, with no native owner/listener. It refuses known dirty abandonment with LANE_DIRTY unless saveFirst:true or keepPatch:true. keepPatch writes the unsaved edits to ROOT.kept-OP.patch next to the checkout (whole-file hunks for patch -p1/git apply; binary files, links and submodule pointers are copied to ROOT.kept-OP-files/), then abandons against the server's current Lane, so a stale checkout cannot block it. It retains the original command and child capture/UUID, drives H07 once, then submits the compound parent. Pending returns preserve both identities. Lost uploads/replies, failed saves, stale pins and disconnects retain local files and captured bytes. Reconciliation advances only matching checkout metadata, never working bytes; reopen retains newer drafts. Intent cascade closes saved server work and cannot claim to save a disconnected client's unknown edits.

Abandoning a Lane also cancels its queued/checking/ready landing submissions through projectHostedLanding:cancel's transaction helper, including the last-consumer provider stop. Existing canonical compose selections provide an indexed reverse Lane lookup, so older submissions need no backfill. Bounded continuations retain stable child operation IDs, recheck authority and skip submissions beyond the queue sequence pinned when abandonment applies. Requests queued during a pending save or cascade are included. Intent cascades reuse their materialization pages. Standalone checks can still be cancelled with projectHostedChecks:cancel; the legacy lifecycle cancellation: not-requested field refers to that separate action. An abandon receipt never claims that a provider or arbitrary process has already stopped. Main, acceptance receipts, source objects and saves are untouched by lifecycle changes. The hosted agent CLI and MCP use these same primitives. Site controls remain separate work.

Hosted finish API

Add finish:{composeOperationId,after:null} to the ordinary hosted landing request to drive its exact selected composition through check and acceptance. The compose operation must be the caller's original completed H08 operation for that Candidate; its ordered manifests, versions and settings remain pinned. after may name an existing parent submission in the same project. Its receipt resumes the dependent; its failure remains an explicit dependent failure. No recurring observer is needed. Omit finish to retain the existing prepare-only landing behavior.

Explicit projectHostedFinish:resume rechecks current project/contributor write authority and the pending request's original source-authority epoch before scheduling. A revoked contributor, removed project or stale pending epoch is refused without scheduling. Completed requests still require current project write access but can reconcile their historical epoch without new work.

Original-operation replay returns the same submission and repairs outstanding scheduler receipts. A changed payload under that operation ID is rejected. A main head or receipt race creates an explicitly named child attempt, yields with backoff, then recomposes and rechecks the original selection. Check evidence is never reused for a different Candidate. Later Lane saves remain open and outside the selection. Conflicted child Candidates retain their original conflict object for the existing resolution Lane API.

projectHostedFinish:status {projectId,submissionId,version?} returns the submission, version cursor, exact selection roots and named pending source attempt. It is a reactive metadata read; it does not schedule work. projectHostedFinish:inputs {projectId,submissionId,attemptId,index} reads one staged immutable input page and compares each selected head with its current Lane. superseded retains the actual outcome, as in the native submission contract. staged:false means that page has not been prepared yet; continue after progress rather than treating it as empty selection. Historical attempts remain available through the landing attempts API.

projectHostedFinish:resume {projectId,submissionId} repairs only the original actor's named pending request on reconnect/startup. It creates no replacement attempt or check. Source/check callbacks and parent terminal events normally wake progress. The finite driver downloads one bounded metadata page or stores one small hash-verified compose plan per action, then yields. Source computation and check dispatch remain the existing H08/H10 jobs and configured provider routes. Only H14's current-authority/exact-run/main CAS and real receipt report landing.

Hosted compensating revert API

Revert uses the existing durable sync phases and the ordinary compose/finish APIs:

  1. Call projectHostedSync:prepare {projectId,request} with serialized revertRequestSchema from src/hosted-sync.ts: {kind:"revert",operationId,authorityEpoch,target,message}. target is either {kind:"receipt",receiptId} or {kind:"submission",submissionId}. Submission addressing resolves the immutable accepted receipt after an unknown final reply; NOT_FOUND means no retained acceptance was found, never permission to guess a head or use the requested Lane's changes. Preparation creates a dedicated Intent and pins the two actual receipt heads, without changing main.
  2. projectHostedSync:progress {projectId,operationId} exposes the exact worker input. Upload those canonical metadata bytes through the existing missing-only object path and call projectHostedSyncJobs:submit. Retry using the same UUID and request. Existing source-job recovery/callback publication applies; no new job kind, provider or periodic observer is needed.
  3. The terminal sync result contains the compensating saved Lane selection. Its status:"merged" describes the produced source, not acceptance. The canonical Lane's revert provenance retains receiptId, previous and accepted heads. Compose that Lane through H08 against observed main, under its returned Intent, and enqueue the ordinary H15 landing request with finish:{composeOperationId,after:null}. Retain the compose/landing UUIDs before their first calls. H15 owns checking, recomposition on races and acceptance.

An overlap produces the usual conflicted Candidate; use the explicit H09 resolution Lane API and compose/finish its resolved selection. The original compensating Lane and receipt remain retained. Later disjoint source survives. A batch acceptance is reversed as its complete actual main transition, and a revert-of-revert uses the same receipt selection. Preparing or replaying checks current contributor access; source dispatch/publication checks the pinned epoch. Final acceptance retains all ordinary actor/policy/check rules, without adding an owner-only revert rule. Receipt lookup and source publication are constant-size metadata transactions; source diff/merge stays on the worker. These API-only phases do not create a local native owner, transport command or site control.

Hosted agent CLI and MCP

nforge agent ROOT ACTION JSON uses the hosted transport when JSON includes url and projectId, when ROOT is a hosted Lane checkout, or when a previous successful hosted command retained that address in ROOT's client cache. An incomplete explicit address fails before constructing a native owner. Existing native project commands retain their native workflow.

nforge agent ./edit start '{"url":"https://deployment.convex.cloud","projectId":"PROJECT_ID","outcome":"Add search"}'
nforge agent ./edit open '{"laneId":"LANE_UUID"}'
nforge agent ./edit save '{"message":"Search implementation"}'
nforge agent ./edit compose '{"laneId":"LANE_UUID"}'
nforge agent ./edit sync '{"laneId":"LANE_UUID"}'
# If conflict files were returned, edit them in the returned root, then:
nforge agent ./resolution resolve '{"laneId":"RESOLUTION_LANE_UUID"}'
nforge agent ./edit check '{"candidateId":"CANDIDATE_UUID","checkId":"CHECK_UUID"}'
nforge agent ./edit finish '{"laneId":"LANE_UUID","message":"Add search"}'
nforge agent ./edit cancel '{"submissionId":"SUBMISSION_UUID"}'
nforge agent ./edit revert '{"target":{"kind":"receipt","receiptId":"RECEIPT_UUID"},"message":"Reverse actual acceptance"}'
nforge agent ./edit abandon '{"laneId":"LANE_UUID","reason":"Superseded","saveFirst":true}'
nforge agent ./edit capabilities '{}'
nforge agent ./edit status '{"laneId":"LANE_UUID"}'

Start returns authoritative Lane pins; open materializes a verified full or sparse checkout (paths selects relative files/directories). Save uses the existing retained delta capture and missing-only upload path; checkpoint is its alias. Compose accepts inputs:[{laneId,expected?}], an optional intentId, and ordered dependencies:[{candidateId,head?}]. Expected Lane pins include head, record, source and lifecycle versions. Sync selects observed main by default, or an exact target:{kind:"main",head,receiptId} / {kind:"candidate",candidateId,head}. Its successful source receipt applies through the guarded checkout installer; apply:false submits source work without installing it. Dirty or newer local files remain preserved. Revert returns an isolated compensating Lane for ordinary composition/finish; targets can also be {kind:"submission",submissionId}.

Hosted cancel {submissionId} cancels a landing request through the separate landing API above. Its optional operationId identifies the cancellation, not the original finish/check. Accepted requests return their landed receipt; Lane lifecycle and check execution remain independent.

Check (run alias) pins a clean Candidate, definition, runner configuration and environment before enqueue. Finish saves the opened Lane when applicable, composes saved inputs, and submits the original composition to the durable finish driver. Explicit inputs selects saved heads and leaves local drafts unsaved and untouched. Its optional check:{checkId,expectedDefinition?,expectedConfiguration?, expectedEnvironment?} selects a check; otherwise it selects verify, or the sole configured check. An existing candidateId requires its composeOperationId. after selects an exact parent submission. This transport always requests agent acceptance, including with an account credential; current backend policy and exact check evidence decide acceptance. A submitted/queued phase is not a landed receipt. Worker/provider configuration remains deployment work; this CLI never falls back to a local owner or runner.

Abandon/reopen use the canonical lifecycle API. An opened Lane uses the existing dirty-draft guard and optional save-first compound request. A saved remote Lane can be selected by laneId without a checkout; this makes no claim about drafts on other clients. Intent targets are {kind:"intent",intentId,version,cascade?}; reopen preserves each child's independent lifecycle.

Each mutation returns its operation UUID and resolved.operationId. The private ROOT.forge-client/agent journal retains normalized original parameters, actor, source/check/main pins and compound child UUIDs before mutation IO. Authentication material is never written there. Identical parameters with an omitted UUID reuse the journaled operation, including after losing stdout; a new explicit operationId identifies a new request, even with identical text. Retry the same request after an unknown response. Current access is rechecked on each dispatch; changing a retained request or actor fails explicitly. Keep the client cache to reconcile unknown operations across process restarts.

Queue-ahead observations retain verified objects and advisory verdicts only in ROOT.forge-client/queue-ahead-objects and ROOT.forge-client/queue-ahead-verdicts. Native queue observations use the owner's .forge metadata. Save and capture exclude Forge metadata and the legacy root queue-ahead-objects directory even when tracked paths or ignore negations would otherwise include them. Existing stray files can remain in place: they are not captured. If an older saved baseline already contains these paths, captures preserve those original pins without reading local cache edits or recording removals as source deletions. Historical States and accepted main are unchanged by this migration.

capabilities is a current authorized protocol/authority/configuration read; configuration flags report presence, not live provider health. status and observe are finite reads: select one laneId, runId, submissionId (optional version), or {kind,operationId} where kind is save, compose, sync, revert or lifecycle. They do not start compute or install an idle observer. Source/check submission returns promptly; replay the original action to advance its retained client phases and explicitly read status for progress.

nforge mcp ROOT --agent uses this same hosted address detection and existing agent workflow registration. For a new client directory, select an explicit address:

nforge mcp ./edit --agent --url https://deployment.convex.cloud --project-id PROJECT_ID

The existing server registers forge_task for start/open/save/checkpoint/compose/ sync/finish/cancel/revert/abandon/reopen, forge_check for check/run/observe, and forge_work_overview for status/capabilities. Actions use the CLI's exact portable schemas inside {command:{action,...}}, the same response envelope and the same ROOT.forge-client/agent journal and successful-address retention. Retrying through either interface preserves original UUIDs, actor and source/check pins. Unsupported hosted actions do not route to native tools. No person-acceptance input is exposed; account credentials still submit agent:true through the existing finish transport.

forge_current {laneId} returns one saved Lane's source context. forge_source {laneId,file,start?,end?,expected?} reads up to 200 lines. forge_review {command:{action:"show",laneId,path,expected?,force?}} returns exact retained bytes with utf8/base64 encoding and the same force behavior as native show. laneId may be omitted in an opened Lane. Optional expected:{head,version,sourceVersion} fails explicitly on movement. Results retain complete Lane source context plus State/blob/mode pins. Reads use H04's verified object cache, select only the State and requested file, and recheck current authorization and the original pins before returning bytes. Sparse omissions stay readable without materializing them; unsaved local edits never replace saved source. These tools hydrate no Work/history/graph. Native graph tools remain registered for native source; no hosted graph is inferred.

forge_check {command:{action:"observe",runId}} remains a finite read. An explicit forge_wait {runId,timeoutSeconds?} observes that run live until terminal, timeout (default 600 seconds), request cancellation or disconnect. It returns the observed run with status:"terminal"|"timeout"|"cancelled"; a terminal failed run remains failed. MCP progress notifications carry observations when requested with a progress token. Only a nonterminal active wait creates a subscription, and every exit unsubscribes and closes its client. Terminal and zero-duration reads allocate no live client. There is no idle polling, URL refresh, heartbeat, metadata hydration or compute wake. Observation neither cancels a run nor grants acceptance evidence. Hosted landing waits use forge_wait {operationIds:[FINISH_OPERATION_ID,...], cursor?,until?,timeoutSeconds?} or nforge agent ROOT wait with the same selection. One call follows all selected submissions, including named pending recomposes, until all are terminal; until:"any-change" returns after the first change beyond the initial snapshot. Each progress event and result carries a reconnect cursor. Keep the cursor with the same deployment, project, actor and operation selection; reconnecting rechecks current access and replays committed submission versions without repeating delivered versions. Each server page reads at most twenty version rows by exact indexes, independent of project/history size. A deployment with older, unjournaled state explicitly resnapshots the current record; missing historical evidence is not invented. Authority changes trigger a fresh authorized snapshot while retaining immutable version identities for deduplication.

After submission, a failed observation is not a failed landing. Transient HTTP 5xx, network and timeout errors keep the active wait alive, with progress events and backoff of 2, 4, 8, 16 and then 30 seconds. Reconnection uses the same selection and cursor; successful waits add no calls and idle clients do no work. The wait deadline includes its first read and every retry. At the deadline the result has status:"timeout", inProgress:true; hosted CLI land --save and wait exit 3, print IN PROGRESS and the exact nforge agent ROOT wait command. Stopping a wait does not cancel the server operation. land --save returns the observed terminal receipt without replaying finish. Explicit access and protocol errors remain errors. If the first read never succeeds, the result has no observations and a null cursor; resume with the original operation selection.

Unexpected errors inside projectHostedFinishObserve:page log one bounded FORGE_FINISH_OBSERVE_FAILED context with project/operation, requested/current version, query stage, phase and event count. This performs no extra DB reads or writes and logs no row values or exception payloads. A platform 502 before query execution still needs the platform request trace.

Only the active call subscribes. Registration is followed by an authoritative reread to close missed wakeups; timeout, cancellation, errors and disconnect close every subscription without waking or cancelling landing work. Staged input pages also observe later saved Lane heads using the shared source-relative submission projection. Unstaged input pages remain explicitly unstaged. A pending child recompose never settles from its predecessor's stale input result.

Attempt history returns each attempt's own observation and progress (phase, error, acceptance and settlement), separately from its superseded attempt flag. A newer child or accepted submission never rewrites its predecessor's outcome. Input pages use the selected attempt's retained evidence before projecting later Lane saves as superseded. Old attempts predating retained progress return null historical evidence rather than borrowing the current attempt's result.

These paths are qualified with local fakes, not live accounts or providers.

Source authority transition and writer fencing

projectSourceAuthority:transition is an explicit owner mutation with {projectId, operationId, expected: {mode, epoch}, mode}. It compares both expected fields and commits {mode, epoch: epoch + 1} with an indexed operation receipt in one transaction. Replaying the original UUID and inputs returns the original result even after later transitions. Rollback is another transition to native-owner at a higher epoch; it never resets the epoch.

On the bound native owner, run:

nforge host ROOT --source-authority '{"operationId":"UUID","expected":{"mode":"native-owner","epoch":0},"mode":"server"}'

The command records its exact request before network IO. The hosted transaction advances the project epoch and its selected main together, preserving the head and receipt. Only a successful hosted CAS installs its result in the local binding. If the process stops between the hosted commit and the local pin update, repeat the same command; its receipt finishes the local update without another transition. A known stale CAS updates the observed pin and releases the pending command; an unknown outcome retains it. Coordinate this command with the cutover's seeded source/Work pins and queue drain. A switch to server before hosted main is seeded returns SOURCE_UNAVAILABLE. Complete the original seed and drain the owner before switching. If an earlier legacy transition left the project and main epochs out of sync, the owner can run a new transition with a new operation ID, the project's current authority as expected, and its current mode as mode.

requireSourceAuthority(project, expected?) in src/hosted-source-authority.ts is the shared writer guard. project needs only an optional sourceAuthority; expected is {mode, epoch}, defaulting to native-owner epoch 0. The helper returns the matching authority or throws SOURCE_AUTHORITY_STALE with authority: {mode, epoch}. Hosted errors retain that object in their structured data. Existing epoch-zero callers need no new argument. Publication and legacy acceptance calls can supply authorityEpoch after rollback; owner requests retain the epoch at creation so an old completion cannot cross a rollback.

The existing hosted main seed, owner completion and legacy acceptance commit check their authority in their write transaction. Their guards reuse project rows already read for authorization. Native accept-channel checks the binding pin under the owner lock, including before replay. It adds no hosted read and remains usable offline before a switch. Hosted transactions are the real fence; the local pin provides fast refusal. Stale-authority feedback received by the owner transition, bound exchange, owner request consumer and hosted transports advances the matching binding pin; delayed errors cannot rewind a newer epoch. There is no polling or scheduled authority job.

Check-log closure

Portable closure retains source, results, bounded failure summaries, compact test reports and provider execution links. Full CI-provider logs are provider-held. Local stdout/stderr are included only with explicit project opt-in and finite retention; see check logs. Native archive conversion preserves original manifest and Work hashes while omitting provider-held or expired log payloads. Current readers accept those optional old log pins without treating source/results as missing. The retired compressed container is not a retained log copy. Historical native log reads return a provider link or a retained summary after expiry. Streamed output follows the same policy: fixed provider collectors retain compact reports/excerpts; Mac raw upload carries the explicit project setting and a finite expiry. Lifecycle events wake already-due expiries and schedule no idle expiry timer.

Hosted conflict recovery

Hosted finish prepares a sibling resolution Lane when its composition conflicts. Its recovery.conflict response names the editing root, the conflicting paths, conflict-marker file contents and the exact next resolve command. A pending source job remains durable; replay the original finish parameters/operation ID when it has not completed. Recovery subscribes only while the active call waits for its exact source job, then closes; it never polls.

For an existing rejected submission (including a batch member), status or observe returns capped conflict paths and an exact sync command selecting that attempt's conflicted Candidate. sync {"candidateId":"CANDIDATE_UUID"} opens that immutable conflict draft. Ordinary Lane sync conflicts return the same guided response. The original Lane and accepted main remain unchanged.

Edit the files in the returned root and run resolve there. It saves those bytes, checks the original conflict files for remaining markers, refuses a file placed without markers that still holds one side unchanged (CONFLICT_SIDE_REQUIRED; edit it, or pass keep:["PATH"] to keep that side explicitly), and completes the server's resolution operation. Its response gives a fresh finish command. No extra edit or separate checkpoint is needed, including when the resolution was already saved. Unknown replies reuse the original operation ID; changed edits after a terminal failure need a new operation ID.

Path summaries show at most 100 paths and inline text at most 128 KiB. All conflicting paths remain editable in the sparse resolution checkout; omitted, binary, deleted or large contents are read from that root. These response bounds do not limit resolution. Current access is checked before returning cached source. The resolve action is advertised only when capability discovery requests resolveVersion:1, so released clients with strict action enums keep working.

Hosted finish follows the merge-queue default: compose and check against current main automatically, with explicit resolution for overlapping edits. The native laneUpdates setting does not control this hosted behavior and is hidden in hosted settings. Native settings and sync policy are unchanged.