trunkjet

Run your own server

On this page

Administrator guide

Running tjetd on FoundationDB and a content store: installation, configuration, identity, limits, data safety and observability. Every statement comes from the code, docs/decisions/ (cited as D-nnn) or the binaries' --help (see the CLI reference). Alerts and incident procedures are in the runbooks. Fast-moving details, such as exact flag lists, live in the generated reference, which make docs checks against the binaries.

Status. This is the F1 functional implementation. Production qualification (P1: topology manifest, signed packages, multi-host failure tests, two-person purge) is not complete. Treat every production statement below as "what the code does", not "qualified for production".

1. Components

BinaryRoleLinks libfdb_c
tjetdAPI and web server. Optionally runs the background worker in-process (--with-worker)yes
tjet-workerBackground worker: outbox and notifications, webhooks, maintenance, per-repository duties (retention, quota refunds, GC, compaction, reconcile, scrub, search index reconciliation), GC/purge/blame/search jobs. Several workers may run; work is idempotentyes
tjet-adminOperator CLI that talks directly to FoundationDB and the store: bootstrap, quotas, doctor, backups, restore, cell authority, storage integrity, Git import/exportyes
tjetUser client (talks to tjetd over HTTPS only). tjet admin ARGS runs the tjet-admin next to itno
tjet-agentPer-user workspace daemon (tjet daemon start)no

User clients never depend on libfdb (make client-isolation). The server-side binaries need libfdb_c from the FoundationDB client package matching the cluster. The development copy is in deploy/dev/fdb-client (make fdb-client).

2. Development installation

make dev-stack        # FoundationDB, Garage (S3), Dex (OIDC), bazel-remote, tjetd + worker + web UI
make dev-doctor       # installation doctor over the API
make dev-stack-down   # stop tjetd (containers keep running; deploy/dev/stack.sh down --all stops them)

deploy/dev/README.md has the component table, ports and environment overrides. The stack's tjetd runs with --dev, which means:

  • Development identities: Authorization: Bearer dev:<subject> is accepted, and the CLI accepts TJET_DEV_IDENTITY=<subject>. tjetd bootstraps tenant dev (issuer nscm-development) with --dev-users, default alice:tenant_admin,bob,carol,agent1:agent,ci:service. Unknown role names in --dev-users are silently ignored. tjet-admin bootstrap-tenant rejects them.
  • Loopback only: --dev refuses a non-loopback listener.
  • The development-only tuning flags become available: --gc-grace-ms, --upload-ttl-ms, --prepare-ttl-ms, --session-retain-ms, --expiry-interval-ms (D-903; end-to-end tests reach removed upload records with them), --max-upload-bytes, --max-batch-mutations, --blame-sync-max-diffs, and the fault-testing variable TJET_TEST_CLOCK_OFFSET_MS. Without --dev, tjetd refuses each of them with exit 2.
  • Plain-HTTP S3 endpoints are allowed. Staged repository delete is allowed.
  • Every response carries x-tjet-development: DEVELOPMENT - no node-failure durability, and discovery/capabilities reports development_mode: true.

To run an extra isolated development server (tests, demos), give it its own --installation name (the FoundationDB Directory Layer root), store, archive and search directories, and port:

LD_LIBRARY_PATH=deploy/dev/fdb-client target/debug/tjetd --dev --with-worker \
  --cluster-file deploy/dev/fdb.cluster --installation my-test \
  --store-dir /tmp/my-test/store --archive-dir /tmp/my-test/archive --search-dir /tmp/my-test/search \
  --listen 127.0.0.1:8740 --metrics-listen 127.0.0.1:8741

The API examples were verified against exactly such a server.

3. Production installation

Prerequisites

  • A FoundationDB cluster and its cluster file, plus the matching client library on every server host. The reference topology and its failure-domain proof (12 §2) are P1 work (T076). Today the doctor's fdb_cluster check reports availability, redundancy, fault tolerance and degraded processes from the cluster's status JSON.
  • A content store. local is a single-host development adapter. s3 is an S3-compatible object store, with TLS required outside --dev.
  • A TLS certificate and key for any non-loopback listener.
  • A shared cursor key: 32 raw bytes or 64 hex digits, the same on every tjetd instance. Production refuses to start without it.
  • An OIDC identity provider for interactive login (section 4).
  • NTP-synchronised clocks on every server and worker host. ID-token redemption markers tolerate a host running up to 10 minutes behind the host that sweeps them. Skew beyond that is outside the safety bound, and a node far enough behind could accept a replayed ID token. Monitor clock offset as part of host monitoring. A host also postpones every wall-time expiry or retirement decision while its clock differs from the lease clock's recorded wall time by more than 10 s, or while the lease clock is stalled. See Clock skew and postponed expiry in section 8.

Configuration file

tjetd --config FILE (or TJETD_CONFIG) reads a TOML file. Command-line flags and environment variables override it. The schema rejects unknown keys. Secret files (TLS key, OIDC client secret, cursor key) must not be readable by group or others (chmod 600); otherwise startup fails. The annotated template is deploy/production/tjetd.example.toml. The schema is server/tjetd/src/config.rs.

Section / keyDefaultOverrideMeaning
[server] listen127.0.0.1:8640--listen, TJET_LISTENAPI listener
[server] tls_cert_file, tls_key_filenonePEM files, set both or neither. Required for a non-loopback production listener
[server] with_workerfalse--with-workerRun the worker in-process. The template runs tjet-worker separately
[server] metrics_listenoff--metrics-listen, TJET_METRICS_LISTENSeparate private listener for GET /metrics
[server] trusted_proxiesnone--trusted-proxies, TJET_TRUSTED_PROXIES (comma-separated)CIDRs of reverse proxies whose forwarding header names the client address for per-address limits (login, signup, anonymous lookups). Read right to left; client-written entries further left are ignored, a non-address entry charges the proxy. Only the proxies themselves
[server] client_address_headerx-forwarded-for—The header those proxies set: x-forwarded-for or forwarded (RFC 7239)
[server] proxy_listenoff--proxy-listen, TJET_PROXY_LISTENSecond API listener for the proxy only: with it, only this listener reads the header (put it behind a firewall rule or NetworkPolicy that admits the proxy alone)
[fdb] cluster_fileclient default--cluster-file, TJET_FDB_CLUSTER_FILEFoundationDB cluster file
[fdb] installationdev--installation, TJET_INSTALLATIONInstallation name (Directory Layer root). Every binary of one installation must use the same value
[fdb] cellc1--cell, TJET_CELLCell name
[store] kindlocal--store, TJET_STORElocal or s3
[store] dirnone--store-dir, TJET_STORE_DIRLocal store directory (required for local)
[store] s3_durabilitysingle-host--s3-durability, TJET_S3_DURABILITYWhat the S3 storage contract was qualified for: single-host or regional. An operator declaration, reported as durability_profiles
[store] object_cache_bytes536870912 (512 MiB)Verified immutable objects kept in memory across requests; 0 disables. Hits still need the request's authorization and an AVAILABLE catalog row
[store] object_cache_max_chunk_bytes262144 (256 KiB)Largest raw chunk (file content) the object cache admits; metadata objects are always admitted
[preparation] patch_memory_bytes1073741824 (1 GiB)Effective-patch memory all of a server's revision preparations may hold at once. A preparation waits until its patch fits; only a patch larger than this is refused BUDGET_EXCEEDED. At least 1024; a smaller value refuses startup
[search] dirnone--search-dir, TJET_SEARCH_DIRSearch index generations. Search is disabled without it. The directory is host-local: every server keeps its own replicas of the published generations, built from repository content, swept every minute and bounded by [search] max_replica_bytes
[search] max_replica_bytes68719476736 (64 GiB)Bytes of search replicas one server keeps; beyond it the least recently used are removed and rebuilt on demand
[archives] dirnone--archive-dir, TJET_ARCHIVE_DIRDirectory for archives written or received over the API (export, backup, import, restore). Without it those operations fail INVALID_ARGUMENT
[tree_snapshots] dirnone--tree-snapshot-dir, TJET_TREE_SNAPSHOT_DIRCache of tree snapshots: one compact file per revision, built on the first read.treeSnapshot request (about 2 minutes and 185 MB for an AOSP-sized tree of 1.95M entries) and served to accounts that may list and read the whole revision, so lazily opened virtual workspaces hold the whole view's metadata within seconds. Host-local derived data: removable at any time (rebuilt on demand), removed with a purged repository. [tree_snapshots] max_bytes (default 20 GiB; oldest builds are removed first) and threads (catalog readers per build, default 8). Without it clients list trees with read.listTree
[security] cursor_key_filerandom in --devShared pagination-cursor key. Required in production
[security] webhook_allowlist[]Hosts webhooks may reach despite non-public addresses
[security] deletion_recovery_days7TJET_DELETION_RECOVERY_DAYS, --deletion-recovery-daysDays a deleted repository can be restored before its permanent purge starts. 0 = purge at once (warned at startup)
[security] single_approver_purgefalseDeprecated: accepted and ignored; one administrator can always delete
[security] installation_admins[]{issuer, subject} pairs: the only callers of tenant.create
[security] idp_allowlist[]hosts or host:port that organisation-configured identity providers may reach on non-public addresses or plain HTTP
[sessions] session_ttl_secs, refresh_ttl_secs900, 2592000Access-token and refresh-token lifetimes
[[oidc]]noneIdentity providers (section 4)
[admission]see section 6Per-process admission limits
[validation] require_signed_results, [[validation.executor_keys]]true in production, false in --devSigned check results: principal, key_id, ed25519_public_key (64 hex digits). With the requirement on, an unsigned result is refused (ACCESS_DENIED), so list every executor's key before CI reports results. Keep a retired executor key listed until every release using evidence it signed is certified: certification re-verifies the signature
[validation] receipt_signing_key_file, receipt_signing_key_idnoneServer Ed25519 key (a 64-hex-digit seed file, mode 600, as written by tjet validation keygen). Countersigns validation receipts and signs release certifications, which then embed the executor signatures, so a verifier with the public keys checks them without tjetd. Both or neither; a malformed or group/world-readable file stops tjetd
[artifacts]absentS3 artifact provider for release certification: kind = "s3", endpoint, region, bucket, prefix, access_key_file, secret_key_file, durability. Without it, releases that name artifacts cannot be certified
(flag only) --web-dir, TJET_WEB_DIRServe the built web app (web/dist) from the same origin
(flag only) --metadata-tier, TJET_METADATA_TIERfdbWhere new namespace pages, revisions, mutation pages, file manifests and chunk trees go: fdb (one FoundationDB value each) or segments (the content store, as before; the rollback setting). Both kinds are always readable. Set it the same on every tjetd, tjet-worker and tjet-admin; see metadata-tier
(flag only) --metadata-tier-repo-max-bytes, TJET_METADATA_TIER_REPO_MAX_BYTES1073741824FoundationDB-resident bytes one repository may hold; beyond it new metadata goes to segments
(flag only) --fdb-encryption-at-rest, TJET_FDB_ENCRYPTIONnoneDeclared encryption at rest of the FoundationDB volumes, reported by the doctor

S3 content-store credentials come only from the environment (server/store/src/s3.rs): TJET_S3_ENDPOINT, TJET_S3_REGION, TJET_S3_BUCKET, TJET_S3_ACCESS_KEY and TJET_S3_SECRET_KEY are required. TJET_S3_PREFIX defaults to empty. TJET_S3_ENCRYPTION declares encryption at rest; it is reported, not verified, and defaults to unverified. Endpoints must be https, except a loopback host or under tjetd --dev. Transient failures (connection errors, timeouts, 408/429/500/502/503/504, SlowDown) are retried, up to 5 attempts with backoff capped at 2 s, then reported as STORAGE_DEGRADED. Retry-After is not honoured. Only NoSuchKey counts as a missing object; a missing bucket or an access error is an outage. The release artifact provider ([artifacts]) follows the same rule: a nonexistent bucket is an error, never "artifact missing".

Forward proxies. tjetd reaches the S3 endpoint through a forward proxy when HTTPS_PROXY (https endpoints), HTTP_PROXY (http endpoints) or ALL_PROXY is set in its environment (either case), except for hosts listed in NO_PROXY; all are ignored when REQUEST_METHOD is set (CGI). NO_PROXY (read before no_proxy) is a comma-separated list : * alone excludes every endpoint, IP literals included; a domain (example.com, .example.com or Go's *.example.com) excludes it and its subdomains, case insensitively; an IP address or CIDR range (10.0.0.0/8, ::1, [::1]) excludes matching addresses; any entry may carry a port (garage.internal:3900, [fd00::5]:3900, 10.0.0.0/8:3900, *:3900) and then excludes the host on that port only, an endpoint without an explicit port counting as 80 (http) or 443 (https). The rules are the same whether the list comes from the environment or from configuration. Credentials in the proxy URL (http://user:pass@proxy:3128) are sent as Proxy-Authorization: Basic. An https endpoint is reached through a CONNECT tunnel with TLS end to end; its certificate is verified as without a proxy. SOCKS proxies are not supported (every store request fails and says so). The variables are read at startup.

Garage topologies and reverse proxies. Garage (measured: v2.4.1) does not set TCP_NODELAY on its S3 API connections and writes a response's header and body separately, so on a reused keep-alive connection the body waits for the client's delayed ACK: ≈ 40 ms per request, whatever the object size or network. tjetd's own S3 connections re-arm TCP quick-ACK and do not stall. Anything else that keeps connections to Garage alive does:

TopologySupportedWhat to configure
tjetd → Garage directly over plain http (loopback, or --dev; Garage's S3 API has no TLS of its own)yesnothing
tjetd → TLS-terminating reverse proxy → Garage (the production shape when Garage is not on tjetd's host: endpoints must be https)yes, with the proxy's upstream keep-alive offsee below
tjetd → forward proxy (HTTPS_PROXY, CONNECT) → TLS reverse proxy (keep-alive off) → Garageyesas above for the reverse proxy
tjetd → forward proxy (HTTP_PROXY, plain http) → Garageno while the forward proxy reuses its connections to Garage (it terminates TCP: its socket stalls, not tjetd's)exclude Garage with NO_PROXY, or turn off the forward proxy's persistent server connections
any proxy with upstream keep-alive → Garageno: every larger GET ≈ 40 msturn upstream keep-alive off

Measured (tjet-store s3_latency_real, 64 KiB verified GET, p50; loopback; evidence in records/evidence/runs/20261021T135011Z-counterexamples-d805-d810/): direct 0.36 ms; nginx 1.27 with an upstream keepalive pool 41.9 ms (42.0 ms with TLS on the front), without it 0.36 ms (0.43 ms with TLS); HAProxy 3.0 default 41.9 ms, http-reuse never still 41.9 ms (the server connection stays bound to the client session), option http-server-close 0.46 ms; Caddy 2 default 42.0 ms, keep_alive disabled in the http transport 0.56 ms; a minimal forward proxy relaying HTTP_PROXY requests to Garage over kept-alive connections 41.95 ms, and its CONNECT tunnel to the nginx TLS front without upstream keep-alive 0.51 ms. A new proxy→Garage connection per request costs one TCP handshake on the proxy's side (keep the proxy next to Garage); TLS to tjetd stays pooled.

  • nginx: do not put keepalive in the Garage upstream block (and leave proxy_http_version at its default, or set proxy_set_header Connection close). tcp_nodelay does not help: it applies to nginx's own writes, not Garage's.
  • HAProxy: option http-server-close in the Garage backend. http-reuse never alone is not enough.
  • Caddy: reverse_proxy { transport http { keepalive off } }.
  • Others (Envoy, Traefik, cloud load balancers): disable upstream/backend connection reuse to Garage, or measure with s3_latency_real against the proxy (p50 of a 64 KiB GET must stay far below 40 ms).

Other S3 implementations that set TCP_NODELAY (or write header and body together) are not affected. An upstream report for Garage is drafted in docs/upstream/garage-tcp-nodelay.md (not sent; the owner's call).

Startup refusals

tjetd exits 2 on a configuration or validation error and 5 on a runtime failure (cannot open FoundationDB or the store, cannot bind). The refusals include: a production listener off loopback without TLS; --dev on a non-loopback listener; production without security.cursor_key_file; a development-only flag without --dev; an invalid [admission], [[oidc]] or [validation] entry; a group- or world-readable secret file; and a read-only cell (section 7). With no OIDC provider configured, tjetd only logs a warning: only existing sessions and scoped tokens can then authenticate.

tjetd also logs a warning, without refusing to start, in two production cases about signed check results. The first is when require_signed_results is on (the default) but no [[validation.executor_keys]] are listed: every validation result is then refused until a key is added. The second is when require_signed_results = false is set explicitly: unsigned results are then accepted, so a stolen CI token alone can report a passing check.

Worker

Run tjet-worker with the same --cluster-file, --installation, --cell, --store/--store-dir (and TJET_S3_*), --s3-durability/TJET_S3_DURABILITY (default single-host) and --search-dir as tjetd. It has no --config; --metrics-listen ADDR (TJET_WORKER_METRICS_LISTEN) serves its own GET /metrics. It runs in production mode unless started with --dev (as tjetd: development credentials and the staged purge are honoured, and plain-http S3 endpoints off loopback are allowed). It has a 72 h GC grace, and takes --webhook-allow and --activity-retain-days (default 365) as flags. A missing or unreadable cluster file is reported with its path (exit 5). --once runs one pass and prints a JSON summary. Each duty runs independently: a failing duty is logged and counted, and the others still run; --once exits 5 when any duty failed. A wall-time decision postponed because of clock skew is not a failed duty. Per-repository duty intervals: streams and search reconciliation 10 min, expiry 10 min, retention 60 min, quota 60 min, GC 24 h, compaction 60 min, reconcile 24 h, scrub 60 min (20,000 objects per run).

Compaction looks only at segments that changed: the collector's sweep, quarantine and its end, repair and the metadata-tier migration queue the segment whose record they change, in the same transaction, and new segments are found by their time-ordered ids. A repository where nothing changed costs a pass about six small FoundationDB transactions. After an upgrade from an earlier version the first passes queue every existing segment once (a resumable backfill of at most 100,000 segment rows per pass), and once more a day later for what processes of the earlier version changed during a rolling upgrade. A daily audit queues the larger of 200,000 records and a thirtieth of the repository's records, so a change that was never queued (a process of an earlier version still running after that, a writer clock more than an hour behind) is queued again at the latest 30 days later (and examined as the per-pass budget of 2,000 segments allows). RETIRED segments are visited only while destructive collection is enabled. Each duty's database cost is exported per duty as tjet_request_*{operation="duty:<name>"}, and compaction's work by kind in tjet_segment_compaction_total (queue_entries, segments_examined, segments_discovered, segments_audited, segments_backfilled, among others).

The worker takes --metadata-tier (TJET_METADATA_TIER) like tjetd: it stores objects too (imports, restores, preparations it runs), so set the same value on every process.

Pathlog index jobs keep the per-path history index current; at most 2 run per worker process, queued by publication events and by the streams duty (which also backfills streams published before the index existed). tjetd --history-index off switches the index off on that process (history then walks exactly), and --history-time-budget-ms (default 20,000) bounds one history computation inside a request; see the history-index runbook.

Background blame jobs run in their own tasks, at most 2 per worker process, beside the other duties. A principal may own at most 8 QUEUED or RUNNING blame jobs; a request that would queue one more is refused with QUOTA_EXCEEDED. Neither number is configurable in tjetd or tjet-worker.

Webhook deliveries. A delivery is tried 8 times, then dead-lettered (tjet_worker_items_total{kind="dead_lettered"}, alert ScmWebhookDeadLetters). Dead letters are kept 14 days. Stream administrators list them with tjet webhook dead-letters and re-queue them with tjet webhook replay WEBHOOK [DELIVERY...] (or on the repository settings page), D-370. Deliveries are scrubbed again at send time, connect only to validated public addresses (or --webhook-allow / [security] webhook_allowlist hosts), and never follow redirects .

Mixed versions and rollback

Rolling upgrades are qualified since D-1765 (make prod-upgrade): replace the binaries one process at a time while old and new serve together, then run tjet-admin schema migrate once (ordered, resumable migration steps, then the contract that raises the minimum reader and the schema write fence: older binaries refuse to open the cell and, if still running, to write). There is no downgrade after schema migrate; restore a backup taken before it. The procedure, the client version-skew rules and the downgrade policy are in the upgrade runbook. Record decoders refuse unknown fields: a value written by a newer build that uses a field an older build does not know is refused by the older build with UNSUPPORTED_VERSION instead of being silently erased. For example, an upload record that carries an object-count reservation is written as schema 2, which an older binary refuses. Upgrade every tjetd, tjet-worker and tjet-admin of an installation before schema migrate, and treat a binary rollback after new records were written as unsafe. Per-change upgrade notes are in the runbooks.

FoundationDB metadata tier. Catalog rows of metadata stored in FoundationDB are schema 2, which a binary older than D-981 refuses. The rule "readers before writers" is enforced by the schema gate: on a cell expanded from schema generation 1 no process writes to the tier until tjet-admin cell raise-min-reader 2 (the contract step), which you run once every tjetd, tjet-worker and tjet-admin is upgraded; older binaries then refuse the cell. Downgrading below D-981: tjet-admin cell close-metadata-tier (no kind-1 write commits after it, D-1007), switch every process to --metadata-tier segments, run tjet-admin storage meta-migrate REPO --to segments for every repository until it is done with nothing deferred, check storage usage shows schema2_rows 0, then tjet-admin cell lower-min-reader 1 and only then install the older binaries (metadata-tier runbook). --metadata-tier-repo-max-bytes (default 1 GiB) caps a repository's FoundationDB-resident bytes. File and directory names then live in FoundationDB: encrypt its volumes and declare it with --fdb-encryption-at-rest; the doctor's metadata_tier check warns until declared. File manifests and chunk trees are in the tier too (D-1080; manifests carry file sizes and whole-file SHA-256 digests); they need no new generation, but the rollback's meta-migrate --to segments must run with a tjet-admin of D-1080 or later: an older one leaves them, and cell lower-min-reader 1 is refused with "file-metadata rows remain; run meta-migrate --to segments with tjet-admin D-1080 or later". FoundationDB backups (tjet-admin fdb-backup) hold the same names and digests: encrypt the backup container too.

Collector rules. While a repository has a quarantined object, or one repaired within the last two collections, its collector state carries a rules field that binaries older than D-1020 refuse (UNSUPPORTED_VERSION for its activations, registrations and collections): they must not resume such a collection or trust its marks. Before rolling back, repair or accept the loss of every object in tjet-admin storage quarantined REPO and let two collections complete. During a rolling upgrade the same applies the other way: as soon as a new node quarantines an object or repairs one, the old nodes refuse activations, registrations and collections in that repository (fail closed) until they are upgraded too.

Health endpoints

tjetd serves GET /healthz (liveness: 200 ok, no dependency checked) and GET /readyz (readiness: 200 or 503 with a JSON body; checks fdb, cell_link, storage) on the private metrics listener (metrics_listen), not on the API listener. Details: install.md §6. The doctor (section 11) remains the deep check. tjet-worker has /metrics only; supervise it by its process state (systemd, the container).

4. Identity and access

OIDC providers

Each [[oidc]] entry has issuer, algorithms (required; symmetric HS* algorithms are refused), leeway_secs (default 30), discovery (read the discovery document and JWKS), optional pinned keys = [{kid, pem_file}], audience, name (shown on the login page, used with tjet login --provider) and the clients:

  • web = {client_id, client_secret_file, redirect_uri}: browser login, a confidential client. redirect_uri must be <origin>/v1/auth/web/callback. Allowed browser origins come from these URIs.
  • cli = {client_id}: tjet login, a public client with PKCE and a loopback redirect, or tjet login --device (device authorization).

Issuer and redirect URLs must be https, except on loopback. JWKS is refetched on an unknown key ID at most every 30 s, and hourly. The development Dex fixture is in deploy/dev/dex/config.yaml (user [email protected]).

An identity is (issuer, subject) mapped to a pre-provisioned principal. Email is never used, and there is no auto-provisioning: an unknown identity gets AUTH_REQUIRED. Access tokens last 15 minutes by default. Refresh tokens rotate on every use, and reusing an old one revokes the whole token family. Only token hashes are stored.

The clients never reuse a refresh token on their own: tjet and the workspace daemon refresh a stored login one process at a time under a per-account lock file, and after a refresh whose outcome they could not learn (timeout, cut connection, 5xx, crash) they ask the user to run tjet login instead of resending it. A "refresh token reuse detected" revocation therefore points at a copied or stolen refresh token, or at a client older than this behaviour, not at concurrent commands of one user. The daemon logs waited for another process's refresh of the stored login (with waited_ms), the stored login has an interrupted refresh and the refresh of the stored login has an unknown outcome; no token is logged.

Sign-in providers

Besides the [[oidc]] entries of the configuration file, sign-in providers can be configured in the web application and the API. Nothing needs a restart.

Who configures what.

WhereWhoProviders
/admin/sign-in (account menu > Sign-in providers), loginProvider.* without organisationinstallation operators: the [security] installation_admins identities of the configuration file (or accounts with one of them as a sign-in method)GitHub (also GitHub Enterprise Server), Google, Microsoft, GitLab, any OpenID Connect provider, any OAuth2 provider with a userinfo endpoint
Organization settings > Single sign-on, loginProvider.* with organisation: truethe organization's administrators (tenant_admin)the organization's own OpenID Connect provider only

Saving or removing a provider needs a recent sign-in ("confirm it's you"). The client secret is sent once, stored encrypted with the installation PII key (TJET_PII_KEY_FILE, the same key and rotation as stored email addresses) and never shown again: answers only say has_client_secret: true; an update without a secret keeps the stored one. Without a PII key or without TJET_PUBLIC_ORIGIN, providers cannot be saved. Test connection checks discovery and signing keys (OpenID Connect) or the userinfo endpoint (OAuth2), then sends the token endpoint a code that cannot be valid: invalid_grant / bad_verification_code means the provider accepted the client ID and secret, invalid_client / incorrect_client_credentials means it did not. Nobody signs in during the test.

Redirect (callback) URL. Installation providers share one callback URL, the canonical origin followed by /v1/auth/web/callback. Each organization provider has its own, /v1/auth/web/callback/o-<organization id>-<provider id>, shown in its row after saving (an organization administrator controls that provider's authorization endpoint, so a code issued by another provider must never be redeemed through it: a sign-in that comes back on another provider's callback is refused before the code goes anywhere). Register exactly:

InstallationCallback URL to register at the provider
trunkjet.io (hosted)installation providers: https://trunkjet.io/v1/auth/web/callback; an organization's single sign-on: https://trunkjet.io/v1/auth/web/callback/o-<organization id>-<provider id> as shown in Organization settings > Single sign-on
tjet.io (alias of trunkjet.io)none: do not register https://tjet.io/.... A sign-in started on tjet.io is redirected (301) to trunkjet.io before it begins, and session cookies are host-only cookies of trunkjet.io (no Domain attribute), so a callback on tjet.io could never finish a sign-in
self-hosted<TJET_PUBLIC_ORIGIN>/v1/auth/web/callback (and .../callback/o-... for organization providers), for example https://scm.example.com/v1/auth/web/callback; never an alias origin (TJET_ALIAS_ORIGINS)

The sign-in page shows "Continue with <label>" for every enabled installation provider.

Settings per provider.

  • GitHub: create an OAuth app (GitHub > Settings > Developer settings > OAuth Apps; for an organization-owned app, the organization's settings) with the callback URL above. trunkjet asks for read:user user:email, uses PKCE (S256), reads GET /user and the verified primary address from GET /user/emails. For GitHub Enterprise Server enter its address; trunkjet then uses <address>/login/oauth/* and <address>/api/v3/user[/emails].
  • Google: an OAuth client ID of type "Web application"; issuer https://accounts.google.com.
  • Microsoft (Entra ID): an app registration with a "Web" platform; issuer https://login.microsoftonline.com/<directory (tenant) ID>/v2.0. The multi-tenant common issuer is refused (its discovery document names a template issuer, not one issuer).
  • GitLab: an application (GitLab > Preferences > Applications, or an instance-wide one) with scope read_user. The preset fills https://gitlab.com/oauth/authorize, https://gitlab.com/oauth/token, https://gitlab.com/api/v4/user, user id field id, user name field username, email field email and email-verified field confirmed_at; replace gitlab.com for a self-managed GitLab.
  • Other OpenID Connect: the issuer must serve <issuer>/.well-known/openid-configuration whose issuer equals the configured one exactly; ID tokens are verified with its JWKS.
  • Other OAuth2: authorization, token and userinfo URLs, and the userinfo field names. The user id field must be a stable id that is never given to another person (not a user name).

Identities and accounts. An OpenID Connect provider's identities are (issuer, sub). An OAuth2 provider has no verifiable issuer, so its identities are recorded under oauth2:<userinfo URL> (generic OAuth2: oauth2:<userinfo URL>#<user id field>) with the provider's user id: GitHub's subject is the numeric user id, never the login, so a renamed or re-registered GitHub login never reaches someone else's account. Changing a provider's userinfo URL (or an OIDC issuer) therefore starts a new identity space, and removing a provider stops its identities until a provider with the same identity issuer exists again. Accounts are never matched by email (spec 21 §3.1, INV-ID-3):

  • A known identity signs into its account.
  • An unknown identity of an installation provider creates a new account only when signup is open (TJET_SIGNUP = open or domains, the domain lists apply) and the provider vouches for a verified email address that no account uses as an email sign-in method. The handle is suggested from the provider's user name (GitHub login) under the handle rules (reserved and confusable names, -2 ... -20, then a random suffix); the name is the provider's display name, never an email address. Hosted installations with terms (TJET_TERMS_VERSION) record their acceptance: the sign-in page says that continuing with a provider accepts them. The address itself is not stored. TJET_SIGNUP_JOIN_ORG applies.
  • Otherwise nothing is created and the sign-in page explains why: signup off, no verified email (email_not_verified), the address belongs to an account (email_in_use: sign in with that account, then Settings > Sign-in methods > Link your <provider> account), domain not allowed, or terms not accepted.
  • An organization's provider never creates accounts and never signs in on its own (its administrator controls the IdP and could authenticate as any of its subjects, so its identities must not open other people's accounts): members sign in another way, link it once (Settings > Sign-in methods > Link your <provider> account), and confirm with it when the organization's sign-in rule asks ("Require company login", spec 21 §3.5; the rule accepts the organization's own issuers and the installation's OpenID Connect issuers). A plain sign-in attempt with it answers sso_needs_account.
  • Known limits (review of D-1843): GitHub has no "sign in again" parameter, so "confirm it's you" with GitHub proves the person's current GitHub browser session, not a fresh GitHub sign-in; the terms acceptance of a first provider sign-in travels in the sign-in link (a forced navigation of someone who already authorized the app could create an account in their name with the terms shown on trunkjet's sign-in page but not read); accounts created by a provider sign-in are rate-limited per email domain, not per network.

Outbound requests. URLs of organization providers are configured by organization administrators, so trunkjet treats them like webhook destinations: HTTPS only, and every address the host resolves to must be public, pinned for the connection (no DNS rebinding). An operator can allow an internal IdP with [security] idp_allowlist = ["sso.internal.example:443"]. Installation providers are operator configuration and may use internal addresses (https, or http on loopback). Configuration changes are audited (installation.login_provider_put/_delete, organisation.login_provider_put/_delete) and counted in tjet_login_provider_changes_total; accounts created this way count in tjet_signup_total{result="provider"}.

First tenant and administrators

tjet-admin --installation acme --issuer https://login.example.com --store s3 \
  bootstrap-tenant acme --principal <idp-subject>:tenant_admin

bootstrap-tenant is idempotent. It creates the tenant if absent and registers principals of --issuer as SUBJECT[:ROLE...][:agent|:service]. Use it to create agent and service principals too. A bootstrapped principal is named by its subject until its first OIDC login, which takes the ID token's name, else preferred_username, else email claim as the display name (control characters removed, at most 256 characters). A display name set with principal.update is never overwritten (unless it equals the subject). The roles are reader, developer, reviewer, maintainer, repository_admin, auditor, agent and tenant_admin. tjet-admin does not check --issuer against tjetd's OIDC configuration, so spell it exactly as the provider's issuer. Later tenants are created with tenant.create by installation_admins signed in with a human session. No CLI or web surface exists for it yet.

Repository roles are granted with tjet repo grant (role.put). Path rules are set with access.put. Groups are managed with group.put. Principals are listed and updated with principal.list and principal.update.

Scoped tokens (agents, CI)

token.issue (tjet agent token create) issues a token for the caller or for an agent or service principal. A token names 1 to 64 repositories, optional path prefixes and capabilities (empty means the default agent set). The TTL defaults to 2 hours and cannot exceed 24 hours. A token never exceeds its sponsor's rights, and a scoped token cannot issue tokens. Tools receive tokens through TJET_TOKEN, --token-fd or --token-stdin, never as command-line arguments. Revocation (token.revoke) takes effect immediately; this is verified in API example 8.

Imported principals

Principals that arrive through an archive restore are inactive until bound (15 §1): tjet-admin principal-bind --bind-issuer I --bind-subject S PRINCIPAL_ID. It refuses an already active principal or an already bound identity.

Since schema generation 5 (D-1772, work package ID-0) a person is a global account: the account id is the person's principal id in every organisation (tenant) the account is a member of, and rights in an organisation come only from its membership row. Sessions, scoped tokens, jobs, the inbox, "assigned to me" and admission limits are kept per organisation, so one account in two organisations sees nothing of the other. Tenant APIs (principal-bind, principal.update, restore) never make an existing account a member of another organisation: A restore writes the people of an archive as inert, inactive evidence; principal-bind turns a restored person into a new account and member, and refuses an id that already is an account (its login is never rebound). Adding an existing account to another organisation goes through an invitation (tjet org invite). People without an account get one from the mailed invitation link even when self-service signup is off (B1); operators invite to the installation without an organisation with tjet-admin invite create --email ADDRESS [--ttl-hours N] (also invite list, invite revoke --id ID; needs --pii-key-file and --public-origin; tjetd's relay delivers the mail, the link is never printed). Agent and service principals still belong to exactly one tenant of the cell; an id active in two tenants signs in to neither until an operator resolves it with tjet-admin principal-resolve-contested, and the doctor's principal_home check fails until then.

A database written before generation 5 is refused at start with SCHEMA_TOO_OLD; there is no conversion. Create a fresh installation (archives are imported with an explicit principal map).

5. Quotas

tjet-admin quota shows the tenant byte quota (limited, capacity, granted_to_shards, used, retained, version). quota --bytes N sets the capacity, and quota --reconcile REPO refunds expired unsealed uploads of a repository. Setting needs tenant_admin. It is versioned (quota.put with expected_version; a stale version is refused with POLICY_CHANGED) and audited as audit.quota_changed. A tenant without a capacity is unlimited, but retained bytes are still counted.

Uploads reserve their declared size against the quota when they begin (escrow). Deduplicated bytes are refunded at settlement, and objects the collector deletes are refunded. Exhaustion is QUOTA_EXCEEDED: HTTP 429, retry NEVER, tjet exit code 7. The doctor's quota check warns at 90 % and fails at capacity. Byte quotas are separate from admission limits.

Object-count quota. A tenant may also have an object capacity, escrowed the same way: upload.begin reserves its declared max_objects, new object incarnations are charged, and deduplication and collection refund them once. Beyond the capacity, upload.begin fails QUOTA_EXCEEDED "tenant object quota exhausted". tjet-admin quota --objects N sets the capacity, or the API: quota.put with object_capacity, under the same expected_version, audited. quota.put always sets the byte capacity too, so --objects alone keeps the current byte capacity and is refused (INVALID_ARGUMENT) while the tenant has none: give --bytes as well the first time. A quota.put without object_capacity leaves it unchanged, and there is no way yet to remove an object capacity once set. tjet-admin quota and quota.get report objects_limited, object_capacity, objects_used and objects_retained. The doctor's quota check judges both dimensions, reports both usages, and takes the worse status: WARN above 90 % and FAIL at capacity of either. Objects of repositories that existed before this accounting are counted by maintenance over time, so until then they are under-counted. Like bytes, objects the server constructs itself (merges, rebases, prepared trees) are retained without a reservation and can briefly exceed the capacity.

6. Admission control

tjetd admits each request after authentication and before any work, per process (not cluster wide). A refused request is not queued and consumes nothing.

  • Pools. admin (humans holding tenant_admin), interactive (other humans), automation (agents, services, any scoped token).
  • Classes. merge, archive, write, graph, search, content, upload, watch (event and job streams and job.watch, counted per principal only), inbox_watch (inbox.watch long-polls, counted per principal, per tenant and per process, D-1180; neither watch class counts against the request pools), queue (integration.land, counted per principal, per tenant and per process, D-974/D-979, never against the request pools) and metadata.
  • [admission] keys and defaults.
    • Per principal: principal_rate 100/s with principal_burst 400, principal_concurrency 32, expensive_concurrency 4, archive_concurrency 2, watch_concurrency 16 (event and job streams and job.watch over it are refused at once; inbox.watch calls are counted against it separately and one over it waits for one of its principal's inbox watch slots like an expensive request), queue_concurrency 1024 (integration.land requests waiting in landing queues, D-974: they hold no tenant or pool slot while they wait; building a round is bounded by expensive_concurrency rounds per principal and prepare_concurrency per process; a principal at its bound waits in the queue while the others' requests build).

    • Waiting land requests, D-979: tenant_queue_concurrency 4096 per tenant and queue_pool_concurrency 16384 per process. Each waiting request holds one connection and one queue entry; at a bound the request is refused with 429 RETRY_LATER (details.limit names the bound) and Retry-After, nothing of it is applied, and the client retries the same request later. The lanes' cache of recently built objects shares one 256 MiB budget per process (oldest rounds dropped first; it is a read cache only).

    • Writes: write_rate 20/s with write_burst 100.

    • Uploads: upload_object_rate 2000/s with upload_object_burst 8000; upload_bytes_rate 256 MiB/s with upload_bytes_burst 1 GiB.

    • Per tenant: tenant_interactive_concurrency 256, tenant_automation_concurrency 64, tenant_automation_rate 500/s with tenant_automation_burst 2000. tenant_admin_concurrency is unset: no fixed cap on one tenant's administrators (see the admin pool below). Set it only if you want a fixed cap; it counts every request a tenant's administrators make (browsing, sync, uploads, reads), not only administrative ones.

    • Per pool: admin_pool_concurrency 64, interactive_pool_concurrency 512, automation_pool_concurrency 128.

    • Workspace sessions: workspace_sessions_per_principal 4096 (1..1048576), open sessions per principal and repository. It guards against a client that opens sessions in a loop without closing them (each session holds a read hold on its revision for at most an hour); it is sized so that a CI fleet running thousands of jobs as one service account fits. Beyond it workspace.open answers QUOTA_EXCEEDED; sessions that expired without a close are pruned then. Concurrent opens of one principal can pass the bound by the opens committing at the same moment (at most its requests in flight). With admission off the bound is 1048576. Installations before D-970 had a fixed 64.

    • Admin pool: admin_pool_reserve 16, admin_contention_window_ms 30000. The admin pool is work-conserving. While no other tenant holds an admin slot or was refused one in the last admin_contention_window_ms, a tenant's administrators may use the whole pool, each bounded only by principal_concurrency. Every single-tenant installation is always in this case. Under contention:

      • a tenant holding no admin slot may take any free slot (a full pool refuses pool_concurrency, and that refusal makes the pool contended);
      • a tenant already holding slots may take another only while admin_pool_reserve slots stay free (limit pool_reserve) and while it holds less than its fair share, the pool divided by the active tenants, at least 1 (limit tenant_fair_share). Active tenants are those holding a slot or refused within the window.

      A tenant that filled the pool while it was alone keeps the requests it has in flight. Once another tenant is refused, it gets no new slot until it is under its share, so the newcomer gets the slots its requests release. With tenant_admin_concurrency set, that cap applies always (limit tenant_concurrency).

    • Waiting for a class slot: class_wait_ms 30000 (0..60000), class_waiters 64 (1..65536), class_wait_pool 4096 (1..1048576), tenant_class_waiters 1024 (1..1048576), class_wait_bytes 1 GiB (at most 64 GiB). A merge, graph, search, content or upload request over its principal's expensive_concurrency is not refused: it waits for one of that principal's slots of its class, in arrival order (a newcomer queues behind the waiters), holding no slot and no pool place while it waits, for at most class_wait_ms. It is refused as before (limit class_concurrency) when the wait ends, when class_waiters requests of its principal and class already wait, when class_wait_pool requests wait in this process, when tenant_class_waiters requests of its tenant wait in this process, or when its body (every request body is read before admission: an upload's objects, a JSON operation's request, up to 2 MiB) would bring the bodies kept by waiting requests over class_wait_bytes. Only this limit waits: a full pool, tenant budget or rate bucket refuses at once. A request admitted after waiting is authenticated again before it runs: a token revoked or expired, or a session ended, while it waited is refused (AUTH_REQUIRED), and it runs with the principal's grants as they are then. class_wait_ms = 0 restores the refusal at once. Metrics: tjet_admission_class_waits_total{class,outcome} (admitted, timeout, refused by another limit after waiting, queue_full) and the gauge tjet_admission_class_waiting.

    • Inbox watches: inbox_watch_pool_concurrency 8192 open inbox.watch calls per process, all tenants, and tenant_inbox_watch_concurrency 2048 per tenant in this process; beyond either an inbox.watch is refused at once (limit names the bound, Retry-After). Each open one is one connection, one task and one FoundationDB watch. The FoundationDB client allows 10,000 watches per process by default (the worker uses a few), so keep inbox_watch_pool_concurrency below that; an inbox.watch that cannot register its watch still answers correctly, re-reading every second (tjet_inbox_watch_fallbacks_total). Event and job streams have no process bound.

    • Cost of an idle inbox.watch (measured): tjetd memory grew by 134–202 KiB per watch the first time a process held that many (500 at once) and by 9–95 KiB per watch when it held them again; plan for the first-use figure: 8192 watches can take about 1.6 GiB. One FoundationDB watch, and no transaction while it waits. One 25-second poll costs one authentication transaction, one watch registration and two reads (one at the start, one at the deadline), about 0.16 transactions per second per idle client; a read is about 7 sequential round trips however many notifications it answers. A notification adds one read per woken watch. Watch tjet_inbox_watches_waiting, tjet_inbox_watch_arms_total, tjet_inbox_watch_answers_total{outcome}.

    • Lock watches: lock.watch long-polls are admitted in the same class and against the same per-principal, per-tenant and per-process bounds as inbox.watch (the two share inbox_watch_pool_concurrency and tenant_inbox_watch_concurrency). Each waiting call holds one FoundationDB watch on its repository's lock wake-up key and no transaction. Every lockset write wakes every watch of that repository, and each woken watch re-reads the repository's active locksets from the active-lockset index (D-1645; at most 8,000 index entries, more answer too_many and the client keeps polling lock.list), coalesced over 100 ms. A watch also wakes when the first lease of a lock its caller sees runs out. Watch tjet_lock_watches_waiting, tjet_lock_watch_answers_total{outcome}, tjet_lock_watch_fallbacks_total{reason}.

    • Active-lockset index: lock.list (active locks) and lock.watch read only the repository's held locksets, not its lock history. A repository from before D-1645 is read the old way (every lockset record) until a background backfill, started by its first lock read, has indexed it; readers also return to the old read, and start the backfill again, when they see a lockset write by a server that does not maintain the index (an older tjetd during a rolling upgrade). tjet_lock_index_reads_total{state} shows which read is used (complete is the index); tjet_lock_index_jobs_total{event} and tjet_lock_index_pruned_total show the backfills and the removal of index entries of expired or released locksets. No operator step is needed.

    • Authentication: auth_rate 2/s with auth_burst 30, per client address.

    • max_tracked_keys 200000. enabled is true; turn it off only for isolated benchmarks.

  • Detached preparations. A revision.prepare keeps building after its request answers PREPARE_IN_PROGRESS; until it ends it counts against its principal's expensive_concurrency, its tenant's budget of its own pool (tenant_automation_concurrency for automation, tenant_interactive_concurrency for other humans; administrators follow the admin pool rule above, with the optional tenant_admin_concurrency) and its pool's budget on this server, all tenants together (automation_pool_concurrency, interactive_pool_concurrency, admin_pool_concurrency). These are separate counts from requests in flight, with the same limits and the same contention window. Agents' preparations, of one tenant or of many, never refuse humans'; administrators of a few tenants (who can create more administrator principals) never keep another tenant's administrators out beyond the time their flights take to end. Refusals are the 429 below (limit class_concurrency, tenant_concurrency, pool_concurrency, pool_reserve or tenant_fair_share). With admission off every preparation budget is 1024 per pool and there is no reserve.
  • Validation. Rates must be greater than 0, bursts at least 1, concurrencies at least 1, admin_pool_reserve below admin_pool_concurrency, admin_contention_window_ms between 1 and 600000, class_wait_ms at most 60000, class_waiters, class_wait_pool and tenant_class_waiters within the ranges above, class_wait_bytes at most 64 GiB, and the three counts at least 1, and max_tracked_keys at least 1000. With tenant_admin_concurrency set, admin_pool_reserve + tenant_admin_concurrency must not exceed admin_pool_concurrency (D-890; otherwise the reserve would hold a tenant below its own cap). For example, with the default reserve 16 a cap of 16 needs admin_pool_concurrency of at least 32. Startup fails otherwise, with a message naming the three keys and the smallest pool that fits.
  • Refusal. HTTP 429 RETRY_LATER (retry SAME_REQUEST) with details = {reason: "ADMISSION_LIMIT", limit, pool, class, retry_after_ms} and a Retry-After header. tjet-api-client waits at least retry_after_ms (capped at 30 s) and resends the identical request. The web application resends the identical request (same body, so the same request id) after Retry-After, capped at 10 s, at most 3 times, and then shows the refusal. It never resends a 429 whose retry class is not SAME_REQUEST (QUOTA_EXCEEDED, BUDGET_EXCEEDED).
  • Advertised. /v1/discovery/capabilities reports admission = {principal_concurrency, class_concurrency} (absent when admission is off). tjet sizes its upload batches in flight to class_concurrency - 1 (at most 8; 3 without the field) and its content reads while materializing to class_concurrency (at most 8; 4 without it), so raising expensive_concurrency speeds up large transfers without client changes. Several operations of one principal at once (two syncs, a sync next to a materialization) can still exceed the class limit; the excess waits for the principal's slots instead of being refused (measured on one host: four concurrent workspace open of 128 MiB at the default limit 1.0 s with no refusal, against 4.0–4.9 s and 24–28 refusals before).
  • Behind a proxy. Login and refresh are charged per TCP peer, and forwarding headers are not trusted. Behind a reverse proxy, every client therefore shares one authentication bucket.
  • Anonymous readers are charged per client address (anonymous_read_rate/anonymous_read_burst) and, once their request body has arrived (within 30 s), hold one of the address's anonymous_concurrency (default 8), the network's anonymous_network_concurrency (default 32; IPv4 /24, IPv6 /48) and the process's anonymous_pool_concurrency (default 256) slots until the response has been sent; over any they get 429 RETRY_LATER with Retry-After.
  • Connections. Each API listener (8640, and the proxy listener 8642) holds at most TJET_MAX_CONNECTIONS (default 16384) connections and TJET_MAX_CONNECTIONS_PER_CLIENT (default 256) from one client address (IPv6 by /64; the trusted proxies are exempt); the next one is closed at accept (tjet_http_connections_refused_total{listener,limit}). A connection that has not sent 24 bytes, or an HTTP/1 request head, within TJET_HEADER_READ_TIMEOUT_MS (default 15000) is closed, also an idle HTTP/1 keep-alive connection (pooled HTTP/1 clients should keep idle connections shorter); HTTP/2 connections must answer keep-alive pings (60 s, 20 s timeout).
  • Metrics. tjet_admission_rejected_total{pool,limit,class}, tjet_admission_inflight{pool}, tjet_http_connections_open{listener}.

7. Cells, authority epochs and read-only mode

Every authority write re-reads the cell's authority epoch and read-only flag inside its transaction. A process whose epoch is stale, or a read-only cell, gets RETRY_LATER ("fenced and must restart" or "read-only"). Reads and replays of completed requests keep working.

tjet-admin --issuer I --as S cell status
tjet-admin --issuer I --as S cell advance-epoch --from N     # exactly N -> N+1; a retry returns changed:false
tjet-admin --issuer I --as S cell set-read-only on|off

These commands need tenant_admin and are audited (audit.cell_epoch_advanced, audit.cell_read_only_set). Only cell commands can open a read-only cell. Every other tjet-admin command exits 5, and tjetd refuses to start. After an epoch advance, restart every server and worker of the installation. The cell-authority runbook covers incidents. Cell migration and routing (T086) are not implemented.

8. Retention and garbage collection

Draft retention

tjet-admin retention show|set|apply REPO. Policy defaults: superseded draft revisions 7 days (intermediate), reviewed 180 days, abandoned 30 days. Each period must be at least 1 hour, and reviewed must be at least intermediate. apply only ever shortens draft-root expiry. The worker runs it hourly. Retention pins and legal holds (retention.pin/unpin) are GC roots.

Collector and its safety switches

Collection marks from all retention roots and sweeps objects that are unmarked, older than the collection epoch, and past the grace period (72 hours by default). Root activations during an open collection pay the closure-protection barrier. The worker schedules a run every 24 hours per repository. admin.gc (POST /v1/admin/gc, web Data page) takes action: status, run, schedule (enqueue a fenced gc.run job for the worker; a resend with the same request identity returns the job it already queued), enable_deletion or disable_deletion. It needs retention administration and keeps working in an archived repository. tjet-admin has no GC command. Follow a scheduled job with job.get, the long poll job.watch (POST /v1/job/watch), or the server-sent events of GET /v1/job/events?job_id=, which resume from Last-Event-ID; the web job page uses job.watch. job.cancel stops a running collection between collector steps (the job ends FAILED with CANCELLED, and the next run resumes from the collector's durable phase, D-285).

SwitchDefaultBehaviour
Per-repository deletion flagoff (mark-only)Off: candidates are counted, nothing is deleted. The same flag gates orphan deletion in storage reconcile and deletion of retired segments in compaction. The doctor's collector check warns while it is off. Destructive collection stays opt-in per repository until the fault tests are independently reviewed (T074)
Anomaly guardalways onAn INTEGRITY_ERROR in the collection start, root scan, marking, sweep or delete step, or a reachable object that cannot be read, turns the deletion flag off before the error is reported. It stays off until an administrator re-enables it. A reachable object that is quarantined (or whose loss was accepted) is not an anomaly: see below
Store outageSTORAGE_DEGRADED stops marking or scrub with a retryable error and does not disable deletion
Purged repositoriesThe purge turns deletion on for the deleted repository itself and runs its own collections (section 9); after it finishes nothing of the repository is left to collect
Grace period72 hChangeable only with tjetd --dev --gc-grace-ms (testing). tjet-worker always uses 72 h

Before re-enabling deletion after an anomaly, follow the integrity-error runbook and the gc-safety runbook. Every change of the flag, by admin.gc or by the anomaly guard, writes a hash-chained audit.gc_deletion_changed repository audit event with the actor, the new and the previous value; tjet-admin repo purge-resume writes it with reason purge.resume. Spec 12 §4 also asks that a backup or GC safety failure disable deletion automatically, and 12 §7 asks for a shadow collector before re-enabling. Neither is implemented.

Quarantined content. A reachable object whose stored bytes failed verification (scrub or compaction quarantined it) does not stop collection and does not turn deletion off. The collector completes it as a tainted leaf, taints everything that reaches it, and keeps all of it; other garbage is collected as usual. Every root activation the barrier verifies (during DRAIN, SWEEP or RETIRE; while IDLE whenever the repository has a quarantined object, D-1021; for an operation that began while a collection ran or before the current epoch; for a release) is refused with CONTENT_GONE when its closure reaches quarantined content: landing on, opening a workspace on or releasing a revision whose history contains the object fails until it is repaired or its loss accepted. While anything is quarantined every phase is verified, so activations then pay a protection of the part of their closure the last or running collection has not marked. Reads of the object itself fail INTEGRITY_ERROR.

  • A quarantine of an object the running (or last) collection already marked restarts the collection at a new epoch and queues a gc.run job: the old epoch's marks could cover the object, and the collector has no index of who reaches what. Expect tjet_gc_restarts_total to rise with quarantines and the next run to start from MARK_OPEN.
  • An interior quarantined object (a file manifest, chunk tree, directory or revision) has children the collector can no longer read. The sweep then keeps every object marked in or after the object's last complete epoch (its floor), so collection continues, but garbage that died after that epoch waits until the object is repaired or its loss accepted.
  • Repair: a verified re-supply of the same bytes (any upload that carries the object), or a scrub that verifies the bytes again, makes it AVAILABLE; the next collection marks it normally. Its entry stays RESOLVED until a collection after the repair has completed , so a second failure keeps the first floor.
  • tjet-admin storage quarantined REPO lists the quarantine set: QUARANTINED, LOST (accepted loss, with who, when and why) and RESOLVED (repaired while a collection ran; dropped when the next one starts). The doctor's quarantine check warns while any object is quarantined.
  • tjet-admin storage accept-loss REPO --object ID --reason TEXT records the audited decision (audit.object_loss_accepted, with the acting principal) that a quarantined object cannot be repaired. It is then treated as gone: reads of it answer CONTENT_GONE, activations over revisions that reach it pass again (D-1021: the loss is accepted, releases included), the collector deletes its corrupt bytes once deletion is enabled, it holds no floor (what only it reached becomes garbage), and scrub no longer re-checks it. A verified re-supply still repairs it; an interior object must then come with what it reaches, or the re-supply is refused NEEDS_CONTENT naming the missing objects (D-1022..D-1024: the server walks what it reaches, as the barrier does; objects below a missing one are named once it is supplied). A repair while a collection runs makes that collection delete nothing. Nothing calls it automatically; run storage impact first. See the integrity-error runbook.

The expiry pass logs, counts (tjet_expiry_items_total{kind="rows_undecodable"}) and skips a root, upload or preparation row it cannot decode. Such a row is never retired, expired or removed, so a hold it may stand for stays live, and the collector's root scan still fails closed on it. A rising counter needs the integrity-error runbook.

Clock skew and postponed expiry

Every decision that retires or deletes on a wall-time deadline first compares this host's clock with the lease clock's recorded wall time. If they differ by more than 10 s, or the lease clock has no recent tick (a stalled clock and a skewed host cannot be told apart), the decision is postponed, never taken. Guarded: the expiry pass (root retirement, upload and preparation expiry), retention apply, quota --reconcile, the wall-time steps of maintenance (request expiry, outbox truncation, commit-marker sweep, finished-job, dead-letter and activity retention), the browser-login, device-login and ID-token marker sweeps, and claiming collection jobs. Exception approval and token expiry are request-time checks and are not guarded.

  • The direct commands (tjet-admin retention apply, tjet-admin quota --reconcile) fail RETRY_LATER "... postponed: this host's clock differs from the lease clock by more than 10 s (or the lease clock is stalled)".
  • In the worker and in maintenance the guarded steps are skipped and the rest runs. This is not a failed duty, and maintenance reports expiry_postponed: true.
  • Each postponement logs the warning "expiry decision postponed: host clock disagrees with the lease clock or the clock is stalled" (with decision, skew_ms, bound_ms) and increments tjet_expiry_postponed_total{decision} (expiry, retention, quota_reconcile, maintenance, worker). tjet_expiry_clock_skew_ms is the last measured difference. These metrics are exported by tjetd (including its in-process worker) and by a separate tjet-worker started with --metrics-listen. ScmExpiryPostponed alerts when postponements continue for 15 minutes.
  • The doctor's lease_clock check fails while the clock is stalled or the doctor's host disagrees with it by more than 10 s, and says that expiry decisions are postponed.

The fix is to correct the host's time synchronisation, or to get a tjetd ticking the lease clock again (see the lease-clock runbook). Postponed decisions are taken on the next pass after the clocks agree. A host whose clock agrees with a lease-clock owner that is skewed by the same amount is not detected (D-374 limitation).

9. Repository lifecycle: archive and staged delete

  • Archive. tjet repo archive NAME [--undo] makes a repository read-only. Every ordinary write is refused with ACCESS_DENIED "repository is archived", and so is every administrative write: access.put, repository role.put/role.revoke, stream.create, stream.policyPut, stream.archive, stack.rebase, webhook.create, webhook.update, webhook.rotate_secret, webhook.replay, retention.put (and tjet-admin retention set), retention.pin, the release operations and the exceptional actions (admin.exceptionRequest|Approve|Execute). An authorized exact retry of a request completed before the archive still returns its stored outcome. Not frozen: unarchive (repository.archive with archived: false), repository.delete (archiving first is not needed), retention.unpin (releasing a pin only shortens retention, and purge needs it), backup.create/verify/expire, admin.gc, and tenant-scope administration (token.issue, quota.put, group.put, principal.update, tenant role.put). Reads, retention passes and collection continue.
  • Delete. Use the web Settings page (Delete repository), tjet-admin repo delete --confirm NAME REPO, or tjet repo delete NAME --confirm NAME (the server asks to confirm it in the browser unless the sign-in is recent; a token never qualifies). It needs one organisation administrator, the exact name as confirmation, and no blocker: no complete or in-progress backup, active retention pin or legal hold, release pin, or certified or revoked release (RETAINED, with details.blockers). Archiving first is not needed.
  • Recovery window. The repository disappears at once and its name stays reserved; an organisation administrator restores it under Organisation > Recently deleted (repository.deletion.restore), the operator with tjet-admin repo restore-deleted ID, until [security] deletion_recovery_days (7 by default) have passed. Then the maintenance pass starts the permanent purge below. An organisation can require a second administrator's approval (organisation.deletionPolicy, needs 2 administrators); a pending request lapses after its expiry. tjet-admin repo purge-now ID --confirm NAME --reason TEXT starts the purge at once (legal or abuse cases; audited). Every step is audited and announced to the organisation's administrators. single_approver_purge is deprecated and ignored.
  • What the purge does. A permanent tombstone is written, the name is freed (a new repository gets a new UUID), the deletion is audited, and a purge job runs in the worker. Its phases are RETIRE (roots), UPLOADS (refunds), METADATA, GC (the purge enables destructive collection for this repository and runs the collector), CHECK (every catalogued object tombstoned), SEGMENTS (deletes the repository's segment files, in bounded batches), CONTENT and FINISH. tjet-admin repo tombstone REPOSITORY_ID shows its state, ending in DELETED. AWAITING_GC (content still live at CHECK) is re-queued automatically. Content is reclaimed only after the grace period.
  • A stopped purge. GC_DISABLED means deletion was off when the purge needed it: the anomaly guard (or an administrator) disabled it during GC or SEGMENTS, and the remaining segments are kept. It is not terminal. Investigate the anomaly (gc-safety runbook), then run tjet-admin repo purge-resume REPOSITORY_ID (tenant_admin of the tombstone's tenant). In one transaction it re-enables destructive collection for the deleted repository (audit.gc_deletion_changed, reason purge.resume), sets the phase back to GC, queues a purge attempt and records audit.repository_purge_resumed. A purge that is not stopped is shown unchanged, so a resend is harmless; a finished purge is NOT_FOUND. A new anomaly stops the purge again.
  • What stays. The tombstone and the audit history. A finished purge leaves no row in the repository's subspace and no segment file in its domain (D-341, superseding the D-153 "segment files stay"). Representations that were never catalogued, for example bytes stored by a write that the tombstone then refused, stay in the store: the purge has no inventory of them (D-341 limitation).

10. Backups, archives and restore

  • Native archive (tjet-admin export-native REPO OUT): a complete, re-verified NSCAR1 archive. This is the vendor-independent exit path (15 §1).
  • Backup (tjet-admin backup create --dir DIR [--fdb-tag TAG] REPO): an archive plus a metadata boundary plus a permanent retention pin on its content inventory. The backup ID is the request ID, so --request-id resumes it. Use backup list, backup verify (re-reads and checks the archive against its manifest and pin; run it at least daily) and backup expire --confirm ID (retires the backup's pin; a later verify of the expired backup is refused). Verify and expire are also API operations (backup.verify, backup.expire, the latter with its request id and confirm equal to the backup id) and per-row actions on the web Data page; expiry is audited as audit.backup_expired. Backups keep working in an archived repository. A backup or export interrupted by a crash resumes from durable sidecar files (<out>.nscar.plan, <out>.nscar.spool) to the identical archive when it is retried with the same request, as long as its export holds have more than 10 minutes left; otherwise it starts over. A full backup carries the retention policy, holds, exception records, webhooks (inactive, without secrets) and the activity feed. Secrets, sessions, tokens, uploads and search indexes are never exported.
  • Continuous FoundationDB backup (tjet-admin fdb-backup start|status|discontinue): a backup create --fdb-tag records the restorable FDB version at or after the boundary, and whether the backup directory is independent of the content store. The backup covers the cell's key range and its cell link, so fdbrestore into an empty cluster brings the installation back: the first tjet process relinks the cell (runbook fdb-restore). A continuous backup started before D-1759 lacks the link: restart it after upgrading. Whole-installation recovery drills are T079.
  • Starting during an outage: tjetd, tjet-worker and tjet-admin wait for a degraded cluster up to TJET_FDB_OPEN_WAIT_SECS (default 120 s), logging each failed attempt, and then exit 5. A cell whose directory entry, cell link and records disagree is refused at once ("cell link inconsistent"); tjet-admin doctor reports it as cell_link FAIL.
  • Restore goes into an isolated installation and activates read-only. Writes are enabled only after the designated stream heads and releases are compared and a new authority epoch is allocated. The full procedure, verified in this task, is the restore-drill runbook. Restores through the API (restore.prepare, import.native, tjet repo import) activate writable at once. Restored webhooks are inactive and have no secret. One that was registered with a scoped token restores unbound and delivers nothing until a stream administrator rotates its secret (webhook.rotate_secret), which binds it to the rotating credential.
  • Archive digests are not proof of authenticity. Archives are unsigned in F1. Frame checksums, the stream digest, the trailer digest and the inventory root detect corruption and truncation, but anyone who can write an archive can recompute them. Restore activation compares stream heads and release digests taken from the archive itself. If you need authenticity, get the expected head and release digests from the source installation over an authenticated channel, and compare them before you enable writes. Archive signing waits for an installation signing key (BLOCKED).
  • API archive operations (export.native with GET /v1/export/download, backup.create, PUT /v1/import/upload, import.native, restore.prepare) need [archives] dir.

The backups runbook covers the routine and the alerts.

11. Integrity checks and the doctor

Doctor

tjet-admin doctor [REPO], the API operation admin.doctor, and the web Data page all run the same checks. Each check is OK, WARN or FAIL. FAIL means the condition blocks production writes, and tjet-admin exits 1. WARN is advisory and does not change the exit code. Lag and backlog never fail.

  • Installation checks (need tenant_admin): schema, cell_epoch, fdb_cluster, lease_clock, storage (a 4 KiB put / verified read / checksum / delete probe; warns when no encryption is declared), durability (warns for SINGLE_HOST), outbox_lag_<consumer> (warns above 300 s), job_queue (warns above 1000 runnable jobs), quota, principal_home (D-1230: fails when a principal id is active in two tenants of the cell or a principal of this tenant lacks its home row; warns while the home backfill is pending or when this tenant holds inactive restored records of another tenant's principal ids) and archive_dir.
  • With a repository: also fdb, repository (warns when archived or read-only), streams, content, collector (warns while deletion is off), quarantine (warns while an object is quarantined, fails when the quarantine set is unreadable), scrub and reconcile (warn if never run, fail on failures or missing content).

Expected warnings on a development stack: fdb_cluster, storage and durability. tjet-admin has no archive-directory option, so its doctor also warns on archive_dir.

Storage integrity

  • tjet-admin storage scrub REPO [--max-objects N] reads objects and sealed segments through the verified path from a persistent cursor. A failing incarnation is quarantined (audit.object_quarantined), and its reads fail INTEGRITY_ERROR until a verified re-supply of the same bytes repairs it. Each scrub also re-reads up to N quarantined objects; one whose stored bytes verify again returns to AVAILABLE (audit.object_restored). If the store lists none of the repository's catalogued representations (an unmounted volume, a wrong bucket or prefix), the scrub stops with STORAGE_DEGRADED and quarantines nothing. With S3, only NoSuchKey means a missing object; a missing bucket or an access error is an outage.
  • tjet-admin storage reconcile REPO reports catalogued-but-missing objects (audited as a storage incident) and orphans. An orphan is deleted only after 48 hours, a fresh catalog re-check, and only with the deletion flag on.
  • tjet-admin storage impact REPO [--object ID]... lists the live roots that reach quarantined objects. complete: false means a lower bound.
  • tjet-admin storage quarantined REPO lists the repository's quarantine set, and tjet-admin storage accept-loss REPO --object ID --reason TEXT records that a quarantined object cannot be repaired (D-1018; section 8).
  • FoundationDB metadata tier. Scrub verifies FoundationDB-resident metadata values (stored checksum, plaintext length, identity) and quarantines failures like store representations; a FoundationDB outage stops it without verdicts. Reconcile checks the tier against its own key range: AVAILABLE metadata rows without their value are listed in missing, values without a row in meta_orphans (reported and audited, never deleted).
  • tjet-admin storage usage REPO reports the repository's FoundationDB key and value bytes by family, the metadata tier's exact counters (meta_tier_bytes, meta_tier_objects) and its AVAILABLE rows by object kind (meta_tier_rows_by_kind). It reads every key of the repository once: an administrative report, not a gauge.
  • tjet-admin storage meta-migrate REPO --to fdb|segments [--rows-per-pass N] [--max-passes N] [--cursor HEX] [--pause-ms MS] moves existing metadata objects between the content store and the FoundationDB tier in bounded, idempotent compare-and-set passes; it prints the totals and a cursor to resume from. raced rows changed during the pass and were left alone (run again); unreadable ones failed verification and were not moved.
  • INTEGRITY_ERROR is HTTP 500 with retry NEVER (client exit 6). STORAGE_DEGRADED is 503 with retry SAME_REQUEST (exit 5) and does not mean corruption.

Audit

tjet-admin audit-tenant [--limit N] (or audit.query) reads the tenant audit log. audit.query with repository_id reads one repository's audit.* events instead (needs audit_read on it); a page examines at most 4,096 entries, so it can be short or empty while next_cursor continues. tjet-admin audit-chain verify recomputes the hash-chained audit blocks of all shards and exits 1 on a modified, removed or inserted entry. Record the printed head digests outside FoundationDB. Maintenance seals new blocks automatically, and audit-chain seal forces it. This is tamper evidence only; signing is deferred (T078).

12. Observability

  • Metrics. Prometheus text from GET /metrics, only on the separate --metrics-listen listener. Bind it to a private interface. Labels carry aggregates only: route templates, status classes, error codes, pools, never repository IDs or paths. Each label family is capped at 512 series. The metric families, alert rules and Grafana dashboard are in deploy/production/observability/. A separate tjet-worker exports its worker metrics on its own --metrics-listen. Every exported family is listed there, and tools/checks/check_alerts.py (make alerts) fails when one is missing. Worker duty, repository duty and maintenance step failures, postponed expiry decisions, undecodable rows, scrub, store errors and S3 throttling, release action errors and admission refusals have alert rules and runbook sections. The Grafana dashboard has no panels for these families yet.
  • Trace IDs. Every API response carries x-tjet-trace-id (32 hex characters). On a success it equals meta.trace_id. Refused (4xx) requests are logged at info as "request refused" and failures (5xx) at warn as "request failed", with only trace_id, route template, method and status. Ask users for the trace ID and search the logs for it.
  • Correlation IDs. Answers about internal failures never include internal text such as a panic message, store keys, buckets, server paths or the identity provider's URLs. This covers INTERNAL_ERROR (for example a task that panicked), RETRY_LATER for an unavailable identity provider, and an archive that cannot be opened. INTERNAL_ERROR and the identity provider answer carry details.correlation_id, which also appears in the message. The log has the detail under the same correlation_id: "internal error" at error level, or "identity provider unavailable" at warn level. Content storage failures are logged at warn or error level as "content storage failure" or "stored content failed verification".
  • Logs. Plain-text tracing output to stderr, filtered by RUST_LOG (default info). There is no JSON log format and no OpenTelemetry export yet (T075).

13. Workspace daemon on user machines (tjet-agent)

tjet-agent runs once per OS user on a developer machine, never on a server. It listens only on a private local endpoint (a Unix socket in a 0700 directory, or a named pipe with a user-only DACL on Windows) and never on the network. The contract is spec/api/local-daemon.json.

  • Trust boundary. The OS user, not the calling program. Any process of that user may call the daemon. hello.client {name, role} is a label for the log and diagnostics: any process can claim any role, and it grants nothing.

  • Windows client identity. After a client's first frame the daemon reads its token through ImpersonateNamedPipeClient and answers nothing before that check. Refused: another user, anonymous connections (SECURITY_ANONYMOUS), restricted tokens, AppContainer processes, and processes below medium integrity. Identification level, which tjet uses, is accepted. Low-integrity and AppContainer processes are already stopped by the pipe itself, before the daemon sees them; the daemon checks anyway. These rules concern the process that opened the pipe: a handle it passes on to another process is the opener's decision.

  • Elevation (Windows).

    • The daemon refuses to run elevated ("refusing to run elevated", exit 2), and tjet daemon start in an elevated shell refuses too. Otherwise any unelevated program of the user could drive an elevated process.
    • --allow-elevated (tjet-agent --allow-elevated, tjet daemon start --allow-elevated) is accepted only where UAC is off: EnableLUA = 0 under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System (64-bit view), and this logon's token has no split (TokenElevationTypeDefault, so a changed but not yet rebooted setting does not count). An unreadable value counts as UAC on. With UAC on it is refused. It is a command-line flag only: no settings file can set it, because the user's unelevated programs can write the daemon's directories. An opted-in daemon can be driven by any program of the user. It makes the files it creates the user's and logs a warning at start. Autostart and installed units never pass it.
    • An elevated tjet with UAC on changes no workspace in-process: ACCESS_DENIED, "run this from a non-elevated shell". It routes save and sync to the user's unelevated daemon. This covers the workspace database, which it neither creates nor migrates. Reads still work. Opening a database may still create SQLite's transient -wal/-shm files. The reason: the user's unelevated programs could plant junctions in the directories it writes (workspace, .tjet, object cache, credential lock files, fork registry), and it would follow them as an administrator.
    • It writes in-process only with UAC off, or with --allow-elevated-writes on that command line (tjet --allow-elevated-writes save ...). The opt-in is a per-invocation flag on purpose: an environment variable could be planted for later processes by the user's unelevated programs. It then first makes what it creates the user's (its token's owner and default DACL, both read back) and works normally. Since DB-26 an elevated tjet or daemon follows no junction, symlink or other reparse point in the workspace root path, .tjet, the object store, the cache, the lock files, the credential store or the workspace registry: one planted there is refused (ACCESS_DENIED, "... is a junction or other reparse point; it was not followed and nothing was changed"). A workspace whose own path goes through a junction cannot be written elevated; use its real path. The opt-in's remaining risk: any unelevated program of the user can still drive what an elevated tjet does through files it reads (configuration, workspace contents). tjet prints a warning each time. Microsoft does not treat same-user UAC as a security boundary; this design still avoids giving unelevated programs an easy route.
    • On a machine with UAC off, a workspace under C:\ (outside the user profile) inherits Authenticated Users: Modify, so another local user could plant junctions in it. Keep workspaces in the user profile there. Since DB-22 the daemon refuses such a workspace (below), and since DB-26 no reparse point planted in it is followed.
    • If the ownership adjustment fails, the refusal above applies.
    • In that fallback, the object cache, credential lock files, the user config and the agent-fork registry may be created owned by Administrators. They stay usable, because their inherited ACL grants the user.
  • Only the user's own workspaces (D-1116, D-1270, DB-22). The daemon registers, serves and publishes a workspace only when its root, .tjet/, .tjet/workspace.json and .tjet/state.sqlite are owned by the user and nobody else can write them:

    • Unix: owned by the user; not writable by others; not writable by the group unless the group is the user's private group (the primary group named like the user, with no other member, as Debian and Ubuntu create with umask 002) and the file has no POSIX ACL. On macOS also no ACL entry (ls -le) allowing anybody else to write or delete. The database's state.sqlite-wal and -shm are checked too. tjet workspace open creates .tjet/ as 0700, and tjet workspace bind makes an existing one 0700.
    • When the daemon cannot look (an LDAP/NSS lookup or an attribute read failed), the operation is RETRY_LATER {reason: workspace_unverifiable} and the workspace stays registered.
    • Windows: owned by the user's SID (not by Administrators); no write grant to anybody but the user, LocalSystem and Administrators. A workspace under C:\ outside the user profile usually inherits Authenticated Users: Modify and is refused: keep workspaces in the profile, or remove that grant.
    • Otherwise every operation on it is ACCESS_DENIED {reason: workspace_not_owned}, naming the path and why, and a watched workspace that stops qualifying is no longer watched. Nothing is "fixed" automatically; the owner fixes the mode or ACL and runs tjet status.
  • Background publishing as the bound account only. Each workspace is bound to one account (server and principal). tjet workspace open binds it to the account it was opened with. The binding is kept in .tjet/workspace.json, in the daemon's registry (workspaces.json in its state directory) and in .tjet/state.sqlite, with a random nonce, and the daemon publishes checkpoints saved with --remote only when all three agree, with exactly that account's stored login (never the server's other logins).

    • Workspaces opened before this release, .tjet/ directories restored from a backup or extracted from an archive, and a workspace rewritten by an older tjet are unbound: background publishing pauses for them, and tjet status says why. tjet workspace bind (or --account PRINCIPAL for another stored login), or an interactive tjet sync, binds them and prints "bound to <principal> on <server>".
    • An older daemon rewrites its registry without the bindings: after a downgrade every workspace needs tjet workspace bind again.
    • A remote mark (save --remote) through the daemon over protocol 4 carries the caller's authorization and must name the bound principal. When the daemon cannot verify it (the server is unreachable and no login of that account is stored), the mark is recorded unverified: background sync never publishes it, and tjet says that tjet sync does . A mark made without attribution (an older client, protocol 3, tjet without a daemon) publishes only as the bound account; a mark verified for another account (made before a rebind) waits, and tjet status says why; tjet checkpoint unmark-remote ID drops such a mark.
    • Interactive tjet sync and tjet save --remote publish a bound workspace as the bound account: with its stored login, or with an explicit credential (TJET_TOKEN, --token-fd) of that account. Another account's credential is refused unless --as-other-account is given, and then tjet says "this workspace is bound to A; publishing as B". tjet-agent --refuse-protocol3-remote-marks also refuses marks from older clients (off by default).
  • Bounds (D-1108, DB-02). Published in x-limits:

    BoundLimitBeyond it
    Connections held256One RETRY_LATER answer, details {limit: "connections", max: 256}, then the connection closes
    Parked changes long-polls64RETRY_LATER, details {limit: "long_polls", max: 64}
    hello not finished10 s after connectingClosed without an answer
    A frame not finished10 s after its first byteClosed without an answer
    A response not taken10 sClosed
    Event streams (protocol 4, DB-04)64, apart from the 256 connectionsRETRY_LATER, details {limit: "subscriptions", max: 64}
    Roots one stream watches256BUDGET_EXCEEDED, details {limit: "roots", max: 256}
    Events queued per stream4,096 path events or 4 MiBThe roots with the most queued events lose them to one reset {reason: overflow} each
    An event frame not taken10 sThe stream ends and its connection closes (event_write_timeout)
    No ack from the subscriber2 heartbeat intervals (30 s)The stream ends (ack_timeout)
    64 streams held and a new subscribe—The stream whose last ack is oldest, if older than 1.5 heartbeat intervals, is ended (subscription_evicted); else RETRY_LATER
    A frame sent on a stream4 KiBINVALID_ARGUMENT, the stream ends

    A frame before hello is at most 64 KiB. A connection that finished hello may stay idle until the limit is reached. A refusal at the limit then closes every connection that has waited at least 10 s for its next request (idle_reclaimed), so idle holders cannot keep every slot. tjet reports a connection-limit refusal as "the workspace daemon is busy" (RETRY_LATER). On Unix the daemon raises its open-file limit to 4096 (within the hard limit) so that 256 connections fit: macOS starts processes with 256. tjet raises its own to 1024 the same way (D-1490; 1024 so that the programs it starts never inherit more than select() can take). Neither depends on it: a workspace open, include, update, restore or upload holds a bounded number of descriptors whatever the size of the tree, and tjet is tested with a hard limit of 128. Operations on many files issue their flushes as concurrent rounds on up to an eighth of the soft limit (at most 128) threads, so a lower soft limit means fewer flushes at once and longer operations, never weaker durability; with the default limits an open, update or restore of 1340 files peaked at about 200 descriptors.

  • Event streams (protocol 4). A desktop app subscribes on a connection of its own (subscribe) and receives pushed events: path changes, the workspace state, watcher health, heartbeats every 15 s of silence, and daemon {stopping} on shutdown. No daemon operation ever waits for a subscriber: a slow one loses queued events to a per-root reset (it then re-queries that workspace), and one that takes nothing for 10 s is cut off. The idle shutdown waits while a stream is open. A subscriber acknowledges what it read at least every two heartbeat intervals; a frozen one loses its stream. A file-manager extension that cannot hold a connection open keeps using the changes long-poll. If the daemon's event producer fails, every stream ends with reset {reason: producer} (logged as "the event producer failed") and clients resubscribe.

  • Status tree (protocol 4, DB-08). The desktop app's tree view asks status_tree {root, dir, depth, cursor, limit}: one page of a registered workspace's entries below dir, depth first (depth 1..4), each with its state and, for folders, the counts of what tjet status lists below it. A page holds at most 1,000 entries (500 by default) and at most 4 MiB, so a folder of 100,000 changed files is paged and never answered BUDGET_EXCEEDED (flat status still is, above the 16 MiB frame). The first page of a listing reconciles when the workspace is free (or, within 1 s of the last reconciliation and with nothing changed since, answers from it); while an operation holds it, and for every later page, the daemon answers from its published snapshot: a file changed since is never shown clean, a file an update is replacing never deleted (it is unknown or not_materialized, and counted in_flight), and a folder's counts are marked counts_exact: false when they cannot be vouched for. A cursor continues the snapshot generation it came from; generations are kept for live cursors (the current one plus 4, each for 30 s), after which a cursor answers restart: true with the first page again. The app refreshes folders above the paths of path_changes events, and pages older than the state_generation of a workspace_state event. A read never registers a workspace. TJET_AGENT_GENERATION_TTL_MS shortens the 30 s for tests and diagnostics only.

  • Workspace inventory and local history (protocol 4, DB-06). workspaces lists the workspaces on this machine: those tjet workspace list names (the per-user registry) and those the daemon watches, each with its record, binding and the bound account's login state (never a token), in pages of at most 200. A workspace that was deleted or replaced stays listed as missing or replaced (also by tjet workspace list) until tjet workspace close --expired forgets it; a workspace another user may write is listed as not_owned and nothing of it is read. workspace_info {root} answers a registered workspace's record, binding, synchronization queue and pending remote marks with why each waits (for example "verified for another account than the bound one"); checkpoints {root} pages the local history newest first (at most 1,000 a page) and checkpoint_show {root, checkpoint} shows one checkpoint with its message. A checkpoint id is looked up only in that workspace: another workspace's, or any other object's, is not found. These reads never register a workspace and never wait for a running operation.

  • Local diff and content by path (protocol 4, DB-07). The desktop app shows a registered workspace's diff with diff {root, paths?, against: base|head, text, cursor, limit} (against the base it answers what tjet diff --json answers; against the head, what is not saved yet), in pages of at most 1,000 records and 4 MiB, and file content with file_read {root, path, side: working|head|base, offset, length}, at most 4 MiB a page. Content is named by workspace, path and side, never by an object id or a hash. The working file is opened from the workspace root one folder at a time without following a symlink or junction: a link at the path is shown as a link (its target), never followed; a link above it makes the path absent; a folder or junction swapped in between two pages is refused. The .tjet folder is never read, under any spelling or alias (an 8.3 short name, a link, a hard link to one of its files). The head and base come from the workspace's own objects; what is not local (a fresh workspace's base bytes until tjet workspace pin --offline, a path outside a sparse view, a file that is not materialized) is NEEDS_CONTENT naming the path, the revision and the missing objects, never empty content. A binary file is summarised (size, kind), never sent. At most 8 pages are made at once; a workspace held by an operation answers RETRY_LATER {reason: busy}. These reads never register a workspace.

  • Refusal counters. Each refusal or close by a bound is counted by reason: connections, connections_unanswered (more than 64 refusals at once), idle_reclaimed, long_polls, hello_timeout, frame_timeout, write_timeout, subscriptions (a stream refused at 64), event_write_timeout (a stream cut off), ack_timeout, subscription_evicted, and peer_other_user, peer_anonymous, peer_below_identification, peer_restricted, peer_low_integrity, peer_app_container, peer_unidentified, peer_test_hook, and (DB-07) content_path_refused (a diff or file_read path that is not a repository path of this host, .tjet under any spelling, or a private name) and content_metadata_refused (a read reaching the metadata directory by identity: an alias or a hard link to one of its files), and link_symlink, link_reparse_point, link_multiple_links, link_not_a_file and link_replaced (a workspace or per-user path refused for a link). The first refusal of each reason is logged at warn ("ipc refusal", with reason and total), then at most one line per reason every 10 s. The totals are logged at info when the daemon stops ("ipc refusals: connections=N ..."). Protocol 4's metrics (and info.metrics) reports them, every reason with zeros included (DB-23).

  • Telemetry, logs, crash records and diagnostics (DB-23). Everything stays on the machine; there is no upload path.

    • metrics (protocol 4): latency histograms per operation (buckets up to 1, 2, 5, ... 30,000 ms and one beyond), connections, subscriptions and long-polls against their bounds, refusals by reason, event queue depth (now, the fullest queue, the high-water mark), overflows and resets by reason (overflow, watcher, restart, producer), long operations by outcome, login refreshes and refresh-lock waits (DB-00), background sync rounds by outcome, each workspace's snapshot generation, age and overlay, panics and the last crash record, and the log's size and rotations. No token, no file contents.
    • The log. Started by tjet daemon start (--detach) or with --log-file, the daemon writes agent.log in its state directory, rotated before it would pass 10 MiB, keeping agent.log.1 .. agent.log.4 (50 MiB at most on every OS); its standard error points at the current file. Every line passes the secret redaction (server tokens nscm_*_, bearer values, JWTs, credential fields, credentials in URLs, private keys) before it is written, whatever TJET_AGENT_LOG enables. Paths are logged as they are (the log is the user's own, 0600 in a 0700 directory); the bundle hashes them. Started in the foreground without --log-file, the daemon logs to standard error as before.
    • Crash records. A panic of tjet-agent or tjet writes crashes/crash-<ms>-<pid>-<n>.json in the daemon's state directory (version, build, OS, thread, location, the message and backtrace redacted of secrets; at most 5 per process and 20 kept). The daemon logs one redacted line for it. A panic answering one request ends that request's connection only; one on the daemon's main thread ends the process with exit code 101, never an abort (no OS crash dialog or report). info.last_crash names the newest record, for the app to show on its next start. Windows minidumps are not written.
    • tjet daemon diagnose (also tjet diagnostics) [--output DIR] [--include-paths] writes tjet-diagnostics-<UTC time>/ for the user to review: README.txt, manifest.json, system.json (OS, build, the names of SRC_*/NSCM_*/XDG_* variables, never values), daemon.json (hello, info, metrics: workspaces with their watcher and qualification), logs/, crashes/, settings/ (settings.toml, config.toml). Never the stored logins or the OS credential store (not read) or file contents. Without --include-paths absolute paths become <path:hash> (salted per bundle; a Rust source location keeps its file name) and debug and trace log lines are left out. A file that still holds a secret after redaction stops the command (INTEGRITY_ERROR) and nothing is written. Nothing is sent.

14. Verified in this task

On 2026-10-19 these commands ran against an isolated development installation on the dev FoundationDB cluster, with exit 0 unless stated otherwise (details in records/evidence/T069.json):

  • tjet-admin doctor: ok: true, with WARN for fdb_cluster, storage, durability and archive_dir as expected.
  • cell status, quota, retention show.
  • backup create --dir, then backup verify: COMPLETE, pin active.
  • The restore drill into a second, fresh installation: bootstrap-tenant, restore (state READ_ONLY, integrity ok), restore-status, restore-verify (ok), restore-activate --confirm wrong (exit 1, INVALID_ARGUMENT), restore-activate --confirm NAME (ACTIVE, authority epoch 1 → 2, unbound_principals listed), a repeat (changed: false), and principal-bind.
  • import-git --preflight-only, import-git and import-report on a 4-commit sample, plus tools/dev/git_import_smoke.sh (see the migration guide).

The other commands and settings on this page come from code and decisions. This task did not run them; their own tests cover them, as cited in the decisions.

Incremental mark-only GC and background work budgets

tjetd and tjet-worker accept --gc-full-interval-ms / TJET_GC_FULL_INTERVAL_MS (default 604800000), --gc-mark-objects-per-s / TJET_GC_MARK_OBJECTS_PER_S (default 4000), and --background-scan-rows-per-s / TJET_BACKGROUND_SCAN_ROWS_PER_S (default 20000). Rate limits are per process; zero removes that limiter. Interval zero forces full collections. Incremental collections never delete; enabling deletion requires a full collection. Quarantine or purge invalidates the reusable base.

Only periodic worker jobs opt into incremental collection. Explicit admin.gc run and schedule retain full-or-resume semantics: they start a full epoch from IDLE, or finish an already-running epoch under its persisted mode. They never rewrite a running epoch's floor or automatically start a second epoch. An explicit run after that epoch finishes starts full.

For upgrade from a binary without D-1570, keep the new processes configured with interval zero until all serving and worker processes understand mark_floor. Older binaries cannot be configured with the new flag. Do not enable incremental epochs while an older process can encounter their state. For rollback, set zero on all new processes, let every running epoch finish to IDLE, then stop/replace them with older binaries. Do not rewrite GC records or clear queues to bypass an incompatible epoch. These steps describe the compatibility requirement; mixed-version P1 qualification remains a separate gate.

Scheduled retention scans default to 50,000 changes per pass (whole 200-row pages); large repositories can retain expired data longer while the cursor catches up. Scrub examines at most 20,000 object and segment catalog rows per call, in 128-row transactions, and the scheduled cycle rests seven days after its start once complete. An explicit scrub bypasses the rest. Before the first complete object cycle, oldest_unverified_age_known is false and oldest_unverified_age_ms is i64::MAX (unknown conservative bound), not a measured age. This deliberately keeps the age alert firing until a completed cycle supplies a trustworthy bound. Quarantine rechecks continue during rest. Backend-plausibility checking on corruption and full reconciliation remain potentially whole-catalog work. Monitor verified bytes, oldest-unverified age, failures and per-operation FDB counters; a quiet run does not prove coverage.

D-1584 pacing correction: marking reserves logical work before queue/walk reads, content fetches, expansion and completion. An object can consume multiple units, and unused reservations are conservative. Sweep reserves every bounded page, including its final page. Mark/sweep chunks fit the configured admission burst. The one-second credit is an admission budget, not a strict rolling-window cap on committed writes: waiting for concurrency slots, storage latency and internal FDB retries can make already-admitted operations finish together. Immediate-child and waiter fanout retain their existing per-operation bounds. This is neither a cap on every individual FDB key read nor a guarantee that no database can saturate.

D-1591: the mark pace applies only while no root was activated in the running epoch for 10 seconds (by the activating server's clock). While writers activate roots, MARK_OPEN must catch up with their enqueued roots and every second in DRAIN costs each write a protection walk, so marking then runs at full speed; an idle repository's full mark stays paced. tjet_gc_mark_unpaced_steps_total counts the marking steps that ran without the pace. All waits stay outside retryable transactions; those transactions retain their phase, epoch, floor, barrier and ambiguous-commit checks. A value of0 remains unlimited. Explicit low-level step APIs retain their existing bounded-step contract.