@tnunamak/dalan 0.0.0-stage → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/CONTRIBUTING.md +26 -0
  3. package/LICENSE +204 -0
  4. package/PROTOCOL.md +351 -0
  5. package/README.md +215 -2
  6. package/SECURITY.md +30 -0
  7. package/bin/dalan.mjs +43 -0
  8. package/bin/dot-acp-agent.mjs +377 -0
  9. package/bin/dot-alert.mjs +9 -0
  10. package/bin/dot-deadman.mjs +82 -0
  11. package/bin/dot-heartbeat.mjs +29 -0
  12. package/bin/dot-pr-reviewer.mjs +32 -0
  13. package/bin/dot-worker.mjs +764 -0
  14. package/docs/chatgpt-worker-onboarding.md +112 -0
  15. package/docs/claude-worker-onboarding.md +113 -0
  16. package/docs/codex-to-muse.md +175 -0
  17. package/docs/connect-chatgpt.md +83 -0
  18. package/docs/connection-longevity.md +43 -0
  19. package/docs/dalan-upgrade.md +246 -0
  20. package/docs/deadman.md +61 -0
  21. package/docs/dot-pr-reviewer.config.example.json +9 -0
  22. package/docs/durability-audit.md +27 -0
  23. package/docs/keycloak-client-chatgpt-dot-bridge.json +59 -0
  24. package/docs/keycloak-oauth-setup.md +30 -0
  25. package/docs/local-agent-mcp.md +41 -0
  26. package/docs/manual-setup.md +135 -0
  27. package/docs/mirror-fetch.md +97 -0
  28. package/docs/operations.md +799 -0
  29. package/docs/operator-duties.md +68 -0
  30. package/docs/owner-integrator.md +27 -0
  31. package/docs/portable-auth-profile.md +107 -0
  32. package/docs/pr-head-reviewer.md +70 -0
  33. package/docs/pr-preflight.md +28 -0
  34. package/docs/pull-queue.md +131 -0
  35. package/docs/pull-workers.md +94 -0
  36. package/docs/redaction.md +27 -0
  37. package/docs/service-setup.md +219 -0
  38. package/docs/setup-reference.md +80 -0
  39. package/docs/t3-connector-icon.png +0 -0
  40. package/docs/t3-integration.md +51 -0
  41. package/docs/t3-result-retry-delivery.md +41 -0
  42. package/docs/t3-reverse-control.md +107 -0
  43. package/docs/usage.md +443 -0
  44. package/docs/worker-clients.md +290 -0
  45. package/integrations/t3/acp-kit/src/capability.mjs +25 -0
  46. package/integrations/t3/acp-kit/src/errors.mjs +13 -0
  47. package/integrations/t3/acp-kit/src/index.mjs +5 -0
  48. package/integrations/t3/acp-kit/src/lock.mjs +155 -0
  49. package/integrations/t3/acp-kit/src/session-store.mjs +36 -0
  50. package/integrations/t3/acp-kit/src/t3-envelope.mjs +62 -0
  51. package/package.json +67 -4
  52. package/packages/job-core/README.md +18 -0
  53. package/packages/job-core/index.mjs +2 -0
  54. package/packages/job-core/package.json +8 -0
  55. package/packages/job-core/protocol/canonical.mjs +11 -0
  56. package/packages/job-core/protocol/v0/command.schema.json +1154 -0
  57. package/packages/job-core/protocol/v0/event.schema.json +77 -0
  58. package/packages/job-core/protocol/v0/reply.schema.json +59 -0
  59. package/packages/job-core/transitions.mjs +25 -0
  60. package/scripts/daily-selfcheck.mjs +135 -0
  61. package/scripts/dalan-try-selfcheck.mjs +29 -0
  62. package/scripts/lib/expose-tailscale.mjs +408 -0
  63. package/scripts/live-trial/common.mjs +272 -0
  64. package/scripts/monitor-targets.mjs +44 -0
  65. package/scripts/upgrade-drain.mjs +39 -0
  66. package/scripts/worker-bridge-setup.mjs +925 -0
  67. package/src/ack-ledger.mjs +37 -0
  68. package/src/acp-bridge.mjs +418 -0
  69. package/src/acp-context.mjs +138 -0
  70. package/src/admin-socket.mjs +14 -0
  71. package/src/alerts.mjs +147 -0
  72. package/src/artifact-journal.mjs +75 -0
  73. package/src/as-files.mjs +347 -0
  74. package/src/as-store.mjs +456 -0
  75. package/src/as.mjs +538 -0
  76. package/src/auth.mjs +166 -0
  77. package/src/builtin-http.mjs +22 -0
  78. package/src/check-coverage.mjs +38 -0
  79. package/src/check-lint.mjs +88 -0
  80. package/src/check-readiness.mjs +112 -0
  81. package/src/check-response.mjs +19 -0
  82. package/src/child-exit.mjs +18 -0
  83. package/src/child-registry.mjs +94 -0
  84. package/src/claim-command-ledger.mjs +51 -0
  85. package/src/cli-help.mjs +186 -0
  86. package/src/cli-name.mjs +16 -0
  87. package/src/connect-cli.mjs +126 -0
  88. package/src/consumers.mjs +61 -0
  89. package/src/deadman.mjs +329 -0
  90. package/src/delivery.mjs +19 -0
  91. package/src/demo-worker.mjs +150 -0
  92. package/src/destinations/index.mjs +23 -0
  93. package/src/destinations/none.mjs +15 -0
  94. package/src/destinations/t3.mjs +109 -0
  95. package/src/diagnostic.mjs +78 -0
  96. package/src/docs-url.mjs +9 -0
  97. package/src/drain-runner.mjs +9 -0
  98. package/src/drained-owner.mjs +26 -0
  99. package/src/drained-slot.mjs +70 -0
  100. package/src/drained.mjs +40 -0
  101. package/src/durable-waiters.mjs +236 -0
  102. package/src/env.mjs +19 -0
  103. package/src/execution.mjs +112 -0
  104. package/src/failure-type.mjs +28 -0
  105. package/src/get-summary.mjs +32 -0
  106. package/src/git-env.mjs +15 -0
  107. package/src/host-budget-receipts.mjs +154 -0
  108. package/src/host-budget-seccomp.py +33 -0
  109. package/src/host-budget-service.mjs +54 -0
  110. package/src/host-budget-stop.mjs +26 -0
  111. package/src/host-budget-storage.py +259 -0
  112. package/src/host-budget.mjs +149 -0
  113. package/src/host-cgroup.mjs +23 -0
  114. package/src/host-check-allowlist.mjs +42 -0
  115. package/src/host-execution-policy.mjs +38 -0
  116. package/src/host-health.mjs +34 -0
  117. package/src/host-stop-reverify.mjs +44 -0
  118. package/src/inbox.mjs +55 -0
  119. package/src/integrator.mjs +322 -0
  120. package/src/job-retention.mjs +69 -0
  121. package/src/legacy-names.mjs +8 -0
  122. package/src/lifecycle.mjs +291 -0
  123. package/src/limits.mjs +31 -0
  124. package/src/loopback.mjs +9 -0
  125. package/src/mcp-outcome.mjs +79 -0
  126. package/src/mcp-sse.mjs +62 -0
  127. package/src/mcp-stdio.mjs +191 -0
  128. package/src/mirror-fetch-lock.py +164 -0
  129. package/src/mirror-fetch.mjs +174 -0
  130. package/src/notify-ledger.mjs +82 -0
  131. package/src/objectives.mjs +129 -0
  132. package/src/owner-report-artifact.mjs +66 -0
  133. package/src/patch-apply.mjs +84 -0
  134. package/src/path-syntax.mjs +16 -0
  135. package/src/paths.mjs +67 -0
  136. package/src/pr-head-reviewer.mjs +596 -0
  137. package/src/pr-preflight.mjs +51 -0
  138. package/src/prepared-node-modules.mjs +129 -0
  139. package/src/process-inspection.mjs +36 -0
  140. package/src/projects.mjs +480 -0
  141. package/src/protocol-artifact-commands.mjs +52 -0
  142. package/src/protocol-delivery-driver.mjs +167 -0
  143. package/src/protocol-finish.mjs +100 -0
  144. package/src/protocol-owner-command.mjs +35 -0
  145. package/src/protocol-owner-mutations.mjs +22 -0
  146. package/src/protocol-owner-waiters.mjs +67 -0
  147. package/src/protocol-retention.mjs +52 -0
  148. package/src/protocol-services.mjs +61 -0
  149. package/src/protocol-stop-observer.mjs +131 -0
  150. package/src/publish-plan.mjs +245 -0
  151. package/src/pull-queue.mjs +159 -0
  152. package/src/redaction.mjs +763 -0
  153. package/src/rejections.mjs +18 -0
  154. package/src/request-log.mjs +102 -0
  155. package/src/restore-check.mjs +90 -0
  156. package/src/result-binding.mjs +65 -0
  157. package/src/route-setting.mjs +24 -0
  158. package/src/runtime-check.mjs +13 -0
  159. package/src/sandbox-supervisor.mjs +105 -0
  160. package/src/schema-subset.mjs +186 -0
  161. package/src/scopes.mjs +15 -0
  162. package/src/server.mjs +1468 -0
  163. package/src/service-migrate-workers.mjs +113 -0
  164. package/src/service.mjs +388 -0
  165. package/src/setup.mjs +63 -0
  166. package/src/shutdown-signal.mjs +12 -0
  167. package/src/signal-sandbox-processes.py +56 -0
  168. package/src/signal.mjs +119 -0
  169. package/src/status-evidence.mjs +47 -0
  170. package/src/status-summary.mjs +54 -0
  171. package/src/store.mjs +3069 -0
  172. package/src/submission-policy.mjs +623 -0
  173. package/src/subscription-storage.mjs +64 -0
  174. package/src/t3-audit.mjs +120 -0
  175. package/src/t3-control.mjs +102 -0
  176. package/src/t3-transport.mjs +158 -0
  177. package/src/t3.mjs +209 -0
  178. package/src/terminal-safe.mjs +19 -0
  179. package/src/tool-registry.mjs +453 -0
  180. package/src/try-command.mjs +11 -0
  181. package/src/try-exposure.mjs +908 -0
  182. package/src/try-hosted-clients.mjs +46 -0
  183. package/src/try-hosted.mjs +444 -0
  184. package/src/try-selfcheck.mjs +168 -0
  185. package/src/try.mjs +635 -0
  186. package/src/webhooks.mjs +86 -0
  187. package/src/work-order.mjs +265 -0
  188. package/src/worker-instructions.mjs +26 -0
  189. package/src/worker-prompt.mjs +4 -0
  190. package/src/workers.mjs +632 -0
  191. package/src/workspace.mjs +1065 -0
  192. package/systemd/dot-bridge-heartbeat.service +18 -0
  193. package/systemd/dot-bridge-heartbeat.timer +10 -0
  194. package/systemd/dot-bridge-selfcheck.service +12 -0
  195. package/systemd/dot-bridge-selfcheck.timer +11 -0
  196. package/systemd/dot-bridge.service +17 -0
  197. package/systemd/dot-deadman.service +30 -0
  198. package/systemd/dot-pr-reviewer.service +11 -0
  199. package/systemd/dot-pr-reviewer.timer +10 -0
@@ -0,0 +1,68 @@
1
+ # Dalan operator duties
2
+
3
+ This is a checklist of operator responsibilities, not another operating manual. Follow [operations](operations.md) for procedures and [the Dalan upgrade guide](dalan-upgrade.md) for command, setting and path compatibility. Use the service's HOME and environment when checking an installation.
4
+
5
+ Each duty names a command or registered test, its source, and the limits of that evidence. A test name is an entry point, not a claim that it passed on this host. From a source checkout installed with `npm ci`, run `node scripts/operator-duties-test.mjs` for this document's structural check; the npm package does not include that script. The check reads repository files only, validates cited files, links, CLI forms and suite registrations, and executes none of the cited commands. It does not prove operational readiness or the semantic completeness of a regression test.
6
+
7
+ ## Backup and restore
8
+
9
+ - **Duty:** Keep a consistent, stopped-service recovery set, including the required keys, receipts, artifact ownership/bytes and positive delivery-ACK evidence. Exclude the local ownership lock files and preserve private permissions; follow the linked inventory rather than copying an entire state directory blindly.
10
+ - **Check:** `dalan paths --json` identifies the effective roots for the inventory; `node scripts/worker-isolation-test.mjs` is the backup and rollback regression test.
11
+ - **Gap:** Root discovery and a local fixture are not a scheduled backup, an age check or a second-host restore drill. A database-only snapshot is incomplete; an older ACK snapshot can lose proof of accepted notices and permit duplicates.
12
+ - **Source:** [Backup and operational rollback](operations.md#backup-and-operational-rollback), [upgrade and rollback](operations.md#upgrade-and-rollback).
13
+
14
+ ## Key and token rotation
15
+
16
+ - **Duty:** Follow the built-in authorization server's stopped-service ownership procedure for `dalan as-rotate-keys`. Keep signing, cookie and storage keys private, and plan separately for replacement of other exposed credentials.
17
+ - **Check:** `node scripts/builtin-as-owner-test.mjs` covers ownership and key rotation.
18
+ - **Gap:** The AS rotation command is not a rotation of every deployment credential. A fixture does not establish the operator's rotation schedule or verify recovery from a real credential exposure.
19
+ - **Source:** [Authorization-server ownership](operations.md#built-in-authorization-server-ownership), [CLI implementation](../bin/dot-worker.mjs).
20
+
21
+ ## Upgrades and migrations
22
+
23
+ - **Duty:** Read release/operator notes, take a compatible stopped-service backup, and keep a reviewed rollback path. Never lower the database schema version by hand. Use Dalan names while respecting existing legacy roots and setting fallbacks; path migration is explicit, not an automatic rename.
24
+ - **Check:** After the planned upgrade, inspect `dalan paths --json`, `dalan status --json` and `dalan doctor --json`; `node scripts/migration-atomicity-test.mjs` covers migrations.
25
+ - **Gap:** Doctor reports local executor declarations and repository policy, not a successful live worker job. Fixtures do not establish that every historical schema or the actual deployment was upgraded correctly; perform the authenticated smoke job in the upgrade guide.
26
+ - **Source:** [Versions and upgrades](operations.md#versions-and-upgrades), [Dalan upgrade guide](dalan-upgrade.md), [schema guard and migrations](../src/store.mjs), [doctor implementation](../bin/dot-worker.mjs).
27
+
28
+ ## Retention and deletion
29
+
30
+ - **Duty:** Track retention separately for protocol jobs, lifecycle history, logs, artifacts and other deployment state. Protocol job retention has an explicit cutoff and durable logical tombstone/fence; purge is deferred until native state is terminal and compute is confirmed stopped. Do not describe it as secure byte erasure.
31
+ - **Check:** `node scripts/job-retention-test.mjs` and `node scripts/protocol-retention-test.mjs` cover retention.
32
+ - **Gap:** The helper retains audit evidence and can leave purge pending. Its existence is not a universal retention window, requester-wide deletion operation, or proof that every backup and external copy has been erased.
33
+ - **Source:** [Retention helper](../src/job-retention.mjs), [protocol retention admission](../src/store.mjs), [lifecycle retention](operations.md#lifecycle-events-and-metrics), [artifact/worktree retention](operations.md#github-workspaces).
34
+
35
+ ## Incident response
36
+
37
+ - **Duty:** Use the documented pause, claim and delivery-reconciliation procedures when intervention is needed. Pause prevents new claims and outbound notices; cancellation or abandonment must not be mistaken for proof that remote computation stopped. Preserve unknown-delivery evidence instead of assuming a retry is safe.
38
+ - **Check:** `dalan status --json` shows pause/delivery state; `dalan claims --json` shows active grants and delivery gates. `node scripts/claims-admin-e2e.mjs` covers claim administration.
39
+ - **Gap:** A bridge authority change is not remote process-stop evidence, and a stored alert is not proof that a person received it. Rehearse the deployment's response and escalation procedure separately.
40
+ - **Source:** [Recovery and operation](operations.md#recovery-and-operation), [claims and leases](operations.md#claims-and-leases).
41
+
42
+ ## Capacity
43
+
44
+ - **Duty:** Review the effective claim cap and its recorded worker/subject lanes, and keep artifact/workspace storage within the host's capacity. Do not confuse the utilization denominator with the claim cap, or usage estimates with enforced limits.
45
+ - **Check:** `dalan status --json` exposes the active cap and usage state; `dalan doctor --json` reports local executor readiness and declared capabilities.
46
+ - **Gap:** These observations do not prove sustained-load capacity, disk headroom or a successful host check. Disabled/unsupported execution is not a passing check.
47
+ - **Source:** [Workspaces and claim capacity](operations.md#github-workspaces), [usage estimates](operations.md#usage-breaks-and-usage-estimates), [executor evidence](operations.md#execution-capability-and-check-evidence), [CLI implementation](../bin/dot-worker.mjs).
48
+
49
+ ## Abuse handling
50
+
51
+ - **Duty:** Admit repository work only for exact worker repository grants. A missing profile, omitted list or empty list denies repository jobs; legacy identity recovery does not grant access. Tightening policy blocks new admission/claims but does not forcibly cancel already-valid grants.
52
+ - **Check:** `dalan worker list NAME --json` and `dalan doctor --json` expose effective repository policy. `node --test scripts/dalan-legacy-repos-test.mjs` covers the deny-by-default rule.
53
+ - **Gap:** A worker allow-list does not narrow the host GitHub credential. Verify that credential's least-privilege scope separately; policy inspection is not an external abuse-reporting channel.
54
+ - **Source:** [Repository access per worker](operations.md#repository-access-per-worker), [repository-policy upgrade](dalan-upgrade.md#repository-policy-requires-an-explicit-list).
55
+
56
+ ## Status and availability
57
+
58
+ - **Duty:** Inspect queue, subscription, lease and delivery state and respond to stalled work. Distinguish webhook transport acceptance, worker activity, terminal worker reports and owner acceptance.
59
+ - **Check:** `dalan status --json` and `dalan status --explain` provide the live bridge observations and their explanation.
60
+ - **Gap:** An event 2xx proves transport only, not worker wakeup or owner acceptance. Local status cannot establish off-host availability or that an alert reached a human; doctor is not a bridge liveness probe.
61
+ - **Source:** [Use and status](operations.md#use), [recovery and delivery evidence](operations.md#recovery-and-operation), [CLI implementation](../bin/dot-worker.mjs).
62
+
63
+ ## Identity and access
64
+
65
+ - **Duty:** Review approved worker connections and exact repository grants on an operator-defined schedule. Preserve verified identity bindings during upgrades, protect owner/operator capabilities, and keep service credentials separate from worker repository policy.
66
+ - **Check:** `dalan worker list NAME --json` checks current repository grants; `node scripts/auth-e2e.mjs` and `node scripts/builtin-as-e2e.mjs` cover authentication.
67
+ - **Gap:** Repository listing is not an audit of OAuth connection approval or token revocation. Regression fixtures do not perform the scheduled access review or verify the live service credential's scope.
68
+ - **Source:** [Worker identity](operations.md#worker-identity-and-rollback), [owner/operator capabilities](operations.md#use), [service GitHub access](operations.md#service-github-access).
@@ -0,0 +1,27 @@
1
+ # Owner-side patch verification
2
+
3
+ The owner-side verifier takes a sealed report patch and a local target ref. It creates a detached scratch worktree, applies the stored patch with the recorded digest and base SHA, and runs each evidence check through the `Workspace.runConfined` runner. Each check gets its own copy of the patched tree, so one check cannot alter the input to the next.
4
+
5
+ This is a reference for maintainers embedding the JavaScript API in `src/integrator.mjs`, not a standalone CLI walkthrough. For owner-facing patch review and application, start with the [requester reference](usage.md). To use the internal verifier:
6
+
7
+ 1. Call `loadSealedResult(store, requestId)` to read the sealed patch artifact and its recorded base SHA from the stored report. `Workspace.artifact()` checks the artifact byte length and SHA-256 before it returns the bytes.
8
+ 2. Call `verifySealedResult({store, sealedResult, repoDir, targetBaseRef})` with a local checkout that already contains the target ref. It accepts only a nonempty patch from an implementation-scope assignment that is not a review result; a read-only `output_paths` patch is rejected.
9
+ 3. Read the returned candidate and verification record, or query them later with `Store.getIntegrationCandidate()` and `Store.integrationVerifications()`.
10
+
11
+ `verifySealedResult()` validates the fields and patch digest of `sealedResult`, but it cannot authenticate an arbitrary caller's object. Pass only a result that `loadSealedResult()` loaded from the bridge Store.
12
+
13
+ The evidence plan contract (taken by `runEvidencePlan()`) is `{schema_version: 1, checks: [{id, argv, issuer, trust_profile}]}`. `verifySealedResult()` does not select an explicit plan from the stored assignment or the report; it always derives its plan from the project check definitions at the assignment's recorded base SHA. A repository check is labeled `repository-config`; an owner override is `owner-config`; a detected project check is labeled `repository:detected`. The runner records the declared issuer and trust profile alongside the observed exit, timeout, stop, output digest, and preview. A check is passed only when it exits with code zero, does not time out or cancel, and the sandbox reports a verified stop.
14
+
15
+ The verifier resolves refs from the local repository only. It does not fetch, use a credential, push, or make a network write. Checks use the `Workspace.runConfined` sandbox with networking disabled. The network-backed PR source freshness check in `src/pr-preflight.mjs` remains a separate operation because it requires a direct GitHub observation. A Git whitespace-policy rejection is recorded as `failed`; `conflict` is reserved for patch or base incompatibility.
16
+
17
+ The verifier stores patches up to 262,144 bytes, matching the workspace patch-apply limit. Before it inserts a candidate, the Store checks the patch bytes against their digest and rejects patches over that bound.
18
+
19
+ If the target SHA differs from the patch base SHA, the verifier creates a new candidate linked to an immutable original candidate. It never changes the original candidate's target. A patch that conflicts with the target is recorded as `conflict` and does not run checks. Each attempt marker is stored atomically with its candidate before checkout or checks; a completed result appends a second immutable verification record. If writing that final record fails, the function returns its in-memory result with top-level `verification_recorded: false` and `verification.recording_error`, while the interrupted attempt marker remains stored. Verification statuses are `verified`, `failed`, `conflict`, `skipped` (no check failed, but at least one was skipped) and `owner_approval_required` (the patch changes check inputs, so no check ran). Records include the candidate ID, patch digest, patch base SHA, target SHA and per-check issuer.
20
+
21
+ Scratch worktrees, per-check copies, and runner state stay under the integrator scratch root. They are left in place for inspection. The candidate's verified patch remains the sealed patch bytes plus the target SHA; the test runner's copies are evidence only.
22
+
23
+ From a source checkout installed with `npm ci`, run the focused segment below; its script is not included in the npm package:
24
+
25
+ ```sh
26
+ node scripts/integrator-verifier-test.mjs
27
+ ```
@@ -0,0 +1,107 @@
1
+ # Built-in authorization server: concrete profile
2
+
3
+ This guide describes the built-in authorization server and its connection flow. The goal is that an operator can connect a cloud worker (ChatGPT, Claude, Grok) to a bridge without a hosted identity provider or a homelab; external issuers stay supported.
4
+
5
+ Path examples use fresh-home defaults. For an existing installation, resolve the actual roots with `dalan paths --json`: populated legacy roots remain active, as the [upgrade guide](dalan-upgrade.md) describes.
6
+
7
+ In this guide, `<home>` means the bridge service's private home and `<config>` means `<home>/.config`. Resolve an existing installation's active roots with `dalan paths --json` rather than assuming these defaults.
8
+
9
+ ## Components
10
+
11
+ - Protocol engine: `oidc-provider` 9.13.0 (panva; dependencies koa, jose, debug). We mount it on the bridge's public HTTP listener through `provider.callback()` under `/<secret>/oauth`. The issuer is `<public origin>/<secret>/oauth`, and this is the only OAuth implementation. The bridge implements no OAuth protocol cryptography; its storage adapter encrypts persisted state. The bridge resolves opaque access tokens through the provider and checks their grants and approved connection records. External OAuth keeps its existing JWT verifier.
12
+ - Storage: an oidc-provider adapter on `node:sqlite`, file `<config>/dalan/as.sqlite`, mode 0600. Models: Client, Grant, Interaction, AuthorizationCode, RefreshToken, Session.
13
+ - Keys: on `dalan as-init`, generate an ES256 (P-256) JWKS in `<config>/dalan/as-jwks.json` (0600) and a cookie key file (0600). Plain files, not Keychain: launchd agents run unattended, and Keychain prompts would block them. Rotation: `dalan as-rotate-keys` adds a new `kid` and signs with it. Stop the bridge before rotation. Retired signing keys and cookie keys remain for their issued-token and browser-session lifetimes plus clock skew.
14
+
15
+ ## Connect a worker
16
+
17
+ 1. For a fresh installation, follow [service setup](service-setup.md#owner-setup), which creates the worker profile and built-in authorization state. For an existing built-in installation, keep its home, profile and public URL; do not rerun `init` or `as-init` merely to connect another client. An intentional issuer or endpoint change needs the [upgrade and recovery procedure](dalan-upgrade.md). The issuer is `<public origin>/<secret>/oauth` and the resource is `<public origin>/<secret>/mcp`.
18
+ 2. The owner starts a tunnel or reverse proxy that serves public HTTPS and supports the OAuth browser flow, and forwards only the public listener, never the owner socket. Preserve the public `Host` (including a non-default port); a mismatch returns 421, and forwarded headers do not override it. See [the exposure Host rule](../README.md#expose-your-bridge) and [service setup](service-setup.md) for network configuration. Issuer and resource come from config, never from forwarded headers.
19
+ 3. Run `dalan connect start --worker NAME` before adding the connector in the vendor UI. The default pairing window lasts 10 minutes. The vendor reads the path-suffixed protected-resource metadata and AS metadata, then uses Dynamic Client Registration (DCR) to register the client. DCR needs the secret namespace and an open window; registration creates no authority. A vendor that cannot register itself can use a static public client that the owner creates (see [Owner client commands](#owner-client-commands)).
20
+ 4. The vendor opens the browser at `/<secret>/oauth/auth`, with PKCE S256, `resource`, scopes and redirect. For a native client with a loopback callback, open the sign-in page on the computer running that client's callback listener. For a hosted client, use the provider's browser sign-in flow. The interaction page shows a short pairing code (for example `KTBX-4QPM`) and an instruction to run `dalan connect approve KTBX-4QPM --worker example-worker` on the bridge computer. The page waits.
21
+ 5. The owner runs `dalan connect pending`. It shows each pending transaction: full pairing code, client_id, untrusted client name, exact redirect URI, worker, scopes and age. For native clients it warns that identity is not verified: host and name prove nothing. The teammate must read the pairing code from the browser page on their own machine and tell the owner over a trusted channel. `--confirm-redirect` checks for a redirect typo only; it is not identity proof. Approval of a native callback also requires the exact host, port and path: `dalan connect approve CODE --worker NAME --confirm-redirect URI`. Native entries are approved one code at a time: a native entry is never superseded, a newer native attempt never blocks or replaces an older one, and approving one code approves no other. `dalan connect pending` prints the approve command, with the redirect, for each native entry, so match the code and the redirect to the teammate. A web entry follows a different rule: only the newest web pending entry of a worker can be approved, and older web entries are shown as superseded because an app that registers again abandons its older attempts. A native entry never supersedes a web entry. If the code matches no pending entry, run `dalan connect pending` and compare the codes before retrying. The approval:
22
+ - is bound to the interaction UID, which already binds the client, redirect, PKCE challenge and resource;
23
+ - is single use and expires after 10 minutes;
24
+ - creates a Grant and a bridge **connection record** `{connection_id (uuid), worker, client_id, redirect_uri, resource, scopes, created_at}`. When the worker already has an active connection, the new one replaces it only after a second confirmation (`--replace`). The old connection is then revoked.
25
+ 6. The interaction completes. The vendor gets a single-use code and exchanges it with its verifier. Access tokens are opaque, bound to the exact resource, and valid for one hour. Refresh tokens rotate on every use.
26
+ 7. Every MCP request: resolve the opaque AccessToken through the provider; check account, resource, expiry and scopes; then check its grant and approved connection. The active connection resolves the worker. `dalan connect revoke NAME` takes effect immediately, before the access token expires.
27
+
28
+ In built-in mode a grant records the connection it was given to (`claims.connection_id`, schema 61). A duplicate `claim` or native receipt replay is accepted only from that connection while it is live and, when the owner approved a destination, only while the live connection set matches the approved digest. The same connection check also gates every later call that acts on the grant: `renew_claim`, `progress`, `ask_question`, `consume_answer`, `finish` (fresh, replay and late evidence after cancel), `artifact_chunk`, and the workspace tools `list_files`, `read_file`, `apply_patch`, `run_check` and `workspace_result`. The Store runs it in the transaction that writes the effect, after the claim check and before any state change, and a call from a revoked, replaced or other connection fails with `connection_not_live` and changes nothing. Checks on the claim come first, so a wrong subject or worker, a superseded claim or an expired lease keeps its own error. `get`, `list_pending` and `ack_message` stay open to any authenticated worker connection; `get` moves the note-seen cursor only for the live holder. Under external OAuth (no connection id and no liveness check) the check does not run for a claim that stored no connection. A claim that stored a `connection_id` (for example, a database that moved from built-in to external OAuth) is refused with `connection_not_live` until its lease expires, because external OAuth presents no connection. In built-in mode a grant made before schema 61 records no connection, fails the check, and waits for its lease to expire. See [Connection fence](../PROTOCOL.md#connection-fence-built-in-mode). See [current connection limits](../PROTOCOL.md#claims-and-worker-tools).
29
+
30
+ The local CLI approval is the owner authentication. There is no password and no browser account. The interaction page can approve nothing by itself.
31
+
32
+ ## Owner client commands
33
+
34
+ - `dalan connect add-client --redirect-uri URI [--name NAME] [--json]` creates a persistent static public client and prints its `client_id`; it creates no secret and grants no authority. The redirect URI must match the configured callback allowlist, using the same exact callback check as DCR. This command is available through the owner Unix socket only.
35
+ - `dalan connect clients [--json]` lists static and DCR clients with their type, client ID, untrusted name, redirect URIs and creation time.
36
+ - `dalan connect remove-client CLIENT_ID` removes a static client. It revokes that client's grants and connections, so the existing revocation path retires its subscriptions. DCR clients cannot be removed with this command.
37
+
38
+ A client still needs an open pairing window and owner approval before it can receive tokens or access a worker. The public HTTP listener has no static-client creation route.
39
+
40
+ ## Settings (oidc-provider)
41
+
42
+ `features.registration` on (no initial access token); `features.resourceIndicators` on, with one allowed resource and `accessTokenFormat: 'opaque'`; `features.revocation` on; `features.devInteractions` off; `pkce.required` always and S256 only; `rotateRefreshToken: true`; `clientDefaults` with `token_endpoint_auth_method: 'none'` for public clients; `features.clientIdMetadataDocument` (CIMD) **off** in the first release (experimental in 9.x). Exact redirect matching (the oidc-provider default). TTLs: AuthorizationCode 600 s, AccessToken 3600 s, RefreshToken 30 days (inactivity), Interaction 600 s.
43
+
44
+ ## Secret namespace and discovery
45
+
46
+ The explicit connector setup exposes the private resource URL to the chosen application. Treat the URL as a secret; ordinary pending and connection lists omit it. The AS encrypts OAuth state with `as-storage.key` in its private state directory. Back up the AS database and key, bridge database and its `.secrets/storage.key` together: losing the key prevents recovery of existing sessions. Schema 52 introduced encrypted subscription storage; this release uses schema 66. Older code may refuse or be incompatible with migrated state. Follow [upgrade and rollback](operations.md#upgrade-and-rollback) and restore the matching pre-upgrade recovery set rather than lowering the schema number. Migration scrubs the managed SQLite database and its WAL, but does not erase older backups, snapshots, or copies.
47
+
48
+ For resource `https://bridge.example/<secret>/mcp`:
49
+
50
+ - Protected-resource metadata: `/.well-known/oauth-protected-resource/<secret>/mcp` (RFC 9728).
51
+ - AS metadata: `/.well-known/oauth-authorization-server/<secret>/oauth` (RFC 8414).
52
+ - OpenID discovery aliases: `/.well-known/openid-configuration/<secret>/oauth` and `/<secret>/oauth/.well-known/openid-configuration`.
53
+ - Every discovered protocol endpoint, interaction and browser resume route stays under `/<secret>/oauth`.
54
+
55
+ The root `/oauth` surface and unsuffixed well-known routes return 404 in built-in mode. No vendor-specific root fallback is enabled. All secret-bearing metadata has `Cache-Control: no-store`; the public AS also sends no-referrer and other security headers. The MCP challenge advertises the suffixed protected-resource metadata URL. Legacy and external-OAuth metadata and listener settings are unchanged.
56
+
57
+ Claude's documented discovery sequence tries path-suffixed protected-resource metadata and keeps the path in its `resource` indicator (see [Claude authentication documentation](https://claude.com/docs/connectors/building/authentication)). In oidc-provider 9.13.0, `Provider` derives its mount path from the issuer; `pathFor` prepends it to endpoint and resume routes. We strip exactly that prefix for its router and map RFC 8414 discovery back to its internal well-known route. `scripts/builtin-as-exposure-test.mjs` verifies a full DCR → browser pairing → owner approval → token → MCP initialize using only discovered URLs. This proves that the bridge serves suffixed metadata that matches the documented discovery sequence.
58
+
59
+ ## Admission limits and recovery
60
+
61
+ DCR accepts five POST attempts per pairing window by default, including invalid or incomplete requests. The budget is reserved before body parsing and persists across restarts; concurrent requests cannot oversubscribe it. Live interactions and pending pairing codes each have a default cap of five. These defaults allow a single-owner pairing and retries without granting anonymous callers the previous 100-client/25-interaction budget. The existing total client cap of 100 and 24-hour stale-client purge remain as final storage bounds.
62
+
63
+ Set optional `as.json` fields `"limits": {"registrations": 5, "interactions": 5}` to change these caps. Each value must be an integer from 1 to 100. Restart to apply changes. Registration bodies are at most 8 KiB, validated client metadata at most 4 KiB, client names at most 128 characters, and redirect lists at most eight URIs of 512 characters each. Chunked bodies have the same byte cap; exceeding it closes the request.
64
+
65
+ Registration outside a window returns 403; an exhausted DCR budget returns 429; full interaction capacity returns 503. Busy pages instruct the owner to run `dalan connect reset`. A flood of registrations followed by authorization attempts during an open window can leave more than one pending pairing for the same worker. The pending list follows the approval rules in step 5 of "Connect a worker". A flood can fill the pending cap of five and make new attempts fail with a busy page, but it cannot take the approval of another native entry; run `dalan connect reset` to clear it. If an entered code does not match a pending entry, the CLI says to run `dalan connect pending` and compare codes. `dalan connect reset` remains available to clear unapproved clients, pending pairings and their interactions, then restore the registration budget in the current window. It preserves approved connections, grants, tokens and attempts whose approval has already started, including the provider record needed by a pending browser resume redirect. It does not open or extend a window. Requests started before reset cannot repopulate the cleared state. Repeating `connect start` extends an open window and keeps its budget and attempts. Stop/start opens a fresh budget and clears pending interactions from earlier windows; use reset to remove unapproved clients too.
66
+
67
+ ## Public HTTP deadlines (built-in mode)
68
+
69
+ The loopback public listener sets `headersTimeout = 10,000 ms`, `requestTimeout = 30,000 ms`, `keepAliveTimeout = 5,000 ms`, `maxConnections = 128`, and socket inactivity timeout `180,000 ms`. Node checks incomplete requests every 1,000 ms, so deadline enforcement can lag by that interval. The header and body deadlines are absolute: sending a byte every few hundred milliseconds does not extend them. Ten seconds permits normal tunnel headers; thirty seconds permits bounded MCP uploads while limiting stalled bodies. Five seconds recycles idle keepalive connections; 128 sockets leaves room for normal parallel MCP calls with bounded exposure.
70
+
71
+ `requestTimeout` limits receipt of the request, not tool execution or the response lifetime. The three-minute inactivity timeout covers stalled sockets and leaves headroom around `t3_thread_wait`: non-legacy catalogs advertise and enforce a 90-second default and maximum. The frozen `legacy-v46` catalog does not advertise T3 tools. On the hosted trial, a POST that accepts `text/event-stream` negotiates SSE only after bearer authentication, JSON-RPC validation and confirmation that the request has an ID. The response starts with a comment and sends comment keepalives every 20 seconds, followed by one final `event: message` JSON-RPC response. When SSE is not negotiated, normal MCP request/response calls keep JSON responses. SSE disables socket inactivity expiry when headers are sent, so the response has no total deadline; open streams still count toward the connection cap. Legacy and external-OAuth listeners retain their prior settings.
72
+
73
+ ## Maintainer conformance checklist
74
+
75
+ This checklist is for maintainers changing the authorization implementation. To connect a worker to an unmodified release, follow the setup and first-job checks in the [worker guide](worker-clients.md).
76
+
77
+ 1. Authorization without PKCE, or with `plain`: refused.
78
+ 2. A code reused, a code with the wrong verifier, a code for a different redirect or client: refused.
79
+ 3. A web redirect URI that differs in any byte (path, port, query, trailing slash, scheme, suffix host) from registration is refused without redirecting. A native callback may vary its port only for registration-to-authorization matching on a remote HTTPS bridge or in loopback mode; scheme, host and exact path stay bound, and token exchange requires the full approved redirect. Native approval requires `--confirm-redirect` with the exact host, port and path shown by `dalan connect pending`; this checks for a typo, not identity. The owner must compare the code the teammate reads from the browser page on their own machine over a trusted channel. A native approval selects only the pending entry matching its code (see step 5 of "Connect a worker"). `localhost` is accepted only after a separate owner allowlist entry; its resolution follows the client machine's host resolver.
80
+ 4. A `resource` other than the configured one, at authorization and at the token endpoint: refused. A token whose `aud` is a different resource: rejected by the bridge.
81
+ 5. An approval with an expired, consumed or unknown pairing code: refused. Approval of interaction A cannot complete interaction B.
82
+ 6. A DCR client with no approval cannot get a token. An anonymous registration has no access.
83
+ 7. For a public client without sender-constrained credentials, an identical retry of the immediately previous refresh exchange within five seconds returns the same saved token response, while its successor remains unconsumed and the grant and connection remain live. The retry must not rotate again or extend the grace window. A changed request, an older ancestor token, a consumed successor or an out-of-grace replay is refused through the normal replay path and revokes the grant and connection. Verify both the bounded successful retry and the rejected replay cases, including rejection of the old access token after revocation.
84
+ 8. After `connect revoke`: the next MCP call with a still-valid access token is rejected, and refresh is refused.
85
+ 9. After a restart: existing tokens still verify (keys persist). After key rotation, tokens signed with the old kid verify until they expire, and new tokens use the new kid.
86
+ 10. Forwarded-header spoofing (`X-Forwarded-Host`) does not change issuer or resource.
87
+ 11. Two connections for two workers, with one sub and two clients: each resolves only to its own worker (worker-isolation tests, built-in mode).
88
+ 12. A static client uses the callback allowlist, has no secret or authority before approval, survives a restart, and is removed with its grants, connections and subscriptions. The public listener cannot create one.
89
+
90
+ ## Wake signal for hook-driven workers
91
+
92
+ A worker's MCP client may be one-shot, with no push. Its fastest wake can be a timed hook script that holds no connector credentials. The bridge offers that script one public bit in built-in mode only: `GET /signal/<signal-token>`. In oauth and legacy modes the route does not exist (404).
93
+
94
+ - `dalan connect signal-token [--worker NAME] [--rotate] [--json]` saves the full signal URL (public origin plus `/signal/<token>`) in `~/.config/dalan/signal-url.<worker>` with mode 0600 and prints only that path. JSON output contains the path and non-secret worker, rotation and poll-interval metadata; it never contains the URL or token. Configure the hook to read the URL from that file. The resolved worker name is used in the filename even when `--worker` is omitted. `--worker` is required when the profile has more than one worker; with one worker it defaults to that worker. The first call creates the worker's token. `--rotate` replaces only that worker's token, and its old URL answers 404 from that moment; other workers' URLs do not change. The command uses the owner Unix socket only.
95
+ - The token is a separate 256-bit random value (64 hex characters) per worker in `~/.config/dalan/signal-token.<worker>`, mode 0600. It is not the MCP path secret. With no token file, the route answers 404. Migration: a host with one worker and an older single `signal-token` file keeps that URL working for its one worker; that worker's `--rotate` writes `signal-token.<worker>` and deletes the old file. With more than one worker the old file matches nothing.
96
+ - A good token answers `200` with exactly `{"work":true}` or `{"work":false}`, plus `Cache-Control: no-store` and `X-Content-Type-Options: nosniff`. `true` means at least one queued, live, uncancelled assignment targets the worker that owns the token, or the worker holds its own active claim whose lease has expired and that has had no claim activity for `DALAN_RESUME_IDLE_MS` (default 120000; `0` turns this second case off; see "Resume wake" in `docs/pull-workers.md`); other workers' queues and claims do not show. The answer has no ids, titles or counts. The bridge computes it at most once every 10 seconds per worker and caches the boolean.
97
+ - A wrong or missing token answers `404` with an empty body, the same as any unknown path. The token compare is constant-time. A method other than GET with a good token answers `405`. The strict canonical Host check of the other routes applies first (`421`).
98
+ - Rate limit, in memory: about one request per 5 seconds per source address with a burst of 3, and 30 requests per minute for the whole bridge. Excess requests get `429` with `Retry-After`. Only requests with a good token count, so a scanner with wrong tokens cannot use up the allowance. The signal rate limiter uses the socket peer's address rather than a forwarded client address. `DALAN_TRUST_PROXY` acknowledges the HTTPS reverse-proxy deployment requirement on a non-loopback bind; it does not give this limiter a forwarded client IP. Behind a tunnel on this computer that is the loopback address for every caller, and the limit becomes one shared bucket.
99
+ - The request log gets one line per request: `{kind:'signal', status, work}`. It never holds the token or the path.
100
+
101
+ For a complete hook example, including transfer of the private signal file and replacement of the `wake` placeholder, see [The wake signal](pull-workers.md#the-wake-signal). Generate the signal file on the bridge host; the worker hook needs only that file.
102
+
103
+ Treat the URL as a bearer secret: anyone who has it can learn whether work is queued. If it leaks, run `dalan connect signal-token --rotate`. Maintainer check: from a source checkout installed with `npm ci`, run `node scripts/signal-endpoint-test.mjs`. The npm package does not include it; it takes about one minute because it uses the real cache and rate-limit intervals.
104
+
105
+ ## Not in scope
106
+
107
+ This profile does not cover multiple owners or vendor or model attestation. It also gives no protection against compromise of the owner account, an approved connector or the bridge process; a stolen bearer token is limited only by the 1-hour lifetime and revocation.
@@ -0,0 +1,70 @@
1
+ # PR-head reviewer
2
+
3
+ `dalan-pr-reviewer` submits one scoped, read-only review to the default worker for every open pull request that passes the gates below and whose current head SHA has no worker review. It makes no model calls. A systemd user timer runs it every 10 minutes.
4
+
5
+ ## What one run does
6
+
7
+ 0. Before the capacity gate (skipped with `--only`): for each PR that a queued or claimed assignment targets (objective key `pr:<owner>/<repo>#<n>`, or `inputs[0].github_repo` plus `pr_number`), at most `max_closed_checks` (40) per run, one REST `pulls/<n>` call (ETag-conditional, so an unchanged PR is a 304). A PR with `state` `closed` (merged or not) gets every such request cancelled with `dalan cancel ID --reason pr_closed`; the bridge stores it as `cancelled_reason`. Open PRs are untouched. A failure is logged as `error` with stage `pr-closed-check` and does not stop the run; a rate limit sets the usual backoff.
8
+ 1. `dalan status --json`. Stop when the pool is paused, when an owner-confirmed `worker_break` is active (`active` and `source === "owner"`), or when `claim_denied.capacity_hold_until` is in the future.
9
+ 2. Free slots = `max(0, max_claimed_outer_assignments + headroom - claimed - live queued)`. Submit at most `min(slots, max_submits_per_run)`. Defaults are 6 headroom slots and 10 submissions per run. With no free slot, skip discovery.
10
+ 3. Discover open PRs with one REST-backed `gh search prs` per distinct configured owner and one per extra repo not covered by those owners. Apply case-insensitive exact `exclude_owners` and `exclude_repos`, and skip archived/fork repositories when the search or PR detail response identifies them. Bot PRs are skipped. A draft counts only if updated in the last 7 days; any other PR only if updated in the last 30 days. Ready PRs go first, newest first.
11
+ 4. Dedupe against `bridge.db` (read-only): any non-cancelled assignment for the same repository whose `inputs[0].head_sha` (or lone `base_sha`) is this head, or whose `objective_key` + `revision` is this PR at this head. This includes reviews that other owners submitted themselves. Cancelled assignments do not cover.
12
+ 5. Build the assignment so that `validateSubmission` accepts it: `scope_paths` are the PR's changed files still present at the head (deleted files are omitted), collapsed to directories only when over `max_scope_paths` (150) paths or `max_scope_bytes` (8000) bytes; `inputs` pin `{github_repo, base_sha: head}` in head-only mode (REST pull details provide a base tip, not a merge base); `execution_scope` is `read-only`; the brief names no path. A changed file the lint calls sensitive leaves the scope and the PR is then reviewed at its head without the diff (`inputs: [{github_repo, base_sha: head}]`). A PR whose files are all sensitive, a deletion-only PR, and a PR with more than `max_changed_files` (200) changed files, counting deletions, are skipped.
13
+ 6. Submit with `dalan submit --stdin --json --background --exclude-sensitive --allow-scope-prune --deliver <dest> --objective-key pr:<owner>/<repo>#<n> --revision <head> --task-kind review --source agent`. (`--source` accepts only `drainer`, `fix-loop`, `agent`, `unknown`.) Request id: `prh-<owner>-<repo>-<n>-<head12>`.
14
+ 7. A refusal that survives the CLI's `--allow-scope-prune` fix is logged and remembered for 6 hours. It is not retried in the same run. A bridge or transport failure (HTTP 5xx, timeout) is also remembered for the cooldown and ends the run.
15
+
16
+ ## Delivery
17
+
18
+ The T3 thread linked to the PR (read-only from `~/.t3/userdata/statev2.sqlite`, `orchestration_v2_projection_threads.payload_json.pullRequests`; a live thread beats an archived one, then the newest link wins) receives the result. If that link points to a delegated child, the reviewer follows its `lineage.parentThreadId`, then `lineage.rootThreadId`, and delivers to the nearest owner that is not archived, deleted, or settled. It never delivers to the delegated child. If no owner can receive it, `report_thread_id` from the config is used; with neither, delivery is `none`. A refused protected T3 destination logs `delivery-fallback` and retries with the report thread if different, then `none`. Other refusals do not trigger a delivery retry. The dry run prints the resolved destination without submitting or writing state.
19
+
20
+ ## GitHub API budget
21
+
22
+ No `gh pr list`, `gh pr view`, repository enumeration or GraphQL is used. Per run the nominal budget is owners + extra repositories + changed PRs × 3 REST calls + one `pulls` call per PR with queued or claimed work (step 0, mostly 304s): one search per owner/extra repository (limit 200), then pull details (head/base SHA), changed files and pull details again (to confirm the head did not move) for each eligible result. Covered/refused heads need only the first detail call. Files use `gh api --paginate`; each additional page costs an additional REST request even though it is one gh invocation. Because calls are sequential, a rate-limit failure stops further requests immediately.
23
+
24
+ After a complete successful scan, state records the run's start time in `last_successful_run`. Later searches include `updated:>=<last_successful_run minus 10 minutes>`; first runs have no date filter. The overlap catches updates made during a run. `--only` ignores and does not advance this scan watermark. Capacity truncation, a 200-result search, errors and retryable refusals retain the previous watermark rather than lose unseen work. A search capped at 200 still requires operator attention or narrower configured coverage to guarantee full discovery.
25
+
26
+ REST responses are read with `gh api -i`; body and ETag are cached per endpoint in `state.json` under the state directory. A later fetch sends `If-None-Match` and a 304 returns the cached body (authenticated conditional 304s do not consume the primary REST rate-limit budget). Multi-page file collections are cached without a validator: one page's ETag cannot validate the entire collection, and gh would otherwise send that same conditional header to every page. Search responses are not conditionally cached.
27
+
28
+ Every run logs `gh-calls` with invocation counts by `search`, `pull`, and `files`, plus a separate `not_modified` count. The counts describe gh invocations, not hidden pagination requests. HTTP 429, HTTP 403 with `x-ratelimit-remaining: 0`, or gh stderr reporting `rate limit exceeded` or `secondary rate limit` immediately ends the run, logs `rate-limit`, and persists `backoff_until` using the reset/Retry-After headers. Other 403 responses are ordinary errors. If no reset is available (for example search stderr omits headers), back off for an hour; never retry sooner than one minute. Subsequent runs make no gh calls while backoff is active. Dry runs report these decisions without persisting caches, watermarks, backoff or logs.
29
+
30
+ ## Configuration
31
+
32
+ `~/.config/dot-pr-reviewer/config.json` (optional; see [dot-pr-reviewer.config.example.json](dot-pr-reviewer.config.example.json)). Keys: `owners`, `repos`, `exclude_owners`, `exclude_repos`, `include_forks`, `skip_bots`, `max_submits_per_run`, `headroom`, `draft_days`, `max_age_days`, `max_changed_files`, `max_scope_paths`, `max_scope_bytes`, `ttl_hours`, `refusal_cooldown_hours`, `report_thread_id`, `dot_worker`, `gh_concurrency`, `bridge_db`, `t3_db`. `gh_concurrency` is accepted for config compatibility, but GitHub calls are sequential. Unknown keys are an error. No thread id is built in.
33
+
34
+ ## Use
35
+
36
+ Before any run, configure the repository coverage and `bridge_db` and `t3_db` paths. Both databases must exist, and `t3_db` must contain `orchestration_v2_projection_threads`, even with delivery `none`. Install Node.js 24+, authenticate `gh`, and put `dalan` on `PATH`. See [Install on Linux](#install-on-linux) before enabling the timer.
37
+
38
+ ```
39
+ dalan-pr-reviewer --dry-run # inspect candidates without submitting
40
+ dalan-pr-reviewer --dry-run --ignore-capacity # also inspect candidates when capacity is full
41
+ dalan-pr-reviewer --only OWNER/REPO#N # one PR, if in the repo's first 200 open search results (still gated and deduped)
42
+ dalan-pr-reviewer --max N
43
+ ```
44
+
45
+ State and log: `~/.local/state/dot-pr-reviewer/{state.json,log.jsonl}` (one JSON line per decision).
46
+
47
+ ## Install on Linux
48
+
49
+ Run from the Dalan checkout or installed package directory, where `docs/` and `systemd/` exist. Install Node.js 24+, authenticate `gh`, and make `dalan` available on the unit's `PATH`. Disable any previous PR feeder before enabling this timer.
50
+
51
+ Create the directories and copy the example only if you have no configuration yet:
52
+
53
+ ```sh
54
+ mkdir -p ~/.config/dot-pr-reviewer ~/.config/systemd/user
55
+ if [ ! -e ~/.config/dot-pr-reviewer/config.json ]; then
56
+ cp docs/dot-pr-reviewer.config.example.json ~/.config/dot-pr-reviewer/config.json
57
+ fi
58
+ ```
59
+
60
+ Edit `config.json` before continuing: replace the example repository coverage, set `bridge_db` and `t3_db` to the intended existing databases, and replace `report_thread_id` with a verified destination or remove that key for quiet delivery. The T3 database must contain `orchestration_v2_projection_threads`, even with quiet delivery. Check the unit's checkout path and `PATH` as well.
61
+
62
+ Run `dalan-pr-reviewer --dry-run`. Confirm that it succeeds and shows only the intended repositories and destinations. Only then install and enable the timer:
63
+
64
+ ```sh
65
+ ln -sf "$PWD"/systemd/dot-pr-reviewer.{service,timer} ~/.config/systemd/user/
66
+ systemctl --user daemon-reload
67
+ systemctl --user enable --now dot-pr-reviewer.timer
68
+ ```
69
+
70
+ It needs `gh` (authenticated), `node` 24 and `dalan` on the unit's `PATH`. It also opens the bridge database and the T3 database read-only (`bridge_db`, `t3_db`). Both must exist, and the T3 database needs the `orchestration_v2_projection_threads` table, even when delivery uses `report_thread_id` or `none`; otherwise the run aborts. Disable any previous PR feeder before enabling this timer.
@@ -0,0 +1,28 @@
1
+ # Declared PR preflight
2
+
3
+ A PR-derived assignment declares one GitHub input with `github_repo`, full `base_sha`, full `head_sha`, and a positive integer `pr_number`. The assignment also supplies `prepared_at` and `valid_until`, at most two hours apart. Standalone pinned commits and opaque research inputs do not imply a PR number; producers must declare PR work explicitly.
4
+
5
+ Fresh submit and first claim each call `gh api --hostname github.com repos/OWNER/REPO/pulls/NUMBER` directly, using the host's existing gh authentication. `GH_HOST` cannot silently redirect the observation to another GitHub instance. No cached preparation result authorizes a claim. An unknown observation, closed/merged PR, moved head, expired preparation or `objective_resolved:true` refuses the mutation. Draft state is recorded as a fact and is not an eligibility veto. The remote call is bounded at ten seconds and happens outside the SQLite transaction; the transaction checks immutable input, observation freshness and preparation validity again.
6
+
7
+ For example, add these fields to the normal assignment:
8
+
9
+ ```json
10
+ {
11
+ "prepared_at": "<current RFC3339 timestamp>",
12
+ "valid_until": "<RFC3339 timestamp within two hours>",
13
+ "inputs": [{
14
+ "github_repo": "owner/repo",
15
+ "base_sha": "<full base commit SHA>",
16
+ "head_sha": "<full current PR head SHA>",
17
+ "pr_number": 123
18
+ }]
19
+ }
20
+ ```
21
+
22
+ `get.pr_preflights` returns persisted `submit` and `claim` observations with repository, PR number, head SHA, draft flag and `checked_at`. An exact live retry returns the original claim without another remote PR observation and is not re-judged against current repository or destination policy (built-in mode still requires the connection that holds the grant); it does not start new work. Existing claimed work is not reclaimed or stopped when a PR later changes. Immutable existing submit retries stay readable and retryable after their preparation expires.
23
+
24
+ A direct observation proves the head at its recorded instant. GitHub can change immediately afterward; the result remains tied to its declared SHA and must be verified against the current head before use. This preflight does not prove the broader objective is still useful. When the objective, revision or validity changes, the producer must prepare a new immutable identity; changing the old assignment conflicts.
25
+
26
+ The following checks require a source checkout installed with `npm ci`; their scripts are not included in the npm package.
27
+
28
+ Run `node scripts/pr-preflight-test.mjs` and `node scripts/pr-preflight-commit-test.mjs` and `node scripts/pr-preflight-e2e.mjs`. The HTTP journey uses a local Git fixture and an inert gh executable, verifies zero assignments/claims on refusal, and proves claim retries keep their ID through a simulated observation outage. It does not contact GitHub or a live worker.
@@ -0,0 +1,131 @@
1
+ # Submit one read-only result to an eligible pool
2
+
3
+ A policy work order lets one of several named workers take a job. It creates one
4
+ ordinary assignment when the first eligible worker claims it. Later attempts stay
5
+ with that worker; Dalan does not assign the slot to another worker automatically.
6
+
7
+ Every candidate must already have access to the job's repository. Listing and
8
+ acquisition both check the current repository grant and approved destination.
9
+ Listing a job does not reserve it or authorize work to start.
10
+
11
+ For workers without a destination declaration, put an explicit `valid_until`
12
+ deadline inside the assignment file itself (the `review.json` passed to `--file`
13
+ carries a `valid_until` field), then submit:
14
+
15
+ ```sh
16
+ dalan submit --file review.json --eligible alpha,beta --execution worker
17
+ ```
18
+
19
+ The assignment must use `execution_scope: "read-only"`. Version 1 accepts
20
+ `execution=none` or `execution=worker`, one result only (a single worker's report,
21
+ not several) and explicit worker names. It rejects host execution, protocol jobs,
22
+ fan-out greater than 1, worker classes, superseding, command keys and backend
23
+ capability requirements (the `--require-capability` option is for direct host
24
+ jobs, not pool jobs). The effective deadline is the earlier of the policy
25
+ deadline and the assignment's `valid_until`.
26
+
27
+ For workers with a declared destination, start with a policy file containing this
28
+ routing object (a destination is declared in the worker's profile; the dry-run
29
+ preview below shows each candidate's destination disclosure):
30
+
31
+ ```json
32
+ {
33
+ "version": 1,
34
+ "allowed_workers": ["alpha", "beta"],
35
+ "fan_out": 1,
36
+ "deadline_at": "2026-12-01T00:00:00Z"
37
+ }
38
+ ```
39
+
40
+ Run `dalan submit --file review.json --policy policy.json --execution worker --dry-run --json`.
41
+ The preview stores no job and returns `destination_disclosures` for each candidate.
42
+ Review each disclosure. Add its exact `revision` to the policy file:
43
+
44
+ ```json
45
+ {
46
+ "routing": {
47
+ "version": 1,
48
+ "allowed_workers": ["alpha", "beta"],
49
+ "fan_out": 1,
50
+ "deadline_at": "2026-12-01T00:00:00Z"
51
+ },
52
+ "destination_revisions": {
53
+ "alpha": "sha256:<alpha revision from the preview>",
54
+ "beta": "sha256:<beta revision from the preview>"
55
+ }
56
+ }
57
+ ```
58
+
59
+ Then run:
60
+
61
+ ```sh
62
+ dalan submit --file review.json --policy policy.json --execution worker --dry-run
63
+ dalan submit --file review.json --policy policy.json --execution worker
64
+ ```
65
+
66
+ A policy file can also contain the routing object directly when no candidate needs
67
+ a destination revision. The owner can use `get`, `wait`, `inbox` and `cancel` with
68
+ the submitted request ID before or after acquisition. Reports and decisions use
69
+ that same request ID and the same saved owner capability.
70
+
71
+ ## Worker flow without a connector refresh
72
+
73
+ Workers connected over MCP use these tools; `list_pending` and `claim` are MCP
74
+ tools, not `dalan` commands.
75
+
76
+ 1. Call `list_pending`. Its existing `assignments` list is unchanged. The new
77
+ `policy_work.items` field contains up to 50 eligible work orders, with priority,
78
+ original queue time and deadline. Normal priority precedes background work.
79
+ 2. If `policy_work.next_page_request_id` is present, call the existing `get` tool
80
+ with that value as `request_id`. Continue until it is null. Pagination captures
81
+ a queue high-water mark; jobs added later appear on the next fresh list. Every
82
+ page checks current eligibility. Page tokens are encrypted and bound to the
83
+ authenticated worker, and survive a bridge restart.
84
+ 3. Call `get` with an offered job's `request_id` to read its assignment. Call
85
+ `claim` with that ID, a claimant and a fresh `acquisition_id`. Respect the
86
+ existing free-lane and pause limits. A race has one winner.
87
+ 4. Use the returned `request_id` and `claim_id` with the existing progress,
88
+ workspace and finish tools. The receipt includes a distinct `work_order_id`. Once acquired, `child_request_id`
89
+ equals the original submitted `request_id`; the child keeps that reserved ID.
90
+ A lost-reply retry must use the original claimant, lease and acquisition ID.
91
+ 5. Read the owner's decision separately. Completion does not accept the result.
92
+
93
+ The eligible backlog is independent of available lanes. An unauthorized worker
94
+ sees neither work-order titles nor a global backlog count. Repository revocation,
95
+ destination drift or connection-set drift removes an unacquired order from that
96
+ worker's claimable set and refuses a new acquisition. Once a child exists, it
97
+ follows ordinary assignment listing rules, including a visible `blocked:true` entry
98
+ when destination policy blocks it. A committed live acquisition retry follows the
99
+ existing grant fences; changing policy does not silently replace its holder.
100
+
101
+ Acquisition commits the child, claim and parent winner in one SQLite transaction.
102
+ A crash before commit leaves the work order available with no child or claim.
103
+ A crash after commit can lose the reply; retrying the same acquisition returns
104
+ the saved child and claim, subject to the ordinary live-grant checks.
105
+
106
+ At its deadline, an unacquired work order is cancelled and no child is created.
107
+ After acquisition, the deadline becomes the child's `valid_until`; ordinary expiry
108
+ rules cancel a queued child, while an active claim is untouched. The deadline does
109
+ not stop an already active claim. Cancel the submitted request ID to revoke an
110
+ active child's authority. Cancellation does not prove external compute stopped.
111
+ The child's report and owner decision remain linked by the submitted request ID
112
+ and `work_order_id`; a finished report is not an accepted result.
113
+
114
+ Version 1 discovers unacquired work through polling `list_pending`. An unacquired
115
+ work order is not a queued assignment for the protocol's re-wake rule, so it adds
116
+ no availability event. Existing events for materialized
117
+ children remain hints. Lease expiry and abandonment use the ordinary child
118
+ recovery path with a fresh acquisition ID, once prior work has verifiably stopped.
119
+ There is no second result slot or cross-worker retry.
120
+
121
+ If the acquired worker is removed or its connection is revoked, lease expiry does
122
+ not offer the order to a different worker. The owner must cancel the submitted
123
+ request ID and submit a fresh request ID for the remaining eligible workers.
124
+ Check that any previous external work has stopped before resubmitting; bridge
125
+ cancellation alone cannot prove that. The cancelled order and its history remain
126
+ separate from the replacement and its result.
127
+
128
+ Pool submission uses the existing MCP tool definitions.
129
+ `pull-catalog-hash-test.mjs` pins all four profiles with T3 tools off and on.
130
+ The database upgrade is additive schema 66; use a pre-upgrade backup to return to
131
+ an older Dalan build.
@@ -0,0 +1,94 @@
1
+ # Pull workers: how a worker without push finds work
2
+
3
+ Most cloud agents cannot receive a push from your bridge. They act only when something starts a run: a schedule, a hook, or a person. This page shows how to wake such a worker, the "pull worker", and what each run must do. The patterns do not depend on the vendor.
4
+
5
+ Worker support depends on the client and its scheduling features. See the support matrix in the [README](../README.md#support-matrix).
6
+
7
+ Start a new [ChatGPT worker](chatgpt-worker-onboarding.md) or [Claude worker](claude-worker-onboarding.md) with a manual, repository-free, execution-none smoke. These recipes do not establish background-worker availability. Leave schedules and hooks off until a separately authorized, vendor-specific acceptance run; the optional patterns below are not onboarding defaults.
8
+
9
+ ## What one run does
10
+
11
+ Each run checks the worker's MCP connector. The bridge stores the job, progress and owner notes. An independent run needs no earlier grant, but a run that continues after a QUESTION/answer pause or reconnect must retain its acquisition ID, claimant and claim ID. A new run cannot use an active grant merely because `get` shows it.
12
+
13
+ 1. Call `list_pending`. For a saved continuation, read any `attention` notes with `get` and continue under the saved grant; skip the new acquisition step below. Otherwise choose a claimable assignment from `assignments`. If neither needs work, stop. An empty run costs one tool call.
14
+ 2. Generate a random `acquisition_id` for this independent run and call `claim` on one job with that ID and a stable `claimant`. Save them with the returned `claim_id` and epoch. Reuse the acquisition ID for retries and continuation of this run. The default lease is 60 minutes. You can request `lease_ms` from 1 ms up to the owner-configured maximum; the bridge stores that duration on the grant and returns `lease_expires_at`. Matching live retries keep the stored duration. A competing live acquisition returns `claim_busy`; pick another job, or stop. Expired idle own claims can rotate as described below.
15
+ 3. Read the job with `get`. Do the work. For repository jobs, use `list_files`, `read_file`, `apply_patch` and `workspace_result`.
16
+ 4. Call `progress` while you work. Accepted claim-bearing activity slides a legacy non-protocol lease; `get` does not. Native protocol leases have a fixed deadline: activity and repeated `claim` do not slide it. Use explicit `renew_claim` with the current grant, command key and revision before expiry.
17
+ 5. To ask the requester a question, send `progress` with a note that starts `QUESTION:`. The requester answers with `dalan note REQUEST_ID TEXT`. `list_pending` lists claimed jobs with unread owner notes under `attention`, and `get` shows the answer. QUESTION records waiting history but does not pause the lease, stop compute or renew authority when the answer arrives. Continue with the saved grant while it remains valid. If an independent later run takes over, it must use its own acquisition and wait for lease expiry and verified effect-channel cessation; it must not copy the earlier grant from `get`.
18
+ 6. Call `finish` with the report. If the response carries `next_queued`, claim `next_queued[0]` yourself before the run ends. On any wake, call `list_pending` and claim up to `free_lanes` assignments, oldest first, instead of claiming only the event's `request_id`. After any claim error such as `assignment_expired`, call `list_pending` again before you claim another. For builds, inspect `workspace_result` first; the bridge computes the patch from the workspace changes.
19
+
20
+ Messages that the owner sends with `dalan tell` show up in `list_pending`; read them, then call `ack_message`.
21
+
22
+ Put this loop in the worker's standing instructions, for example in its scheduled task prompt. The bridge also returns short guidance in each `get` response.
23
+
24
+ ## Ways to start a run
25
+
26
+ | Pattern | How it works | Latency | Cost when idle | Use when |
27
+ |---|---|---|---|---|
28
+ | Native schedule | The vendor runs the worker on a timer, and every run does the loop above. | Up to one interval | One empty run per interval, from your plan allowance | The vendor has schedules and you can accept the delay |
29
+ | Signal hook | A small script on a timer polls the bridge's wake signal. It starts a worker run only when work is waiting. | One hook interval plus the vendor's start time | One HTTP request per interval, with no model run | The vendor runs hooks or scripts without connector credentials |
30
+ | Manual | A person tells the worker "check the bridge". | Whenever someone does it | None | Trials and recovery |
31
+
32
+ **After a reboot or login, nothing here restarts by itself.** Dalan starts the bridge service but starts no worker, and it supplies no scheduler, hook installer or `wake` command. Native schedules and hooks live in the vendor's tool, and Dalan does not support them across a reboot. The supported journey is manual: check the bridge, prompt the worker, check the result (see [After a reboot](service-setup.md#after-a-reboot)).
33
+
34
+ Use more than one. A signal hook gives speed, and a slow native schedule (for example every 15 minutes) catches anything the hook misses. Two runs that wake at once do no harm: `claim` is atomic, so only one of them gets the job.
35
+
36
+ ## The wake signal
37
+
38
+ The wake signal is a public URL that answers one bit: is a job waiting for this worker? It needs built-in auth mode. In oauth and legacy modes the route does not exist.
39
+
40
+ Create the URL on the bridge host:
41
+
42
+ ```sh
43
+ dalan connect signal-token --worker NAME # save this worker's URL privately; print the file path
44
+ dalan connect signal-token --worker NAME --rotate # replace it; the old URL answers 404 at once
45
+ ```
46
+
47
+ Each worker has its own URL. A hook with one worker's URL cannot see other workers' queues.
48
+
49
+ The answer is exactly `{"work":true}` or `{"work":false}`. It has no job ids, titles or counts. A wrong token gets `404`, the same as any unknown path. The bridge recomputes the answer at most once every 10 seconds.
50
+
51
+ On the bridge computer, run `dalan connect signal-token --worker NAME` once. Transfer the private file it names to the worker host over a trusted channel and keep it mode 0600. The hook needs only that file, not Dalan's owner socket or connector credentials.
52
+
53
+ On the worker host, set `SIGNAL_FILE` to that file's absolute path and replace `wake` with your worker client's supported start command. Run this hook at the [poll interval below](#poll-interval-and-url-secrecy). Do not echo the URL or enable shell tracing.
54
+
55
+ ```sh
56
+ SIGNAL_FILE=/absolute/path/to/private-signal-url
57
+ SIGNAL_URL=$(cat "$SIGNAL_FILE") || exit 1
58
+ curl -fsS "$SIGNAL_URL" | grep -q '"work":true' && wake
59
+ ```
60
+
61
+ `wake` is not a Dalan command. It stands for the vendor's way to start a worker run. Use a vendor schedule or your own script only if you accept that it is outside Dalan's supported path, and give it only the signal URL, not the connector credentials. The bridge service (see [service setup](service-setup.md)) keeps the queue available; it does not wake workers. The run that the hook starts authenticates through the connector as usual.
62
+
63
+ ### Resume wake (idle own claims)
64
+
65
+ A vendor run can stop in the middle of a job. Resume wake exposes an expired own claim for recovery; it does not allow another run to take over during the prior lease.
66
+
67
+ - **Signal.** `work` is also `true` when the worker holds an active claim, whose lease has expired, with no claim activity for `DALAN_RESUME_IDLE_MS` (default `120000`, 2 minutes). Claim activity is `progress`, any workspace tool, `finish`, or a repeated `claim`. A read-only `get` does not count. The answer is still one bit, cached 10 seconds, per worker.
68
+ - **`list_pending`.** For the calling worker only, the list starts with one entry per expired idle own claim: `{kind:'assignment', request_id, resume:true, idle_seconds, previous_epoch, note}`. The note tells the run to read progress and owner notes with `get`, then call `claim(request_id, claimant, acquisition_id)`. Generate one random `acquisition_id` per independent run and reuse it for retries. Keep it in private saved run state, with the claimant and claim ID, across QUESTION/answer pauses and reconnects of that run, and never print it in diagnostics or examples.
69
+ - **`claim` rotates the epoch after expiry.** A new epoch requires the prior lease deadline to pass and all old host checks to have verified stop receipts. Sending, uncertain and terminal-unknown job deliveries hold regrant until positive reconciliation. A same-worker, same-subject, same-claimant retry with the matching acquisition ID retains the live grant (`duplicate:true`); omitted IDs match an unkeyed claim. Exact retries are recognized before rotation, but in built-in mode a retry must come from the live connection that holds the grant; it does not re-run destination or repository policy. A different run uses a new acquisition ID and waits for expiry; it cannot reuse a grant obtained from `get`. A new epoch moves the worktree and sealed uploads, retires queued old-generation questions and fences the old `claim_id`. Unsealed uploads remain bound to the old epoch. See the [protocol truth table](../PROTOCOL.md#claims-and-worker-tools).
70
+ - **Record.** Lifecycle gets a `claimed` event with reason `resume` (it does not count toward claims per hour), and the progress history gets a `[bridge] run resumed: epoch N stopped after Ss ...` line.
71
+ - **Switch.** `DALAN_RESUME_IDLE_MS=0` turns all of it off: the signal, the `list_pending` entries and the rotation. Exact acquisition identity checks still apply: omission matches only a stored NULL, and a different live acquisition is refused. The switch never permits early regrant. Set it in the bridge service environment and restart.
72
+ - **Progress nudge (opt in per worker).** In `workers.json` set `"guidance": "resume"` for the worker. `claim` and `get` then add acquisition and progress guidance. The progress interval is half the idle threshold, rounded down to a multiple of 30 seconds, with a minimum of 30 seconds. Thresholds of `120000`, `240000`, and `45000` ms produce intervals of 1 minute, 2 minutes, and 30 seconds. For the default threshold the text is: "Generate one random acquisition_id per run and pass it on every claim call, including retries. Post progress at least every 1 minute with what is done and what remains, so a resumed run can continue; if your run may end, post progress first." With the switch at 0, guidance uses the default threshold. The only valid guidance value is `"resume"`.
73
+ - **Measure.** `dalan metrics --json` has `resume_wake.by_worker.<worker>`: `resumed`, `lease_expiry_retries`, and `time_to_finish_resumed` against `time_to_finish_lease_expiry` (first queued event to completed, p50/p90). `resume_wake.duplicate_epoch_claims` must be 0. The text form prints `resumed=` and `duplicate_epochs=`. Falsifier: resumed jobs do not finish sooner than lease-expiry jobs.
74
+
75
+ Maintainer check: from a source checkout installed with `npm ci`, run `node scripts/resume-wake-test.mjs`. The npm package does not include this script.
76
+
77
+ ### Poll interval and URL secrecy
78
+
79
+ - Tailscale Funnel, Cloudflare tunnel or your own proxy: every 60 seconds.
80
+ - ngrok: every 300 seconds. The free plan has a monthly request quota, and a 60-second hook uses up much of it. `signal-token` prints the advised interval on stderr.
81
+ - Anyone with the URL can learn whether work is waiting, and nothing more. Store it like a password; if it leaks, run `--rotate` and update the hook.
82
+ - The bridge limits each source address to about one request every 5 seconds (burst 3), and the whole bridge to 30 per minute. Excess requests get `429` with `Retry-After`. Behind a tunnel, every caller shares one bucket, so keep to the intervals above.
83
+
84
+ ## Jobs the worker never takes
85
+
86
+ An unclaimed job stays queued unless a cancellation rule applies. **Preparation expiry applies to every worker:** when the sweep runs, an expired requester deadline cancels queued work with reason `expired`. A learned `queue_p90` deadline can be refreshed up to twice if history supplies a fresh window and at least 15 minutes remain before the 12-hour cap from creation. Otherwise the queued job is cancelled. Claimed jobs and jobs without a deadline are exempt. Learned defaults are suppressed for background submissions and while paused; for `dot`, an owner-confirmed usage break also suppresses them. Explicit deadlines still apply, and pause or break time does not extend them. The maintenance sweep runs while delivery is paused. See [preparation expiry](operations.md#usage-breaks-and-usage-estimates).
87
+
88
+ **Skip expiry is separate and default-worker only:** a queued default-worker job is cancelled with reason `skipped_by_worker` once its skip marker is at least 6 hours old and it has been passed over at least 3 times (set the hours with `DALAN_SKIP_EXPIRE_HOURS`). Other workers are exempt from skip expiry, not from preparation expiry. The 2-hour re-wake window only moves older jobs to stale backoff; it does not cancel them. The requester can inspect the state with `dalan get` or cancel with `dalan cancel REQUEST_ID`.
89
+
90
+ ## Vendor notes
91
+
92
+ Scheduling and hook support vary by product, account and workspace policy. Check the vendor's current documentation and the controls available in the intended account before choosing a pattern. Dalan supplies neither a scheduler nor a worker-start command. Until that account's scheduled or hook-driven path has completed a real job, use the manual pattern above.
93
+
94
+ More detail: the "Wake signal for hook-driven workers" section of [portable-auth-profile.md](portable-auth-profile.md) and the hook-driven worker example in [scripts/live-trial/README.md](https://github.com/tnunamak/dalan/blob/main/scripts/live-trial/README.md).