@wjarka/cezarion 0.14.8-pr540.823 → 0.14.9-dev.1004

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 (174) hide show
  1. package/README.md +56 -3
  2. package/dist/automations/scheduler.d.ts +6 -0
  3. package/dist/automations/scheduler.js +45 -17
  4. package/dist/automations/scheduler.js.map +1 -1
  5. package/dist/automations/store.d.ts +12 -4
  6. package/dist/automations/store.js +199 -22
  7. package/dist/automations/store.js.map +1 -1
  8. package/dist/automations/types.d.ts +2 -0
  9. package/dist/automations/types.js +1 -0
  10. package/dist/automations/types.js.map +1 -1
  11. package/dist/contract/automations.d.ts +6 -0
  12. package/dist/contract/delegation.d.ts +29 -0
  13. package/dist/contract/discovery.d.ts +134 -0
  14. package/dist/contract/index.d.ts +1 -0
  15. package/dist/contract/index.js +1520 -1447
  16. package/dist/contract/projects.d.ts +40 -0
  17. package/dist/contract/runs.d.ts +43 -0
  18. package/dist/contract/skills.d.ts +5 -0
  19. package/dist/core/claude-cli-runner.js +1 -1
  20. package/dist/core/claude-cli-runner.js.map +1 -1
  21. package/dist/core/cursor-acp-runner.d.ts +2 -0
  22. package/dist/core/cursor-acp-runner.js +159 -26
  23. package/dist/core/cursor-acp-runner.js.map +1 -1
  24. package/dist/core/cursor-provider-error.d.ts +3 -0
  25. package/dist/core/cursor-provider-error.js +14 -1
  26. package/dist/core/cursor-provider-error.js.map +1 -1
  27. package/dist/core/opencode-server-runner.js +12 -5
  28. package/dist/core/opencode-server-runner.js.map +1 -1
  29. package/dist/core/pi-runner.js +17 -4
  30. package/dist/core/pi-runner.js.map +1 -1
  31. package/dist/core/provider-auth.d.ts +99 -1
  32. package/dist/core/provider-auth.js +203 -2
  33. package/dist/core/provider-auth.js.map +1 -1
  34. package/dist/delegation/cli.d.ts +1 -0
  35. package/dist/delegation/cli.js +1 -1
  36. package/dist/delegation/cli.js.map +1 -1
  37. package/dist/delegation/policy.d.ts +3 -2
  38. package/dist/delegation/policy.js +3 -1
  39. package/dist/delegation/policy.js.map +1 -1
  40. package/dist/delegation/process-liveness.d.ts +66 -0
  41. package/dist/delegation/process-liveness.js +215 -0
  42. package/dist/delegation/process-liveness.js.map +1 -0
  43. package/dist/delegation/provision.d.ts +1 -1
  44. package/dist/delegation/provision.js +5 -2
  45. package/dist/delegation/provision.js.map +1 -1
  46. package/dist/delegation/results.js +10 -6
  47. package/dist/delegation/results.js.map +1 -1
  48. package/dist/delegation/routes.d.ts +101 -54
  49. package/dist/delegation/routes.js +3 -2
  50. package/dist/delegation/routes.js.map +1 -1
  51. package/dist/delegation/service.d.ts +8 -1
  52. package/dist/delegation/service.js +56 -7
  53. package/dist/delegation/service.js.map +1 -1
  54. package/dist/delegation/transport.d.ts +40 -4
  55. package/dist/discovery/catalog.d.ts +14 -0
  56. package/dist/discovery/catalog.js +31 -0
  57. package/dist/discovery/catalog.js.map +1 -0
  58. package/dist/discovery/cli.d.ts +8 -0
  59. package/dist/discovery/cli.js +104 -0
  60. package/dist/discovery/cli.js.map +1 -0
  61. package/dist/git-worktree.d.ts +3 -1
  62. package/dist/git-worktree.js +26 -4
  63. package/dist/git-worktree.js.map +1 -1
  64. package/dist/index.js +20 -0
  65. package/dist/index.js.map +1 -1
  66. package/dist/runs/agent-tmpdir.d.ts +2 -0
  67. package/dist/runs/agent-tmpdir.js +5 -2
  68. package/dist/runs/agent-tmpdir.js.map +1 -1
  69. package/dist/runs/retention.d.ts +7 -2
  70. package/dist/runs/retention.js +39 -7
  71. package/dist/runs/retention.js.map +1 -1
  72. package/dist/runs/store.d.ts +22 -0
  73. package/dist/runs/store.js +82 -1
  74. package/dist/runs/store.js.map +1 -1
  75. package/dist/runs/webhook.d.ts +125 -0
  76. package/dist/runs/webhook.js +256 -0
  77. package/dist/runs/webhook.js.map +1 -0
  78. package/dist/server/provider-auth-runtime.d.ts +30 -4
  79. package/dist/server/provider-auth-runtime.js +71 -6
  80. package/dist/server/provider-auth-runtime.js.map +1 -1
  81. package/dist/server/server.d.ts +3673 -2420
  82. package/dist/server/server.js +139 -11
  83. package/dist/server/server.js.map +1 -1
  84. package/dist/server-install/platforms/ubuntu-vps.d.ts +5 -1
  85. package/dist/server-install/platforms/ubuntu-vps.js +160 -18
  86. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
  87. package/dist/server-install/steps.d.ts +4 -2
  88. package/dist/server-install/steps.js +5 -4
  89. package/dist/server-install/steps.js.map +1 -1
  90. package/dist/skills-remote.d.ts +30 -5
  91. package/dist/skills-remote.js +122 -32
  92. package/dist/skills-remote.js.map +1 -1
  93. package/dist/skills.js +15 -6
  94. package/dist/skills.js.map +1 -1
  95. package/dist/task-cli/cli.js +124 -7
  96. package/dist/task-cli/cli.js.map +1 -1
  97. package/dist/task-cli/discovery.js +6 -5
  98. package/dist/task-cli/discovery.js.map +1 -1
  99. package/dist/task-cli/http.d.ts +3 -0
  100. package/dist/task-cli/http.js.map +1 -1
  101. package/dist/task-cli/watch.d.ts +19 -0
  102. package/dist/task-cli/watch.js +35 -2
  103. package/dist/task-cli/watch.js.map +1 -1
  104. package/dist/workflows/run.d.ts +67 -2
  105. package/dist/workflows/run.js +325 -27
  106. package/dist/workflows/run.js.map +1 -1
  107. package/dist/workspace/agent-profiles.d.ts +22 -0
  108. package/dist/workspace/agent-profiles.js +15 -0
  109. package/dist/workspace/agent-profiles.js.map +1 -1
  110. package/dist/workspace/config.d.ts +9 -0
  111. package/dist/workspace/config.js +13 -1
  112. package/dist/workspace/config.js.map +1 -1
  113. package/dist/workspace/projects.d.ts +24 -1
  114. package/dist/workspace/projects.js +14 -1
  115. package/dist/workspace/projects.js.map +1 -1
  116. package/package.json +5 -5
  117. package/scripts/mock-claude.mjs +26 -0
  118. package/scripts/mock-codex-app-server.mjs +26 -0
  119. package/scripts/mock-cursor-acp.mjs +51 -3
  120. package/scripts/mock-cursor-hang-stdin-late.mjs +35 -0
  121. package/scripts/mock-cursor-hang-stdin.mjs +30 -0
  122. package/scripts/mock-opencode-serve.mjs +33 -0
  123. package/scripts/mock-pi-rpc.mjs +22 -4
  124. package/web/dist/assets/agent-accounts-CerclGiO.js +1 -0
  125. package/web/dist/assets/centered-state-DH8qtCz-.js +43 -0
  126. package/web/dist/assets/{collapsible-Bb2y0asn.js → collapsible-De2G0xqQ.js} +1 -1
  127. package/web/dist/assets/{commit-list-DpxX-bA4.js → commit-list-CQubP1iS.js} +1 -1
  128. package/web/dist/assets/compare-variants-C_NijJvg.js +1 -0
  129. package/web/dist/assets/{diff-rDeblLVZ2.js → diff-8M5HlDxq2.js} +2 -2
  130. package/web/dist/assets/{diff-controls-frbAqBK1.js → diff-controls-B6ok0TtQ.js} +1 -1
  131. package/web/dist/assets/{diff-stat-Cn7rzy1H.js → diff-stat-D1AODN2a.js} +1 -1
  132. package/web/dist/assets/{diff-view-D6N_QzSq.js → diff-view-Bs5Gh7UF.js} +2 -2
  133. package/web/dist/assets/{dropdown-menu-Bwvi4Ono.js → dropdown-menu-7KGQMoFj.js} +1 -1
  134. package/web/dist/assets/{git-toolbar-5TyOh819.js → git-toolbar-DqbapMXr.js} +1 -1
  135. package/web/dist/assets/github-lMHiuYSx.js +1 -0
  136. package/web/dist/assets/{image-preview-B618kDBH.js → image-preview-jzHoEyLM.js} +1 -1
  137. package/web/dist/assets/index-D4OJTArJ.js +7 -0
  138. package/web/dist/assets/index-D5NkwqY7.css +1 -0
  139. package/web/dist/assets/{markdown-BnjmXdz2.js → markdown-DvbymqXz.js} +1 -1
  140. package/web/dist/assets/pill-BL6ugwXo.js +1 -0
  141. package/web/dist/assets/{project-router-BSpCQc8A.js → project-router-ChC5Rb-Y.js} +1 -1
  142. package/web/dist/assets/{prompt-templates-BsHnTixc.js → prompt-templates-j8qlK7c-.js} +3 -3
  143. package/web/dist/assets/repo-git-BbPAgkqb.js +1 -0
  144. package/web/dist/assets/{run-diff-CFeYdPGE.js → run-diff-BuATgZpx.js} +2 -2
  145. package/web/dist/assets/run-header-DuAWswYM.js +1 -0
  146. package/web/dist/assets/skills-DiC2XrU1.js +1 -0
  147. package/web/dist/assets/{tab-link-BXDesc8g.js → tab-link-BmGKj9Rt.js} +1 -1
  148. package/web/dist/assets/{task-changes-DfF08cUG.js → task-changes-CP9kPnsy.js} +1 -1
  149. package/web/dist/assets/{task-commits-BMmpYP5e.js → task-commits-D6NfTw5r.js} +1 -1
  150. package/web/dist/assets/{task-files-D_dKDdRK.js → task-files-W-b_gtcb.js} +2 -2
  151. package/web/dist/assets/task-thread-Bw_nQuTx.css +1 -0
  152. package/web/dist/assets/task-thread-Q7Nj33DH.js +9 -0
  153. package/web/dist/assets/{textarea-COQtp9cB.js → textarea-ByZ-txS7.js} +1 -1
  154. package/web/dist/assets/thread-loading-DHT9p5o5.js +1 -0
  155. package/web/dist/assets/{token-metrics-CFWQYcgY.js → token-metrics-k4XoovDS.js} +1 -1
  156. package/web/dist/assets/{utils-DKheTxGD.js → utils-BTFBhZ55.js} +1 -1
  157. package/web/dist/assets/workflows-DqQszPHJ.js +11 -0
  158. package/web/dist/assets/{zoomable-image-YW3Qdrr_.js → zoomable-image-Ba6y6Wyl.js} +1 -1
  159. package/web/dist/index.html +14 -14
  160. package/web/dist/assets/agent-accounts-B7aDlJ4I.js +0 -1
  161. package/web/dist/assets/centered-state-wm14n-hB.js +0 -43
  162. package/web/dist/assets/compare-variants-DbPcvMtU.js +0 -1
  163. package/web/dist/assets/github-Dyo38xkh.js +0 -1
  164. package/web/dist/assets/ibm-plex-mono-regular-BF3vfe7_.ttf +0 -0
  165. package/web/dist/assets/index-dgQfUHKO.css +0 -1
  166. package/web/dist/assets/index-yCn9jZqm.js +0 -7
  167. package/web/dist/assets/pill-DqEXer06.js +0 -1
  168. package/web/dist/assets/repo-git-Cw1UOtWI.js +0 -1
  169. package/web/dist/assets/run-header-G5PQQyme.js +0 -1
  170. package/web/dist/assets/skills-DMvpMI_E.js +0 -1
  171. package/web/dist/assets/task-thread-BL7keYuU.js +0 -9
  172. package/web/dist/assets/task-thread-BQFdz1dJ.css +0 -1
  173. package/web/dist/assets/thread-loading-B7mgkPaL.js +0 -1
  174. package/web/dist/assets/workflows-DLCH6MDH.js +0 -11
package/README.md CHANGED
@@ -508,6 +508,21 @@ not settings to create or share. If the tool is unavailable or denied, its error
508
508
  is surfaced while ordinary tasks continue. See [the CI-wait protocol](AGENT_PROTOCOL.md#ci-wait-tool-contract-474)
509
509
  for limits and the executable harness verification required before release.
510
510
 
511
+ ## Discover runners and models
512
+
513
+ Inspect the same host catalog the cockpit uses before selecting a runner or model:
514
+
515
+ ```sh
516
+ cez discover runners
517
+ cez discover models --runner=codex
518
+ ```
519
+
520
+ Both commands return JSON. `runners` lists connection status (`connected`, `disconnected`, `not-installed`, or `unknown`) and enablement, with `scope: "host-default-account"`. Model rows include `effortLevels` when the runner advertises them: an absent field means unknown; an empty array means no advertised levels. Omit `--effort` when spawning to keep the existing default. Model responses retain `source`, `stale`, and any unavailable `reason`; discovery never invents model IDs or effort support.
521
+
522
+ For operators, the command finds the running cockpit for the current checkout; `--repo`, `--url`, and `CEZ_URL` work as they do for `cez task`. A missing cockpit returns an error and never starts a server. Inside a parent delegation session, the same command uses that session's authenticated controller, including headless runs. It rejects `--url` and `--repo` in that context and never falls back to a public cockpit after an authentication failure. Owned workers cannot use the private discovery route.
523
+
524
+ The catalog describes host default accounts, not every named account or the selections permitted by a task's model locks and workflow pins. Existing `cez task start` and `cez worker spawn` still call their runner flag `--backend`; discovery uses `--runner`.
525
+
511
526
  ## Owned workers (opt-in)
512
527
 
513
528
  Start the cockpit or a headless task with `CEZ_DELEGATION=1`. Each eligible parent session receives the absolute bundled Node/CLI invocation and its own environment credentials; no `cez` installation on the agent's PATH, config file, separate daemon, or remembered port is needed. If the private listener cannot start, ordinary tasks keep working without delegation tools. `.env` is never loaded automatically.
@@ -543,6 +558,8 @@ Use `cez worker --help` to list operations and flags, or `cez worker <operation>
543
558
 
544
559
  `--workflow <name>` runs a catalog workflow inside the worker: the built-in `quick-task` or any `.ai/cezar/workflows/*.yaml` by name, with its agent and check steps, `skill:` bodies and `onFail` loops, so a repo's `review.yaml` becomes a dedicated reviewer. Omitted `--workflow` runs `quick-task` exactly as before. `--backend`, `--model` and `--effort` fill only the steps that leave those fields unset; a step's own `allowedTools`/`bashAllowlist` narrow the parent's grants and never widen them. An unknown name is refused. Agent steps may mix runners: at spawn every agent step is resolved and pinned separately, so an implement-with-codex, review-with-claude chain runs each step under its own runner, account, model, effort and grants. A step's optional `agentProfile` names the account it runs under (an id the registry does not know is refused); same-backend steps otherwise inherit the parent's account and other runners resolve their project/default one. Run-level columns show the first agent step.
545
560
 
561
+ Explicit default-account model pins are checked against a fresh, nonempty host catalog after account/model resolution and before a worker is created. Named accounts retain existing validation because a default-account catalog cannot disprove their model access. A miss returns `invalid_input`, available models with advertised efforts, and other runners listing the requested ID in `modelChoices`. Empty, stale, or unavailable discovery leaves existing selection validation in place. Accepted retries and omitted model defaults are unchanged.
562
+
546
563
  Omitted `--backend` inherits the parent's active backend. Same-backend workers inherit omitted model/account/effort; `--backend <claude|codex|opencode|pi|cursor>` selecting another backend resolves that backend's project/default account and model without forwarding another provider's settings. `--model <model>` selects a supported model, subject to existing locks. `--effort <low|medium|high|xhigh|max>` pins reasoning effort on same-backend and mixed-backend spawn; omitted `--effort` still inherits the parent pin on same-backend spawn and drops it on mixed-backend spawn. Accepted identity and grants remain fixed across queuing, restart and Continue, including explicit empty grants. Changing or deleting an account registry entry does not rebind a worker. Missing accepted identity evidence or account homes, incompatible Claude state-file layouts, and conflicting later model locks refuse execution explicitly. Credentials and vendor configuration are never copied; each worker receives its own delegation credential, and unspecified native models stay unspecified.
547
564
 
548
565
  Wait registers immediately. End the parent turn to release scheduler capacity; Cezar resumes it on a selected settled outcome or the finite deadline. `any` is the default, `one` requires exactly one worker, and `all` waits for every selected worker. Review, completion, failure, cancellation with proven termination, and destruction are outcomes. Timeout defaults to 600 seconds (1–1800 accepted). `cancel-wait` is idempotent for the retained wait ID and cannot cancel a newer wait. Timeout and wait cancellation report partial outcomes and unresolved workers, never cancel workers, and never automatically re-wait. Steering is attributed agent input and cannot answer a pending human question.
@@ -575,7 +592,7 @@ project), or you point it at one with `--url` / `CEZ_URL`.
575
592
 
576
593
  ```bash
577
594
  id=$(cez task start --task-file - <<'EOF' | jq -r .id
578
- Fix the flaky login test. Quote "anything" you like here.
595
+ Fix the `cez task` docs. Keep $(example) and "quotes" literal.
579
596
  EOF
580
597
  )
581
598
  cez task wait "$id" --until attention --timeout-seconds 900 # 0 done/review · 1 failed · 3 timeout
@@ -584,13 +601,48 @@ cez task send "$id" 'Use the retry helper instead' # queued, delivere
584
601
  cez task log "$id" --follow --timeout-seconds 300 # JSON lines until it ends
585
602
  ```
586
603
 
604
+ Use `--task-file PATH` to read a saved task (for example, `cez task start --task-file task.md`),
605
+ or `--task-file -` to read stdin as above. The quoted heredoc delimiter (`<<'EOF'`) keeps
606
+ backticks and `$()` literal in the task text.
607
+
608
+ POSIX shells, including Bash, expand backticks and `$()` in double-quoted arguments before
609
+ cez receives the text. **Do not put raw backticks in double-quoted task arguments.** This can
610
+ execute parts of your prompt as shell commands and leave holes in the stored task, including
611
+ when starting tasks through SSH and `bash -lc`. Prefer a task file or stdin with a quoted
612
+ heredoc delimiter. A single-quoted positional argument still works for short tasks:
613
+ `cez task start 'Fix the typo'`.
614
+
615
+ `cez task start --task-file task.md --skill <name>` names one skill as the task's agent step;
616
+ `--skill` and `--workflow` are mutually exclusive. The CLI checks `GET /skills` first and
617
+ includes a `warning` in its JSON result if the skill is missing or the catalog cannot be
618
+ checked; it still starts the run. Like a cockpit skill start, if the skill is missing at
619
+ execution, the agent uses the plain prompt and the run logs a note. CLI starts do not change
620
+ the cockpit composer's recent picks or skill-usage ranking.
621
+ Without either flag, `start` still runs `quick-task`.
622
+
587
623
  `start` is retry-safe: it sends a request id (`--request-id <UUID>` to pick your own), and a
588
624
  retry with the same id and task answers with the run the first one created (`created: false`)
589
- instead of starting a second. Also: `list`, `stop`, `finish`, `diff [--stat]`, `open`. Exit codes:
625
+ instead of starting a second. Also: `list`, `stop`, `finish`, `diff [--stat]`, `open`.
626
+ Use `archive <id>` to hide a task from `list`, `unarchive <id>` to restore it, and
627
+ `list --all` to include archived tasks. `archive-finished` sweeps finished tasks and prints
628
+ `{"archived": count}`. The single-task commands print `{"id": "…", "archived": true|false}`.
629
+ Exit codes:
590
630
  `0` ok, `1` task failed/cancelled or a message was not delivered, `2` no cockpit or the cockpit
591
631
  refused (its `error` is passed through), `3` timed out, `64` usage error. `cez task --help` lists
592
632
  every flag.
593
633
 
634
+ **A bot that lives behind an HTTP endpoint** does not have to poll. Set a **Task webhook** (URL
635
+ and an optional Bearer token) in the project's **Settings → General**, and every task that opts
636
+ in POSTs `task.status` on each status change, `task.question` when it asks something,
637
+ `task.activity` when monitoring starts or ends, and `task.subscribed` when it opts in (at start, or when it is handed off). Each
638
+ body carries the same slim projection `cez task status` prints, under `task`. `cez task start`
639
+ opts in whenever the project has a webhook (`--no-notify` to skip it); the cockpit's New task form
640
+ has a **Notify webhook** toggle; and a running task's **Hand off** button (or
641
+ `cez task notify <id> --message '…'`) turns it on later with a note for the bot. The note goes to
642
+ the webhook only, never to the agent. Delivery is best-effort: 10 s timeout, 3 attempts, and a
643
+ failure shows in the thread without touching the task. The token is stored in `~/.cezar` and never
644
+ sent back to a browser. Under `CEZ_DRY_RUN=1` nothing is sent; the payload is logged in the thread.
645
+
594
646
  ## Workflow format
595
647
 
596
648
  A workflow is a small YAML file in `.ai/cezar/workflows/`:
@@ -650,7 +702,7 @@ Useful environment variables:
650
702
  |---|---|
651
703
  | `CEZ_DELEGATION=1` | Enable owned workers and the private loopback listener for this controller. Off by default; works with the cockpit and headless `cez run`. Session instructions and credentials are automatic. |
652
704
  | `CEZ_DELEGATION_URL`, `CEZ_DELEGATION_TOKEN` | Internal generated session values; do not configure or copy them. Tokens rotate on Continue/restart and are revoked when the session/controller closes. |
653
- | `CEZ_URL` | Cockpit origin for `cez task` (e.g. a hosted `CEZ_REMOTE` cockpit). Unset, `cez task` finds the local cockpit serving this checkout on ports 4321–4370. |
705
+ | `CEZ_URL` | Cockpit origin for `cez task` and operator `cez discover` (e.g. a hosted `CEZ_REMOTE` cockpit). Unset, they find the local cockpit serving this checkout on ports 4321–4370. Parent discovery uses its delegation controller instead. |
654
706
  | `CEZ_DRY_RUN=1` | Use bundled mocks for all five agent backends — the cockpit works offline for demos and development. Explicit backend binary overrides still win. |
655
707
  | `CEZ_AGENT_MODELS_LOCKED=1` | Globally lock each runner to the model configured in its native Claude/Codex/OpenCode settings while keeping runner selection available. Exact `1` also delegates authentication and provider enablement to those native agents, so Cezar skips its credential probes and provider-disable preferences. Existing Cezar presets are preserved but ignored, and an environment change requires a restart. The config-file equivalent is `"modelsLocked": true` in global `~/.cezar/config.json` or one repository's `.ai/cezar/config.json`; config-file locks do not disable provider checks. |
656
708
  | `CEZ_APPROVAL_GATE=1` | Opt into Claude's interactive approval UI; by default, unapproved tools are denied without interrupting the run. Ignored when `CEZ_CLAUDE_PERMISSION_MODE` is a recognized value (`dontAsk`, `acceptEdits`, or `bypass`). |
@@ -685,6 +737,7 @@ Useful environment variables:
685
737
  | `CEZ_REVIEW_GATE=1` | Turn ON the optional diff-first review gate (#489): a successful, non-autonomous run with changes parks at `review` (Accept / Send back / Draft PR) instead of finishing. Off by default — changed runs settle to `done` with the diff left in the worktree. Only `1` enables. The Settings → Agents toggle overrides this; autonomous runs always skip it. |
686
738
  | `CEZ_NO_BANNER=1` | Skip the `open-mercato/skills` banner on `cez serve` startup. (The cockpit no longer shows a banner — its skills now live on the Skills page's Manage panel — so this env var is the terminal banner's only switch.) |
687
739
  | `VITE_CEZ_API_BASE=http://localhost:4321` | **Build time only**, and only when the cockpit bundle is deployed apart from the service it talks to. Empty (the default) means "the origin that served this page", which is right for both normal cases: the CLI serves the bundle itself, and `npm run dev` proxies `/api` to the local service. A deployment that must be configured without a rebuild can put `<meta name="cez-api-base" content="…">` in the served HTML instead, which wins over this. |
740
+ | `VITE_CEZ_E2E=1` | **Build time only.** The cockpit e2e suite sets this when it builds the bundle it drives. It pins `useNow` and every `refetchInterval` so a wait cannot span a 30s tick or a 4s poll. Leave unset for production. |
688
741
 
689
742
  ### Troubleshooting: the agent's shell returns nothing
690
743
 
@@ -15,11 +15,16 @@ export interface ProjectAutomationHandle {
15
15
  launch?: AutomationLauncher;
16
16
  onChange?: (automationId: string, revision: number) => void;
17
17
  }
18
+ /** A different process currently owns this project's poll lock. */
19
+ export declare class LeaseHeldError extends Error {
20
+ constructor();
21
+ }
18
22
  export declare class ProjectAutomationScheduler {
19
23
  private readonly handle;
20
24
  constructor(handle: ProjectAutomationHandle);
21
25
  check(definition: AutomationDefinition, mode?: 'preview' | 'execute'): Promise<GithubPollResult>;
22
26
  private launch;
27
+ private recordSkip;
23
28
  private recordFailure;
24
29
  }
25
30
  export interface WorkspaceAutomationSchedulerOptions {
@@ -33,6 +38,7 @@ export declare class WorkspaceAutomationScheduler {
33
38
  private timer?;
34
39
  private stopped;
35
40
  private scheduleGeneration;
41
+ private readonly retryAfter;
36
42
  constructor(options: WorkspaceAutomationSchedulerOptions);
37
43
  start(): Promise<void>;
38
44
  reschedule(): Promise<void>;
@@ -9,6 +9,10 @@ class GithubRequestArbiter {
9
9
  }
10
10
  }
11
11
  const githubRequests = new GithubRequestArbiter();
12
+ /** A different process currently owns this project's poll lock. */
13
+ export class LeaseHeldError extends Error {
14
+ constructor() { super('automation polling lease is held by another process'); }
15
+ }
12
16
  export class ProjectAutomationScheduler {
13
17
  handle;
14
18
  constructor(handle) {
@@ -19,12 +23,13 @@ export class ProjectAutomationScheduler {
19
23
  if (detectionOnly)
20
24
  mode = 'preview';
21
25
  const { store } = this.handle;
22
- const lease = store.acquireLease();
23
- if (!lease)
24
- throw new Error('automation polling lease is held by another process');
25
26
  const started = Date.now();
26
27
  let completion;
28
+ let lease;
27
29
  try {
30
+ lease = store.acquireLease();
31
+ if (!lease)
32
+ throw new LeaseHeldError();
28
33
  const state = store.state(definition.id) ?? {};
29
34
  if (state.backoffUntil && Date.parse(state.backoffUntil) > Date.now()) {
30
35
  throw new Error(`automation is backed off until ${state.backoffUntil}`);
@@ -76,39 +81,53 @@ export class ProjectAutomationScheduler {
76
81
  return { ...result, candidates: eligible };
77
82
  }
78
83
  catch (error) {
79
- if (mode === 'execute')
80
- this.recordFailure(definition, error);
84
+ if (error instanceof LeaseHeldError)
85
+ await this.recordSkip(definition, error);
86
+ else if (mode === 'execute')
87
+ await this.recordFailure(definition, error);
81
88
  else
82
- store.appendLog({ automationId: definition.id, revision: definition.revision, result: 'error', reason: error instanceof Error ? error.message : String(error) });
89
+ await store.appendLog({ automationId: definition.id, revision: definition.revision, result: 'error', reason: error instanceof Error ? error.message : String(error) });
83
90
  throw error;
84
91
  }
85
92
  finally {
86
- if (completion)
87
- store.appendLog({ automationId: definition.id, revision: definition.revision, ...completion, durationMs: Date.now() - started });
88
93
  try {
89
- store.maybeCompact();
94
+ if (completion)
95
+ await store.appendLog({ automationId: definition.id, revision: definition.revision, ...completion, durationMs: Date.now() - started });
96
+ if (lease) {
97
+ try {
98
+ await store.maybeCompact();
99
+ }
100
+ catch { /* append-only state remains readable; next check retries */ }
101
+ }
102
+ }
103
+ finally {
104
+ lease?.release();
90
105
  }
91
- catch { /* append-only state remains readable; next check retries */ }
92
- lease.release();
93
106
  }
94
107
  }
95
108
  async launch(definition, candidate) {
96
109
  const receipt = this.handle.store.reserveReceipt({ automationId: definition.id, revision: definition.revision, eventId: candidate.eventId, candidate });
97
110
  if (!receipt) {
98
- this.handle.store.appendLog({ automationId: definition.id, revision: definition.revision, event: candidate.event, result: 'duplicate', reason: 'A durable receipt already exists for this automation and event.', githubNumber: candidate.number, githubTitle: candidate.title, githubUrl: candidate.url });
111
+ await this.handle.store.appendLog({ automationId: definition.id, revision: definition.revision, event: candidate.event, result: 'duplicate', reason: 'A durable receipt already exists for this automation and event.', githubNumber: candidate.number, githubTitle: candidate.title, githubUrl: candidate.url });
99
112
  return;
100
113
  }
101
114
  try {
102
115
  const launched = await this.handle.launch(definition, candidate, receipt.receiptId);
103
116
  this.handle.store.appendReceipt({ ...receipt, status: 'launched', runId: launched.runId, updatedAt: new Date().toISOString() });
104
- this.handle.store.appendLog({ automationId: definition.id, revision: definition.revision, event: candidate.event, result: 'launched', receiptId: receipt.receiptId, runId: launched.runId, githubNumber: candidate.number, githubTitle: candidate.title, githubUrl: candidate.url });
117
+ await this.handle.store.appendLog({ automationId: definition.id, revision: definition.revision, event: candidate.event, result: 'launched', receiptId: receipt.receiptId, runId: launched.runId, githubNumber: candidate.number, githubTitle: candidate.title, githubUrl: candidate.url });
105
118
  }
106
119
  catch (error) {
107
120
  this.handle.store.appendReceipt({ ...receipt, status: 'launch-error', error: error instanceof Error ? error.message : String(error), updatedAt: new Date().toISOString() });
108
121
  throw error;
109
122
  }
110
123
  }
111
- recordFailure(definition, error) {
124
+ async recordSkip(definition, error) {
125
+ const { store } = this.handle;
126
+ await store.appendLog({ automationId: definition.id, revision: definition.revision, result: 'skipped', reason: error.message });
127
+ // The lease owner may be writing state. The workspace retry floor handles our next attempt.
128
+ this.handle.onChange?.(definition.id, definition.revision);
129
+ }
130
+ async recordFailure(definition, error) {
112
131
  const state = this.handle.store.state(definition.id) ?? {};
113
132
  const failures = (state.consecutiveFailures ?? 0) + 1;
114
133
  const delay = Math.min(6 * 60 * 60_000, 60_000 * 2 ** (failures - 1));
@@ -118,7 +137,7 @@ export class ProjectAutomationScheduler {
118
137
  backoffUntil: new Date(Date.now() + delay).toISOString(),
119
138
  nextCheckAt: new Date(Date.now() + delay).toISOString(),
120
139
  });
121
- this.handle.store.appendLog({ automationId: definition.id, revision: definition.revision, result: 'error', reason: error instanceof Error ? error.message : String(error) });
140
+ await this.handle.store.appendLog({ automationId: definition.id, revision: definition.revision, result: 'error', reason: error instanceof Error ? error.message : String(error) });
122
141
  this.handle.onChange?.(definition.id, definition.revision);
123
142
  }
124
143
  }
@@ -131,12 +150,14 @@ function laterCursor(current, observed) {
131
150
  || observed.tieBreaker.localeCompare(current.tieBreaker ?? '');
132
151
  return order > 0 ? observed : current;
133
152
  }
153
+ const MIN_RETRY_MS = 60_000;
134
154
  /** One workspace timer, created only while at least one enabled definition exists. */
135
155
  export class WorkspaceAutomationScheduler {
136
156
  options;
137
157
  timer;
138
158
  stopped = true;
139
159
  scheduleGeneration = 0;
160
+ retryAfter = new Map();
140
161
  constructor(options) {
141
162
  this.options = options;
142
163
  }
@@ -168,6 +189,7 @@ export class WorkspaceAutomationScheduler {
168
189
  if (this.stopped)
169
190
  return;
170
191
  const due = [];
192
+ const live = new Set();
171
193
  for (const projectId of this.options.coordinator.enabledProjectIds()) {
172
194
  const store = this.options.coordinator.store(projectId);
173
195
  if (!store)
@@ -176,16 +198,22 @@ export class WorkspaceAutomationScheduler {
176
198
  if (!handle)
177
199
  continue;
178
200
  for (const definition of store.list().filter((item) => item.enabled)) {
179
- due.push({ at: Date.parse(store.state(definition.id)?.nextCheckAt ?? new Date().toISOString()), definition, scheduler: new ProjectAutomationScheduler(handle) });
201
+ const key = `${projectId}:${definition.id}`;
202
+ live.add(key);
203
+ const at = Date.parse(store.state(definition.id)?.nextCheckAt ?? new Date().toISOString());
204
+ due.push({ key, at: Math.max(at, this.retryAfter.get(key) ?? 0), retryAfterMs: Math.max(definition.intervalSeconds * 1_000, MIN_RETRY_MS), definition, scheduler: new ProjectAutomationScheduler(handle) });
180
205
  }
181
206
  }
207
+ for (const key of this.retryAfter.keys())
208
+ if (!live.has(key))
209
+ this.retryAfter.delete(key);
182
210
  if (!due.length)
183
211
  return;
184
212
  due.sort((a, b) => a.at - b.at);
185
213
  const next = due[0];
186
214
  this.timer = setTimeout(() => {
187
215
  this.timer = undefined;
188
- void next.scheduler.check(next.definition).catch(() => undefined).finally(() => this.schedule());
216
+ void next.scheduler.check(next.definition).then(() => { this.retryAfter.delete(next.key); }, () => { this.retryAfter.set(next.key, (this.options.now?.() ?? Date.now()) + next.retryAfterMs); }).finally(() => this.schedule());
189
217
  }, Math.max(0, next.at - (this.options.now?.() ?? Date.now())));
190
218
  }
191
219
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../src/automations/scheduler.ts"],"names":[],"mappings":"AAsBA;+BAC+B;AAC/B,MAAM,oBAAoB;IAChB,IAAI,GAAqB,OAAO,CAAC,OAAO,EAAE,CAAC;IACnD,GAAG,CAAI,SAA2B;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AACD,MAAM,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAElD,MAAM,OAAO,0BAA0B;IACR,MAAM;IAAnC,YAA6B,MAA+B;sBAA/B,MAAM;IAA4B,CAAC;IAEhE,KAAK,CAAC,KAAK,CAAC,UAAgC,EAAE,IAAI,GAA0B,SAAS;QACnF,MAAM,aAAa,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAChE,IAAI,aAAa;YAAE,IAAI,GAAG,SAAS,CAAC;QACpC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACnF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,IAAI,UAA0E,CAAC;QAC/E,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;YAC/C,IAAI,KAAK,CAAC,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AI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;CACF"}
@@ -3,6 +3,7 @@ import type { GithubCandidate } from './github-poller.ts';
3
3
  export interface AutomationStoreOptions {
4
4
  warn?: (message: string) => void;
5
5
  now?: () => Date;
6
+ processAlive?: (pid: number) => boolean;
6
7
  }
7
8
  export declare class AutomationStore {
8
9
  readonly dataDir: string;
@@ -11,7 +12,6 @@ export declare class AutomationStore {
11
12
  private stateFile;
12
13
  private definitions;
13
14
  private warned;
14
- private logSeq;
15
15
  private readonly now;
16
16
  private readonly secrets;
17
17
  static open(dataDir: string, options?: AutomationStoreOptions): AutomationStore;
@@ -32,7 +32,7 @@ export declare class AutomationStore {
32
32
  eventId: string;
33
33
  candidate?: GithubCandidate;
34
34
  }): AutomationReceipt | undefined;
35
- appendLog(record: Omit<AutomationLogRecord, 'seq' | 'ts'> & Partial<Pick<AutomationLogRecord, 'ts'>>): AutomationLogRecord;
35
+ appendLog(record: Omit<AutomationLogRecord, 'seq' | 'ts'> & Partial<Pick<AutomationLogRecord, 'ts'>>): Promise<AutomationLogRecord>;
36
36
  logs(options?: {
37
37
  automationId?: string;
38
38
  result?: AutomationLogRecord['result'];
@@ -41,9 +41,16 @@ export declare class AutomationStore {
41
41
  cursor?: number;
42
42
  limit?: number;
43
43
  }): AutomationLogRecord[];
44
- compact(): void;
45
- maybeCompact(): void;
44
+ compact(): Promise<void>;
45
+ maybeCompact(): Promise<void>;
46
46
  acquireLease(staleAfterMs?: number): AutomationLease | undefined;
47
+ private withLogLease;
48
+ private tryAcquireLease;
49
+ /** Only one process may inspect and remove an abandoned poll lock at a time. */
50
+ private acquireReclaimGuard;
51
+ /** Fresh live guards are respected; abandoned or aged-out guards are recoverable. */
52
+ private retireAbandonedReclaimGuard;
53
+ private isLeaseAbandoned;
47
54
  private load;
48
55
  private loadDefinitions;
49
56
  private persistDefinitions;
@@ -61,5 +68,6 @@ export declare class AutomationLease {
61
68
  private readonly fd;
62
69
  private released;
63
70
  constructor(path: string, fd: number);
71
+ isCurrent(): boolean;
64
72
  release(): void;
65
73
  }