lastlight-core 0.40.3 → 0.40.5

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 (47) hide show
  1. package/config/default.yaml +2 -1
  2. package/deploy/native/README.md +8 -6
  3. package/deploy/native/install.sh +20 -9
  4. package/deploy/native/lastlight.service +2 -2
  5. package/deploy/slack/README.md +21 -11
  6. package/deploy/slack/slack-manifest.json +4 -0
  7. package/dist/admin/routes.js +27 -20
  8. package/dist/admin/routes.js.map +1 -1
  9. package/dist/config/config.d.ts +12 -0
  10. package/dist/config/config.js +14 -0
  11. package/dist/config/config.js.map +1 -1
  12. package/dist/connectors/slack/connector.d.ts +12 -1
  13. package/dist/connectors/slack/connector.js +42 -6
  14. package/dist/connectors/slack/connector.js.map +1 -1
  15. package/dist/engine/agent-executor.js +1 -0
  16. package/dist/engine/agent-executor.js.map +1 -1
  17. package/dist/engine/build-gate.js +15 -11
  18. package/dist/engine/build-gate.js.map +1 -1
  19. package/dist/engine/github/review-summary.d.ts +10 -1
  20. package/dist/engine/github/review-summary.js +20 -1
  21. package/dist/engine/github/review-summary.js.map +1 -1
  22. package/dist/engine/router.js +4 -5
  23. package/dist/engine/router.js.map +1 -1
  24. package/dist/index.js +13 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/sandbox/index.d.ts +13 -0
  27. package/dist/sandbox/index.js +77 -2
  28. package/dist/sandbox/index.js.map +1 -1
  29. package/dist/sandbox/k8s/init-clone.d.ts +9 -2
  30. package/dist/sandbox/k8s/init-clone.js +28 -7
  31. package/dist/sandbox/k8s/init-clone.js.map +1 -1
  32. package/dist/sandbox/k8s/kubernetes-sandbox.js +1 -0
  33. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
  34. package/dist/sandbox/sandbox.d.ts +6 -0
  35. package/dist/sandbox/sandbox.js.map +1 -1
  36. package/dist/workflows/handlers/post-review.d.ts +2 -0
  37. package/dist/workflows/handlers/post-review.js +30 -0
  38. package/dist/workflows/handlers/post-review.js.map +1 -1
  39. package/dist/workflows/live-runs.d.ts +24 -7
  40. package/dist/workflows/live-runs.js +53 -15
  41. package/dist/workflows/live-runs.js.map +1 -1
  42. package/dist/workflows/runner.d.ts +1 -1
  43. package/dist/workflows/runner.js +6 -2
  44. package/dist/workflows/runner.js.map +1 -1
  45. package/dist/workflows/simple.js +63 -1
  46. package/dist/workflows/simple.js.map +1 -1
  47. package/package.json +33 -33
@@ -914,7 +914,8 @@ routes:
914
914
  # flow). The router drops every label that is not a configured
915
915
  # `autonomy.stages.*.enter`, so this is inert until `autonomy.repos` names
916
916
  # a repo — and it is guard 1 of the four that replace the bot-sender filter
917
- # we deliberately opened for `issues.labeled`.
917
+ # we deliberately opened for `issues.labeled`. A stage's own `workflow`
918
+ # wins over this route; it is only the fallback for a stage that names none.
918
919
  issue_labeled: build
919
920
  pr_opened: pr-review
920
921
  pr_synchronize: pr-review
@@ -20,7 +20,7 @@ On the prod host as root:
20
20
  ```bash
21
21
  # 1. Clone the repo to the canonical path.
22
22
  git clone https://github.com/nearform/lastlight.git /opt/lastlight
23
- cd /opt/lastlight
23
+ cd /opt/lastlight/apps/server
24
24
 
25
25
  # 2. (Optional) Drop the GitHub App PEM in place before the install runs,
26
26
  # so install.sh locks it down. Otherwise place it later and re-run.
@@ -41,7 +41,7 @@ sudo bash deploy/native/install.sh
41
41
  ## Re-deploying a code change
42
42
 
43
43
  ```bash
44
- cd /opt/lastlight
44
+ cd /opt/lastlight/apps/server
45
45
  sudo -u lastlight git pull
46
46
  sudo bash deploy/native/install.sh # rebuilds + restarts the service
47
47
  ```
@@ -53,7 +53,7 @@ replaced with the two lines above (or wrap them in a script).
53
53
 
54
54
  | Path | Purpose |
55
55
  | --- | --- |
56
- | `/opt/lastlight` | Source checkout. `node dist/index.js` runs from here. |
56
+ | `/opt/lastlight` | Source checkout (pnpm workspace). `node dist/index.js` runs from `apps/server/`. |
57
57
  | `/etc/lastlight/lastlight.env` | systemd EnvironmentFile (mode 0640). Holds all secrets. |
58
58
  | `/etc/lastlight/app.pem` | GitHub App private key (mode 0640). Optional but typical. |
59
59
  | `/var/lib/lastlight/` | Persistent state — SQLite DB, session JSONLs, gondolin image cache. |
@@ -61,7 +61,7 @@ replaced with the two lines above (or wrap them in a script).
61
61
  | `/var/lib/lastlight/agent-sessions/` | Dashboard's JSONL envelope store. |
62
62
  | `/var/lib/lastlight/.cache/agentic-pi/images/` | Downloaded gondolin guest images (~89 MB each). |
63
63
  | `/var/log/lastlight/` | LogsDirectory if anything writes to it. |
64
- | `/etc/systemd/system/lastlight.service` | The unit file (installed by install.sh from `deploy/native/lastlight.service`). |
64
+ | `/etc/systemd/system/lastlight.service` | The unit file (installed by install.sh from `apps/server/deploy/native/lastlight.service`). |
65
65
 
66
66
  ## Operations
67
67
 
@@ -81,8 +81,10 @@ sudo systemctl disable lastlight
81
81
 
82
82
  ## TLS / reverse proxy
83
83
 
84
- The harness binds `127.0.0.1:8644` by default (PORT in the env file).
85
- Front it with Caddy or nginx for TLS.
84
+ The harness listens on port 8644 (PORT in the env file) on all interfaces
85
+ (`0.0.0.0`), not only on localhost. Front it with Caddy or nginx for TLS,
86
+ and block 8644 from outside with the host firewall (for example
87
+ `sudo ufw deny 8644/tcp`), so the proxy is the only way in.
86
88
 
87
89
  Minimal Caddy setup:
88
90
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # Idempotent provision + (re)deploy of lastlight as a systemd service on a
3
- # KVM-capable Linux host. Run as root from the repo root:
3
+ # KVM-capable Linux host. Run as root from apps/server:
4
4
  #
5
5
  # sudo bash deploy/native/install.sh
6
6
  #
@@ -11,7 +11,8 @@
11
11
 
12
12
  set -euo pipefail
13
13
 
14
- REPO_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
14
+ NATIVE_DIR="$(cd "$(dirname "$0")" && pwd)"
15
+ REPO_DIR="$(cd "$NATIVE_DIR/../../../.." && pwd)"
15
16
  SERVICE_NAME=lastlight
16
17
  LASTLIGHT_USER=lastlight
17
18
  LASTLIGHT_HOME=/var/lib/lastlight
@@ -41,7 +42,8 @@ apt-get install -y --no-install-recommends \
41
42
  qemu-system-x86 qemu-utils \
42
43
  python3 build-essential
43
44
  # Use NodeSource for a current Node 22 LTS (Debian's nodejs is too old).
44
- if ! command -v node >/dev/null 2>&1 || ! node -e 'process.exit(process.versions.node.split(".")[0] >= 20 ? 0 : 1)'; then
45
+ # The workspace needs Node >= 22.12 (engines in package.json).
46
+ if ! command -v node >/dev/null 2>&1 || ! node -e 'const [a, b] = process.versions.node.split(".").map(Number); process.exit(a > 22 || (a === 22 && b >= 12) ? 0 : 1)'; then
45
47
  curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
46
48
  apt-get install -y --no-install-recommends nodejs
47
49
  fi
@@ -58,11 +60,20 @@ if getent group kvm >/dev/null 2>&1; then
58
60
  fi
59
61
 
60
62
  # ── 4. Repo install + build (as the lastlight user) ────────────────────────
63
+ # pnpm workspace: corepack runs the pnpm version pinned in package.json
64
+ # (packageManager). Only the server, its workspace deps and the dashboard are
65
+ # installed and built; the other apps (www, evals) are not needed to run it.
66
+ if ! command -v corepack >/dev/null 2>&1; then
67
+ npm install -g corepack
68
+ fi
61
69
  chown -R "$LASTLIGHT_USER:$LASTLIGHT_USER" "$REPO_DIR"
62
- sudo -u "$LASTLIGHT_USER" -H bash -c "cd '$REPO_DIR' && npm ci --no-audit --no-fund"
63
- sudo -u "$LASTLIGHT_USER" -H bash -c "cd '$REPO_DIR' && npm run build && npm run build:dashboard"
64
- # Prune dev deps to shrink the on-disk footprint of the deployed checkout.
65
- sudo -u "$LASTLIGHT_USER" -H bash -c "cd '$REPO_DIR' && npm prune --omit=dev"
70
+ sudo -u "$LASTLIGHT_USER" -H env COREPACK_ENABLE_DOWNLOAD_PROMPT=0 CI=1 bash -c "
71
+ set -euo pipefail
72
+ cd '$REPO_DIR'
73
+ corepack pnpm install --frozen-lockfile --filter 'lastlight-core...' --filter '@lastlight/dashboard...'
74
+ corepack pnpm --filter 'lastlight-core...' run build
75
+ corepack pnpm --filter '@lastlight/dashboard' run build
76
+ "
66
77
 
67
78
  # ── 5. Env file scaffold (don't overwrite an existing config) ──────────────
68
79
  mkdir -p "$ENV_DIR"
@@ -70,7 +81,7 @@ chmod 0750 "$ENV_DIR"
70
81
  chgrp "$LASTLIGHT_USER" "$ENV_DIR"
71
82
  if [ ! -f "$ENV_FILE" ]; then
72
83
  install -m 0640 -o root -g "$LASTLIGHT_USER" \
73
- "$REPO_DIR/deploy/native/lastlight.env.example" "$ENV_FILE"
84
+ "$NATIVE_DIR/lastlight.env.example" "$ENV_FILE"
74
85
  echo "" >&2
75
86
  echo " NOTE: $ENV_FILE was just created from the example template." >&2
76
87
  echo " Edit it to fill in your GitHub App, model API keys, Slack tokens, etc." >&2
@@ -88,7 +99,7 @@ fi
88
99
 
89
100
  # ── 7. systemd unit ────────────────────────────────────────────────────────
90
101
  install -m 0644 \
91
- "$REPO_DIR/deploy/native/lastlight.service" \
102
+ "$NATIVE_DIR/lastlight.service" \
92
103
  "/etc/systemd/system/${SERVICE_NAME}.service"
93
104
  systemctl daemon-reload
94
105
 
@@ -11,8 +11,8 @@ Group=lastlight
11
11
  # gondolin needs /dev/kvm — group `kvm` is the standard accessor on Debian/Ubuntu.
12
12
  SupplementaryGroups=kvm
13
13
 
14
- WorkingDirectory=/opt/lastlight
15
- ExecStart=/usr/bin/node /opt/lastlight/dist/index.js
14
+ WorkingDirectory=/opt/lastlight/apps/server
15
+ ExecStart=/usr/bin/node /opt/lastlight/apps/server/dist/index.js
16
16
  EnvironmentFile=/etc/lastlight/lastlight.env
17
17
 
18
18
  # HOME drives where agentic-pi caches the gondolin guest image
@@ -25,6 +25,7 @@ paste it into an existing app's *App Manifest* editor.
25
25
  | `chat:write` | Post replies + cron reports; edit the in-place status message (`chat.postMessage` / `chat.update`) | `src/connectors/slack/connector.ts` |
26
26
  | `app_mentions:read` | Respond when `@mention`ed in a channel (`app_mention` event) | `connector.ts` |
27
27
  | `im:history` | Read + respond to DMs (`message.im` event) | `connector.ts` |
28
+ | `channels:history` / `groups:history` | Receive plain replies in a thread the bot is already in, in public / private channels (`message.channels` / `message.groups`) | `connector.ts` |
28
29
  | `users:read` | Resolve a user ID → username for display (`users.info`) | `connector.ts` |
29
30
  | `assistant:write` | The "Thinking…" thread status indicator (`assistant.threads.setStatus`) | `connector.ts` |
30
31
  | `reactions:write` | Fallback 👀 ack reaction when the assistant status API isn't available (`reactions.add`) | `connector.ts` |
@@ -34,6 +35,14 @@ paste it into an existing app's *App Manifest* editor.
34
35
 
35
36
  - `app_mention` — needs `app_mentions:read`.
36
37
  - `message.im` — needs `im:history`.
38
+ - `message.channels` / `message.groups` — need `channels:history` /
39
+ `groups:history`. They exist for ONE case: a reply in a thread the bot is
40
+ already in, without an `@mention` ("Ok, thanks!"). A channel `@mention` is
41
+ delivered twice once these are subscribed (as `message` and as
42
+ `app_mention`); the connector drops the `message` copy, recognising it by the
43
+ bot's own user id (resolved with `auth.test` at start), so it answers once.
44
+ Every other channel message is dropped on arrival. The bot only receives
45
+ messages from channels it is a member of.
37
46
  - `reaction_added` / `reaction_removed` — needs `reactions:read`. These carry the
38
47
  feedback signals (issue #255): a 👍 or 👎 on a message the bot posted is scored
39
48
  against the workflow run that produced it. Only reactions on messages Last
@@ -68,10 +77,9 @@ default). For Socket Mode local dev (`SLACK_MODE=socket`) instead:
68
77
  - set `settings.socket_mode_enabled: true`,
69
78
  - add an **app-level token** (`xapp-…`, `SLACK_APP_TOKEN`) with the
70
79
  `connections:write` scope, and
71
- - add `channels:history` + `groups:history` bot scopes **only if** you want the
72
- bot to see non-mention messages in channels/private channels — Bolt's
73
- `message()` listener is a catch-all in Socket Mode. The default handlers act
74
- on DMs + mentions only, so you usually don't need them.
80
+ - keep the `channels:history` + `groups:history` bot scopes — Bolt's
81
+ `message()` listener is a catch-all in Socket Mode, and the same handler
82
+ continues thread replies (and drops everything else) there too.
75
83
 
76
84
  ## What was dropped from the original manifest (and why)
77
85
 
@@ -88,9 +96,9 @@ no code path uses:
88
96
  channels, DMs, and files — a needless privacy/blast-radius liability.
89
97
  (`reactions:read` and `reactions:write` stay dropped **as user scopes** — both
90
98
  are granted on the *bot* token above, which is the token the code uses.)
91
- - **Bot scopes dropped:** `channels:read`, `files:write`, `im:read`, `im:write`,
92
- `channels:history`, `groups:history` — none are called by the connector, and
93
- the two `*:history` channel scopes only matter for Socket Mode (see above).
99
+ - **Bot scopes dropped:** `channels:read`, `files:write`, `im:read`, `im:write`
100
+ — none are called by the connector. (`channels:history` / `groups:history`
101
+ were dropped here too, and have since been restored — see the last entry.)
94
102
  - **Bot scopes ADDED (were missing but required):** `assistant:write` and
95
103
  `reactions:write`. The code calls both on the **bot** token; the original
96
104
  granted `reactions:write` only as a *user* scope and omitted `assistant:write`
@@ -101,7 +109,9 @@ no code path uses:
101
109
  installation, and until it is granted no reaction event is delivered at all
102
110
  (silently: the handler is simply never called). Feedback is off in that state,
103
111
  not broken; everything else keeps working.
104
- - **Events dropped:** `message.channels`, `message.groups` — the handlers act on
105
- DMs (`message.im`) and mentions (`app_mention`); the code ignores plain
106
- channel/group messages, so subscribing to them just delivers events nothing
107
- consumes.
112
+ - **Events restored:** `message.channels`, `message.groups` (+ the two
113
+ `*:history` scopes). They were dropped on the belief that the code ignores
114
+ plain channel messages — but it continues a thread the bot is already in, and
115
+ that only works if Slack delivers the un-mentioned reply. Without them a
116
+ channel conversation needed an `@mention` on every turn. **Re-consent the app
117
+ after adding them.**
@@ -31,7 +31,9 @@
31
31
  "bot": [
32
32
  "app_mentions:read",
33
33
  "assistant:write",
34
+ "channels:history",
34
35
  "chat:write",
36
+ "groups:history",
35
37
  "im:history",
36
38
  "reactions:read",
37
39
  "reactions:write",
@@ -45,6 +47,8 @@
45
47
  "request_url": "https://YOUR_INSTANCE_DOMAIN/webhooks/slack",
46
48
  "bot_events": [
47
49
  "app_mention",
50
+ "message.channels",
51
+ "message.groups",
48
52
  "message.im",
49
53
  "reaction_added",
50
54
  "reaction_removed"
@@ -49,11 +49,14 @@ const MAX_BOARD_REPOS = 20;
49
49
  * is a much larger thing than the button says it is — and it already exists,
50
50
  * deliberately, as `POST /api/run` for operators who want it.
51
51
  *
52
- * So the workflow is resolved from `routes.github` — the operator's own route
53
- * map — and then CHECKED to be one of these three keys' values. An operator who
54
- * repoints `issue_build` at a different workflow moves this surface with it,
55
- * which is right; an operator who never configured the stage at all gets a
56
- * refusal rather than a dispatch, which is also right.
52
+ * So the workflow is resolved from operator config — the stage's own
53
+ * `workflow` (`stageWorkflow`) — and then CHECKED to be one the operator
54
+ * already points an issue trigger at: one of these three keys' values, or a
55
+ * configured stage's workflow. `autonomy.stages` is operator-only config, so a
56
+ * stage's workflow is as much the operator's decision as a route is; leaving it
57
+ * out refused every stage that names its own workflow (issue #452). An operator
58
+ * who never configured the workflow at all still gets a refusal rather than a
59
+ * dispatch.
57
60
  */
58
61
  const ISSUE_DISPATCH_ROUTE_KEYS = ["issue_opened", "issue_labeled", "issue_build"];
59
62
  const STAGE_SLOTS = ["enter", "running", "on_success", "on_failure"];
@@ -99,7 +102,10 @@ function stageSlotForLabel(label) {
99
102
  * drifts open is a "run anything against any managed repo" hole.
100
103
  */
101
104
  function isIssueRoutableWorkflow(workflow) {
102
- const routable = new Set(ISSUE_DISPATCH_ROUTE_KEYS.map((key) => getRoutes().github?.[key]).filter(Boolean));
105
+ const routable = new Set([
106
+ ...ISSUE_DISPATCH_ROUTE_KEYS.map((key) => getRoutes().github?.[key]).filter(Boolean),
107
+ ...Object.values(getAutonomyConfig().stages).map(stageWorkflow),
108
+ ]);
103
109
  return routable.has(workflow);
104
110
  }
105
111
  import { getRuntimeConfig, getRoutes, getBotName, resolveKubernetesConfig,
@@ -108,7 +114,7 @@ import { getRuntimeConfig, getRoutes, getBotName, resolveKubernetesConfig,
108
114
  // returns a repo's UNTRUSTED `.lastlight/lastlight.yml` raw and
109
115
  // pre-validation, so a copy that drifted behind config.ts's would leak a
110
116
  // pasted credential. It must stay single-source (see config.ts).
111
- redactPublic, getAutonomyConfig, getHoldLabel, } from "../config/config.js";
117
+ redactPublic, getAutonomyConfig, stageWorkflow, getHoldLabel, } from "../config/config.js";
112
118
  import { fetchRepoLayer, refreshRepoLayer, getCachedRepoLayer, repoConfigPolicy, repoConfigBaseFromRuntime, resolveRepoConfig, } from "../config/repo-config.js";
113
119
  import { issueTriggerId } from "../engine/build-decisions.js";
114
120
  import { applyBuildDispatchGate } from "../engine/build-gate.js";
@@ -2943,11 +2949,12 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
2943
2949
  if (!stageName || !stage) {
2944
2950
  return c.json({ error: `unknown stage: \`${stageName ?? ""}\` is not in \`autonomy.stages\`` }, 400);
2945
2951
  }
2952
+ const workflow = stageWorkflow(stage);
2946
2953
  // THE ALLOW-LIST. See `ISSUE_DISPATCH_ROUTE_KEYS` — the workflow has to be
2947
2954
  // one the operator's own route map already points an issue trigger at.
2948
- if (!isIssueRoutableWorkflow(stage.workflow)) {
2955
+ if (!isIssueRoutableWorkflow(workflow)) {
2949
2956
  return c.json({
2950
- error: `workflow \`${stage.workflow}\` is not reachable from an issue route ` +
2957
+ error: `workflow \`${workflow}\` is not reachable from an issue route ` +
2951
2958
  `(${ISSUE_DISPATCH_ROUTE_KEYS.join(", ")}), so the board may not dispatch it`,
2952
2959
  }, 400);
2953
2960
  }
@@ -3006,7 +3013,7 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3006
3013
  outcome: "denied",
3007
3014
  detail: {
3008
3015
  stage: stageName,
3009
- workflow: stage.workflow,
3016
+ workflow,
3010
3017
  dispatched: false,
3011
3018
  reason: String(gate.reason ?? "").slice(0, 200),
3012
3019
  ...(reason ? { note: reason } : {}),
@@ -3016,7 +3023,7 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3016
3023
  repo,
3017
3024
  issueNumber,
3018
3025
  stage: stageName,
3019
- workflow: stage.workflow,
3026
+ workflow,
3020
3027
  dispatched: false,
3021
3028
  // The hold is the one skip that owes a human a sentence rather than a
3022
3029
  // reason string, and it is the SAME sentence every other surface
@@ -3027,8 +3034,8 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3027
3034
  }
3028
3035
  // Fire-and-forget, exactly like `cron trigger` and the PR retry above: a
3029
3036
  // build takes minutes and the dashboard is waiting on this response.
3030
- log.info("board dispatch", { workflow: stage.workflow, repo, issueNumber, stage: stageName, by });
3031
- config.dispatchWorkflow(stage.workflow, {
3037
+ log.info("board dispatch", { workflow, repo, issueNumber, stage: stageName, by });
3038
+ config.dispatchWorkflow(workflow, {
3032
3039
  repo,
3033
3040
  issueNumber,
3034
3041
  title: live.title,
@@ -3045,7 +3052,7 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3045
3052
  sender: by,
3046
3053
  triggeredBy: by,
3047
3054
  }).catch((err) => {
3048
- log.error("board dispatch failed", { workflow: stage.workflow, repo, issueNumber, err });
3055
+ log.error("board dispatch failed", { workflow, repo, issueNumber, err });
3049
3056
  });
3050
3057
  // The freshness lever that matters. Without this the card keeps rendering
3051
3058
  // its pre-dispatch stage for up to the full TTL, so the button appears to
@@ -3057,7 +3064,7 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3057
3064
  targetId,
3058
3065
  detail: {
3059
3066
  stage: stageName,
3060
- workflow: stage.workflow,
3067
+ workflow,
3061
3068
  dispatched: true,
3062
3069
  ...(reason ? { note: reason } : {}),
3063
3070
  },
@@ -3066,7 +3073,7 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3066
3073
  repo,
3067
3074
  issueNumber,
3068
3075
  stage: stageName,
3069
- workflow: stage.workflow,
3076
+ workflow,
3070
3077
  dispatched: true,
3071
3078
  reason: gate.reason,
3072
3079
  });
@@ -3326,8 +3333,8 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3326
3333
  // bills.
3327
3334
  if (labels.includes(to))
3328
3335
  return `already-in-stage: ${repo}#${issueNumber} already carries \`${to}\``;
3329
- if (!isIssueRoutableWorkflow(matchedStage.workflow)) {
3330
- return (`unroutable-workflow: \`${matchedStage.workflow}\` is not reachable from an ` +
3336
+ if (!isIssueRoutableWorkflow(stageWorkflow(matchedStage))) {
3337
+ return (`unroutable-workflow: \`${stageWorkflow(matchedStage)}\` is not reachable from an ` +
3331
3338
  `issue route (${ISSUE_DISPATCH_ROUTE_KEYS.join(", ")})`);
3332
3339
  }
3333
3340
  return undefined;
@@ -3401,7 +3408,7 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3401
3408
  });
3402
3409
  }
3403
3410
  }
3404
- fireDispatch(slotMatch.stage, matchedStage.workflow, gate.gates);
3411
+ fireDispatch(slotMatch.stage, stageWorkflow(matchedStage), gate.gates);
3405
3412
  invalidateBoard(repo);
3406
3413
  await recordActivityFor(c, db, {
3407
3414
  action: "issue.stage",
@@ -3462,7 +3469,7 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
3462
3469
  if (!gateFirst && dispatchRefusal === undefined && slotMatch?.kind === "match" && matchedStage) {
3463
3470
  const gate = await crossGate(slotMatch.stage);
3464
3471
  if (gate.decision === "dispatch") {
3465
- fireDispatch(slotMatch.stage, matchedStage.workflow, gate.gates);
3472
+ fireDispatch(slotMatch.stage, stageWorkflow(matchedStage), gate.gates);
3466
3473
  }
3467
3474
  }
3468
3475
  // A failed REMOVE is not an error. The issue now carries BOTH labels, which