lastlight-core 0.21.10 → 0.21.12

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 (157) hide show
  1. package/deploy/k8s/README.md +111 -34
  2. package/deploy/k8s/architecture.md +199 -0
  3. package/deploy/k8s/configmap.yaml +14 -3
  4. package/deploy/k8s/harness-deployment.yaml +111 -0
  5. package/deploy/k8s/kustomization.yaml +10 -8
  6. package/deploy/k8s/sandbox-namespace.yaml +14 -0
  7. package/deploy/k8s/sandbox-quota.yaml +37 -0
  8. package/deploy/k8s/sandbox-rbac.yaml +60 -0
  9. package/dist/admin/routes.js +66 -10
  10. package/dist/admin/routes.js.map +1 -1
  11. package/dist/config/config.d.ts +36 -0
  12. package/dist/config/config.js +103 -3
  13. package/dist/config/config.js.map +1 -1
  14. package/dist/cron/review-discovery.d.ts +54 -0
  15. package/dist/cron/review-discovery.js +70 -0
  16. package/dist/cron/review-discovery.js.map +1 -0
  17. package/dist/engine/agent-executor.js +11 -2
  18. package/dist/engine/agent-executor.js.map +1 -1
  19. package/dist/engine/executors/orchestrator.d.ts +2 -1
  20. package/dist/engine/executors/orchestrator.js +158 -62
  21. package/dist/engine/executors/orchestrator.js.map +1 -1
  22. package/dist/engine/github/profiles.d.ts +12 -1
  23. package/dist/engine/github/profiles.js +33 -1
  24. package/dist/engine/github/profiles.js.map +1 -1
  25. package/dist/index.js +52 -13
  26. package/dist/index.js.map +1 -1
  27. package/dist/sandbox/artifact-backend.d.ts +40 -0
  28. package/dist/sandbox/artifact-backend.js +67 -0
  29. package/dist/sandbox/artifact-backend.js.map +1 -0
  30. package/dist/sandbox/artifact-store.d.ts +55 -0
  31. package/dist/sandbox/artifact-store.js +203 -0
  32. package/dist/sandbox/artifact-store.js.map +1 -0
  33. package/dist/sandbox/docker.d.ts +2 -1
  34. package/dist/sandbox/docker.js +3 -3
  35. package/dist/sandbox/docker.js.map +1 -1
  36. package/dist/sandbox/k8s/agent-context-registry.d.ts +25 -0
  37. package/dist/sandbox/k8s/agent-context-registry.js +45 -0
  38. package/dist/sandbox/k8s/agent-context-registry.js.map +1 -0
  39. package/dist/sandbox/k8s/agent-context-route.d.ts +13 -0
  40. package/dist/sandbox/k8s/agent-context-route.js +21 -0
  41. package/dist/sandbox/k8s/agent-context-route.js.map +1 -0
  42. package/dist/sandbox/k8s/artifact-upload-route.d.ts +12 -0
  43. package/dist/sandbox/k8s/artifact-upload-route.js +40 -0
  44. package/dist/sandbox/k8s/artifact-upload-route.js.map +1 -0
  45. package/dist/sandbox/k8s/client.d.ts +22 -0
  46. package/dist/sandbox/k8s/client.js +35 -0
  47. package/dist/sandbox/k8s/client.js.map +1 -0
  48. package/dist/sandbox/k8s/egress-apply.d.ts +14 -0
  49. package/dist/sandbox/k8s/egress-apply.js +44 -0
  50. package/dist/sandbox/k8s/egress-apply.js.map +1 -0
  51. package/dist/sandbox/k8s/egress-ensurer.d.ts +37 -0
  52. package/dist/sandbox/k8s/egress-ensurer.js +54 -0
  53. package/dist/sandbox/k8s/egress-ensurer.js.map +1 -0
  54. package/dist/sandbox/k8s/egress-policy.d.ts +112 -0
  55. package/dist/sandbox/k8s/egress-policy.js +118 -0
  56. package/dist/sandbox/k8s/egress-policy.js.map +1 -0
  57. package/dist/sandbox/k8s/init-agent-context.d.ts +20 -0
  58. package/dist/sandbox/k8s/init-agent-context.js +35 -0
  59. package/dist/sandbox/k8s/init-agent-context.js.map +1 -0
  60. package/dist/sandbox/k8s/init-clone.d.ts +53 -0
  61. package/dist/sandbox/k8s/init-clone.js +114 -0
  62. package/dist/sandbox/k8s/init-clone.js.map +1 -0
  63. package/dist/sandbox/k8s/init-skills.d.ts +13 -0
  64. package/dist/sandbox/k8s/init-skills.js +28 -0
  65. package/dist/sandbox/k8s/init-skills.js.map +1 -0
  66. package/dist/sandbox/k8s/kubernetes-sandbox.d.ts +179 -0
  67. package/dist/sandbox/k8s/kubernetes-sandbox.js +418 -0
  68. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -0
  69. package/dist/sandbox/k8s/log-stream.d.ts +4 -0
  70. package/dist/sandbox/k8s/log-stream.js +43 -0
  71. package/dist/sandbox/k8s/log-stream.js.map +1 -0
  72. package/dist/sandbox/k8s/naming.d.ts +19 -0
  73. package/dist/sandbox/k8s/naming.js +35 -0
  74. package/dist/sandbox/k8s/naming.js.map +1 -0
  75. package/dist/sandbox/k8s/pod-lifecycle.d.ts +40 -0
  76. package/dist/sandbox/k8s/pod-lifecycle.js +151 -0
  77. package/dist/sandbox/k8s/pod-lifecycle.js.map +1 -0
  78. package/dist/sandbox/k8s/pod-status.d.ts +46 -0
  79. package/dist/sandbox/k8s/pod-status.js +83 -0
  80. package/dist/sandbox/k8s/pod-status.js.map +1 -0
  81. package/dist/sandbox/k8s/pod.d.ts +79 -0
  82. package/dist/sandbox/k8s/pod.js +115 -0
  83. package/dist/sandbox/k8s/pod.js.map +1 -0
  84. package/dist/sandbox/k8s/pvc.d.ts +20 -0
  85. package/dist/sandbox/k8s/pvc.js +26 -0
  86. package/dist/sandbox/k8s/pvc.js.map +1 -0
  87. package/dist/sandbox/k8s/quota.d.ts +34 -0
  88. package/dist/sandbox/k8s/quota.js +52 -0
  89. package/dist/sandbox/k8s/quota.js.map +1 -0
  90. package/dist/sandbox/k8s/reclaim.d.ts +50 -0
  91. package/dist/sandbox/k8s/reclaim.js +141 -0
  92. package/dist/sandbox/k8s/reclaim.js.map +1 -0
  93. package/dist/sandbox/k8s/resource-name.d.ts +33 -0
  94. package/dist/sandbox/k8s/resource-name.js +49 -0
  95. package/dist/sandbox/k8s/resource-name.js.map +1 -0
  96. package/dist/sandbox/k8s/run-agent-script.d.ts +60 -0
  97. package/dist/sandbox/k8s/run-agent-script.js +48 -0
  98. package/dist/sandbox/k8s/run-agent-script.js.map +1 -0
  99. package/dist/sandbox/k8s/run-id.d.ts +23 -0
  100. package/dist/sandbox/k8s/run-id.js +32 -0
  101. package/dist/sandbox/k8s/run-id.js.map +1 -0
  102. package/dist/sandbox/k8s/run-secrets.d.ts +75 -0
  103. package/dist/sandbox/k8s/run-secrets.js +115 -0
  104. package/dist/sandbox/k8s/run-secrets.js.map +1 -0
  105. package/dist/sandbox/k8s/secret.d.ts +20 -0
  106. package/dist/sandbox/k8s/secret.js +38 -0
  107. package/dist/sandbox/k8s/secret.js.map +1 -0
  108. package/dist/sandbox/k8s/skill-bundle-route.d.ts +10 -0
  109. package/dist/sandbox/k8s/skill-bundle-route.js +18 -0
  110. package/dist/sandbox/k8s/skill-bundle-route.js.map +1 -0
  111. package/dist/sandbox/k8s/skill-bundle.d.ts +36 -0
  112. package/dist/sandbox/k8s/skill-bundle.js +85 -0
  113. package/dist/sandbox/k8s/skill-bundle.js.map +1 -0
  114. package/dist/sandbox/k8s/sweep.d.ts +47 -0
  115. package/dist/sandbox/k8s/sweep.js +29 -0
  116. package/dist/sandbox/k8s/sweep.js.map +1 -0
  117. package/dist/sandbox/k8s/workspace-provisioner.d.ts +51 -0
  118. package/dist/sandbox/k8s/workspace-provisioner.js +64 -0
  119. package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -0
  120. package/dist/sandbox/sandbox.d.ts +20 -1
  121. package/dist/sandbox/sandbox.js +22 -1
  122. package/dist/sandbox/sandbox.js.map +1 -1
  123. package/dist/state/workflow-run-store.d.ts +11 -0
  124. package/dist/state/workflow-run-store.js +19 -0
  125. package/dist/state/workflow-run-store.js.map +1 -1
  126. package/dist/telemetry/index.d.ts +11 -0
  127. package/dist/telemetry/index.js +38 -1
  128. package/dist/telemetry/index.js.map +1 -1
  129. package/dist/telemetry/openinference.d.ts +70 -0
  130. package/dist/telemetry/openinference.js +81 -0
  131. package/dist/telemetry/openinference.js.map +1 -0
  132. package/dist/telemetry/pi-events.d.ts +30 -0
  133. package/dist/telemetry/pi-events.js +216 -2
  134. package/dist/telemetry/pi-events.js.map +1 -1
  135. package/dist/workflows/admission.d.ts +12 -0
  136. package/dist/workflows/admission.js +13 -2
  137. package/dist/workflows/admission.js.map +1 -1
  138. package/dist/workflows/handlers/post-review.d.ts +21 -0
  139. package/dist/workflows/handlers/post-review.js +56 -13
  140. package/dist/workflows/handlers/post-review.js.map +1 -1
  141. package/dist/workflows/resume.js +6 -0
  142. package/dist/workflows/resume.js.map +1 -1
  143. package/dist/workflows/runner.d.ts +3 -1
  144. package/dist/workflows/runner.js +73 -15
  145. package/dist/workflows/runner.js.map +1 -1
  146. package/dist/workflows/simple.d.ts +13 -1
  147. package/dist/workflows/simple.js +37 -4
  148. package/dist/workflows/simple.js.map +1 -1
  149. package/package.json +19 -18
  150. package/skills/issue-triage/SKILL.md +17 -0
  151. package/workflows/cron-review.yaml +14 -1
  152. package/workflows/issue-triage.yaml +6 -0
  153. package/deploy/k8s/deployment.yaml +0 -63
  154. package/deploy/k8s/generic-device-plugin.yaml +0 -63
  155. package/deploy/k8s/namespace.yaml +0 -10
  156. package/deploy/k8s/pvc.yaml +0 -13
  157. package/deploy/k8s/service.yaml +0 -12
@@ -8,9 +8,11 @@ import { SANDBOX_IMAGE_QA } from "../../sandbox/index.js";
8
8
  import { DEFAULT_ALLOWLIST, mergeAllowlist } from "../../sandbox/egress-allowlist.js";
9
9
  import { AGENTIC_PROFILE_FOR, loadAgentContext, } from "../github/profiles.js";
10
10
  import { AgenticShim } from "../event-shim.js";
11
+ import { QuotaExceededError } from "../../sandbox/k8s/quota.js";
11
12
  import { projectSlugForCwd } from "../../session-log.js";
12
- import { recordError, recordExecutionMetrics } from "../../telemetry/index.js";
13
- import { recordPiEvent } from "../../telemetry/pi-events.js";
13
+ import { recordError, recordExecutionMetrics, setSpanAttributes } from "../../telemetry/index.js";
14
+ import { AgentSpanTree, recordPiEvent } from "../../telemetry/pi-events.js";
15
+ import { OI, llmTokenAttributes } from "../../telemetry/openinference.js";
14
16
  import { DEFAULT_MODEL, RunResultAccumulator, coerceThinking, emptyResult, finalizeFromRunResult, harvestArtifactsOut, resolveSessionsDir, serverArtifacts, skillBundleKey, stageArtifactsIn, } from "./shared.js";
15
17
  /**
16
18
  * Compute the run's intent-only egress policy once: `unrestricted` for a phase
@@ -51,7 +53,10 @@ export async function withSandbox(ctx, fn) {
51
53
  await sandbox.dispose();
52
54
  }
53
55
  }
54
- /** Drop AGENTS.md into the workspace — agentic-pi reads it as system context. */
56
+ /** Drop AGENTS.md into the workspace — agentic-pi reads it as system context.
57
+ * Host-shared backends only (docker/gondolin/none/smol); the k8s backend has
58
+ * no host-visible workspace to write into — see the call site's guard and
59
+ * `KubernetesSandbox.runAgent`'s pod-side delivery instead. */
55
60
  function writeAgentsMd(hostWorkspaceDir, config) {
56
61
  try {
57
62
  const md = loadAgentContext(config.agentContextDir);
@@ -85,16 +90,22 @@ function hostRepoDirFor(prov, prePopulate, relocated) {
85
90
  * `executeSmol` / `executeInProcess` — the three slightly-different fallback
86
91
  * paths are converged into the single catch below.
87
92
  */
88
- export async function runSandboxedAgent(prompt, ctx) {
93
+ export async function runSandboxedAgent(prompt, ctx, span) {
89
94
  const { config, access } = ctx;
90
95
  const startTime = Date.now();
91
96
  const model = config.model || DEFAULT_MODEL;
97
+ const includeContent = config.otel?.includeContent === true;
92
98
  const thinking = coerceThinking(config.variant);
93
99
  const profile = access ? AGENTIC_PROFILE_FOR[access.profile] : undefined;
94
100
  const sessionsDir = resolveSessionsDir(config);
95
101
  return withSandbox(ctx, async (sandbox, prov) => {
96
102
  console.log(` [executor] Running agent (task: ${ctx.taskId}, sandbox: ${ctx.backend})`);
97
- writeAgentsMd(prov.hostWorkspaceDir, config);
103
+ // `prov.hostWorkspaceDir` on k8s is an in-pod path (WORKSPACE_DIR) that
104
+ // doesn't exist on the harness host, so this write would always ENOENT.
105
+ // The k8s adapter delivers AGENTS.md pod-side instead (the per-run prompt
106
+ // Secret carries it; see KubernetesSandbox.runAgent).
107
+ if (ctx.backend !== "kubernetes")
108
+ writeAgentsMd(prov.hostWorkspaceDir, config);
98
109
  // Stage this phase's skills (adapter decides symlink/copy + path mapping).
99
110
  let skillDirs;
100
111
  try {
@@ -114,12 +125,17 @@ export async function runSandboxedAgent(prompt, ctx) {
114
125
  initialPrompt: prompt,
115
126
  });
116
127
  const acc = new RunResultAccumulator();
128
+ // OpenInference span tree (turn = LLM, tool = TOOL) nested under the active
129
+ // `lastlight.agent.execute` (AGENT) span. No-ops when telemetry is off (span
130
+ // undefined). The flat pi.* events (recordPiEvent) stay as a fallback.
131
+ const tree = new AgentSpanTree({ parent: span, includeContent, model });
117
132
  let notifiedSessionId = false;
118
133
  const onEvent = (record) => {
119
134
  acc.feed(record);
120
135
  shim.feed(record);
136
+ tree.feed(record);
121
137
  recordPiEvent(record, {
122
- includeContent: config.otel?.includeContent === true,
138
+ includeContent,
123
139
  surface: "agent",
124
140
  workflowName: config.telemetry?.workflowName,
125
141
  phaseName: config.telemetry?.phaseName,
@@ -161,18 +177,25 @@ export async function runSandboxedAgent(prompt, ctx) {
161
177
  // The single converged fallback path (was three near-identical catches).
162
178
  const msg = err instanceof Error ? err.message : String(err);
163
179
  const durationMs = Date.now() - startTime;
180
+ // A k8s ResourceQuota rejection is backpressure, not a sandbox failure:
181
+ // a distinct stop reason lets the runner requeue the run (spec/09-sandbox.md (Concurrency)).
182
+ const stopReason = err instanceof QuotaExceededError ? "error_quota" : "error_sandbox";
164
183
  const tags = {
165
184
  "sandbox.backend": ctx.backend,
166
185
  model,
167
186
  success: false,
168
- stop_reason: "error_sandbox",
187
+ stop_reason: stopReason,
169
188
  "workflow.name": config.telemetry?.workflowName,
170
189
  "phase.name": config.telemetry?.phaseName,
171
190
  };
172
- recordError("agent", err, tags);
191
+ // A quota rejection is backpressure, not an error — don't pollute the
192
+ // error telemetry with it (the run requeues; see the outer .catch).
193
+ if (!(err instanceof QuotaExceededError))
194
+ recordError("agent", err, tags);
173
195
  recordExecutionMetrics("agent", { ...tags, durationMs });
196
+ tree.end();
174
197
  const synthesizedId = await shim
175
- .finalizeWithFallback(emptyResult("error_sandbox", durationMs), `exec-${basename(ctx.taskId)}`, msg)
198
+ .finalizeWithFallback(emptyResult(stopReason, durationMs), `exec-${basename(ctx.taskId)}`, msg)
176
199
  .catch(() => null);
177
200
  harvestArtifactsOut(artifacts);
178
201
  return {
@@ -182,10 +205,12 @@ export async function runSandboxedAgent(prompt, ctx) {
182
205
  error: msg,
183
206
  durationMs,
184
207
  sessionId: synthesizedId ?? undefined,
185
- stopReason: "error_sandbox",
208
+ stopReason,
186
209
  };
187
210
  }
188
211
  harvestArtifactsOut(artifacts);
212
+ // Close any turn/tool spans still open before we decorate the agent span.
213
+ tree.end();
189
214
  // Reconstruct the RunResult: the in-process adapter returns its
190
215
  // authoritative one; docker/smol return undefined → build from the
191
216
  // accumulated events. Either way prefer our compaction-proof per-message
@@ -207,7 +232,45 @@ export async function runSandboxedAgent(prompt, ctx) {
207
232
  "workflow.name": config.telemetry?.workflowName,
208
233
  "phase.name": config.telemetry?.phaseName,
209
234
  });
235
+ // Decorate the AGENT span with the run's total tokens + cost (so Phoenix
236
+ // shows real figures, not $0) via the scrubber-bypassing path. input/output
237
+ // text are content — gated behind LASTLIGHT_OTEL_INCLUDE_CONTENT.
238
+ setSpanAttributes(span, {
239
+ ...llmTokenAttributes({
240
+ input: finalResult.inputTokens,
241
+ output: finalResult.outputTokens,
242
+ cacheRead: finalResult.cacheReadInputTokens,
243
+ cacheWrite: finalResult.cacheCreationInputTokens,
244
+ cost: finalResult.costUsd,
245
+ }),
246
+ ...(includeContent
247
+ ? {
248
+ [OI.INPUT_VALUE]: prompt,
249
+ [OI.INPUT_MIME_TYPE]: "text/plain",
250
+ [OI.OUTPUT_VALUE]: finalResult.output,
251
+ [OI.OUTPUT_MIME_TYPE]: "text/plain",
252
+ }
253
+ : {}),
254
+ });
210
255
  return finalResult;
256
+ }).catch((err) => {
257
+ // A ResourceQuota rejection during PROVISIONING (pod-create) throws OUTSIDE
258
+ // the in-callback runAgent catch above — `withSandbox` provisions before it
259
+ // runs `fn`. Surface it as an error_quota RESULT (not a throw) so the runner
260
+ // flags backpressure and requeues, instead of the run terminal-failing red.
261
+ // Mirrors runSandboxedCommand's outer catch; every other provision failure
262
+ // propagates unchanged (withSandbox already disposed).
263
+ if (err instanceof QuotaExceededError) {
264
+ return {
265
+ success: false,
266
+ output: "",
267
+ turns: 0,
268
+ error: err.message,
269
+ durationMs: Date.now() - startTime,
270
+ stopReason: "error_quota",
271
+ };
272
+ }
273
+ throw err;
211
274
  });
212
275
  }
213
276
  const SCRIPT_EXT = { js: "mjs", ts: "mts", python: "py" };
@@ -239,66 +302,99 @@ function scriptInvocation(spec) {
239
302
  * dashboard + CLI.
240
303
  */
241
304
  export async function runSandboxedCommand(spec, ctx, cmdOpts) {
305
+ // A type:script phase stages the script bytes into the sandbox by writing them
306
+ // to `prov.hostWorkspaceDir` — correct for every host-shared backend
307
+ // (docker/smol/none), where that dir is bind-mounted into the guest. The k8s
308
+ // backend has no host-shared workspace (skills + AGENTS.md reach the pod over
309
+ // HTTP init-fetch channels instead), and nothing stages the script into the
310
+ // pod, so the write would land on the harness FS and the pod would hit a
311
+ // confusing `No such file or directory`. Fail fast with an actionable message.
312
+ // type:bash is unaffected — it runs the command directly, staging no file.
313
+ if (ctx.backend === "kubernetes" && spec.kind === "script") {
314
+ throw new Error("type:script phases are not yet supported on the kubernetes backend " +
315
+ "(no host-shared workspace to stage the script into the pod); use a " +
316
+ "type:bash phase, or run this workflow on the docker/gondolin backend");
317
+ }
242
318
  const { config } = ctx;
243
319
  const model = config.model || DEFAULT_MODEL;
244
320
  const sessionsDir = resolveSessionsDir(config);
245
321
  const timeoutSeconds = cmdOpts.timeoutSeconds ?? 300;
246
322
  const startTime = Date.now();
247
323
  const displayPrompt = spec.kind === "bash" ? `$ ${spec.command}` : `${spec.runtime} script: ${spec.name}\n\n${spec.script}`;
248
- return withSandbox(ctx, async (sandbox, prov) => {
249
- // Per-phase script-bundle dir, a workspace-root sibling of the skill bundle.
250
- const scriptDir = spec.kind === "script" ? `${SCRIPT_BUNDLE_ROOT}/${spec.name}` : SCRIPT_BUNDLE_ROOT;
251
- let command;
252
- let toolInput;
253
- if (spec.kind === "bash") {
254
- command = spec.command;
255
- toolInput = { command: spec.command };
256
- }
257
- else {
258
- const { fileName, run } = scriptInvocation(spec);
259
- mkdirSync(join(prov.hostWorkspaceDir, scriptDir), { recursive: true });
260
- writeFileSync(join(prov.hostWorkspaceDir, scriptDir, fileName), spec.script);
261
- command = run(sandbox.sandboxPathFor(`${scriptDir}/${fileName}`));
262
- toolInput = { command, runtime: spec.runtime };
263
- }
264
- // Git identity + auth, same as the agent path (runSandboxedAgent) — so a
265
- // commit made by a deterministic bash/script phase (e.g. a status-doc commit)
266
- // is authored as the configured botLogin, not left identity-less. The
267
- // caller's sandboxEnv (upstream phase outputs) wins on key collision.
268
- //
269
- // Also forward the GitHub API base-url override (evals fake): the agent path
270
- // threads `githubApiBaseUrl` too, so a GitHub-mutating script (e.g.
271
- // pr-review's post-review step) hits the fake in evals. Prod-inert —
272
- // `githubApiBaseUrl` is undefined outside the eval harness.
273
- const sandboxEnv = {
274
- ...agentGitIdentityEnv(getRuntimeConfig()?.botLogin ?? `${getBotName()}[bot]`, ctx.env.GIT_TOKEN),
275
- ...(cmdOpts.sandboxEnv ?? {}),
276
- ...(config.githubApiBaseUrl ? { GITHUB_API_URL: config.githubApiBaseUrl } : {}),
277
- };
278
- const res = await sandbox.runCommand(ctx.taskId, command, {
279
- cwd: prov.agentCwd,
280
- sandboxEnv,
281
- timeoutSeconds,
324
+ try {
325
+ return await withSandbox(ctx, async (sandbox, prov) => {
326
+ // Per-phase script-bundle dir, a workspace-root sibling of the skill bundle.
327
+ const scriptDir = spec.kind === "script" ? `${SCRIPT_BUNDLE_ROOT}/${spec.name}` : SCRIPT_BUNDLE_ROOT;
328
+ let command;
329
+ let toolInput;
330
+ if (spec.kind === "bash") {
331
+ command = spec.command;
332
+ toolInput = { command: spec.command };
333
+ }
334
+ else {
335
+ const { fileName, run } = scriptInvocation(spec);
336
+ mkdirSync(join(prov.hostWorkspaceDir, scriptDir), { recursive: true });
337
+ writeFileSync(join(prov.hostWorkspaceDir, scriptDir, fileName), spec.script);
338
+ command = run(sandbox.sandboxPathFor(`${scriptDir}/${fileName}`));
339
+ toolInput = { command, runtime: spec.runtime };
340
+ }
341
+ // Git identity + auth, same as the agent path (runSandboxedAgent) — so a
342
+ // commit made by a deterministic bash/script phase (e.g. a status-doc commit)
343
+ // is authored as the configured botLogin, not left identity-less. The
344
+ // caller's sandboxEnv (upstream phase outputs) wins on key collision.
345
+ //
346
+ // Also forward the GitHub API base-url override (evals fake): the agent path
347
+ // threads `githubApiBaseUrl` too, so a GitHub-mutating script (e.g.
348
+ // pr-review's post-review step) hits the fake in evals. Prod-inert —
349
+ // `githubApiBaseUrl` is undefined outside the eval harness.
350
+ const sandboxEnv = {
351
+ ...agentGitIdentityEnv(getRuntimeConfig()?.botLogin ?? `${getBotName()}[bot]`, ctx.env.GIT_TOKEN),
352
+ ...(cmdOpts.sandboxEnv ?? {}),
353
+ ...(config.githubApiBaseUrl ? { GITHUB_API_URL: config.githubApiBaseUrl } : {}),
354
+ };
355
+ const res = await sandbox.runCommand(ctx.taskId, command, {
356
+ cwd: prov.agentCwd,
357
+ sandboxEnv,
358
+ timeoutSeconds,
359
+ });
360
+ const durationMs = Date.now() - startTime;
361
+ const sessionId = cmdOpts.writeSession === false
362
+ ? null
363
+ : await writeCommandSession({
364
+ sessionsDir,
365
+ projectSlug: projectSlugForCwd(prov.agentCwd),
366
+ model,
367
+ displayPrompt,
368
+ toolName: "bash",
369
+ toolInput,
370
+ stdout: res.stdout,
371
+ stderr: res.stderr,
372
+ exitCode: res.exitCode,
373
+ durationMs,
374
+ });
375
+ if (sessionId && ctx.onSessionId)
376
+ ctx.onSessionId(sessionId);
377
+ return buildCommandResult(res, durationMs, sessionId);
282
378
  });
283
- const durationMs = Date.now() - startTime;
284
- const sessionId = cmdOpts.writeSession === false
285
- ? null
286
- : await writeCommandSession({
287
- sessionsDir,
288
- projectSlug: projectSlugForCwd(prov.agentCwd),
289
- model,
290
- displayPrompt,
291
- toolName: "bash",
292
- toolInput,
293
- stdout: res.stdout,
294
- stderr: res.stderr,
295
- exitCode: res.exitCode,
379
+ }
380
+ catch (err) {
381
+ // A k8s ResourceQuota rejection on a bash/script phase is backpressure too:
382
+ // surface it as an error_quota RESULT so the runner requeues (spec/09-sandbox.md (Concurrency)).
383
+ // Every other throw propagates exactly as before (the engine records it as a
384
+ // failed phase) — we do NOT swallow real command failures.
385
+ if (err instanceof QuotaExceededError) {
386
+ const durationMs = Date.now() - startTime;
387
+ return {
388
+ success: false,
389
+ output: "",
390
+ turns: 0,
391
+ error: err.message,
296
392
  durationMs,
297
- });
298
- if (sessionId && ctx.onSessionId)
299
- ctx.onSessionId(sessionId);
300
- return buildCommandResult(res, durationMs, sessionId);
301
- });
393
+ stopReason: "error_quota",
394
+ };
395
+ }
396
+ throw err;
397
+ }
302
398
  }
303
399
  /**
304
400
  * Mirror a finished command into a session jsonl via the shim. Synthesizes a
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../../src/engine/executors/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EACL,mBAAmB,EACnB,UAAU,GAOX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAIjB,MAAM,u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AC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE;QACrF,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IACf,qEAAqE;IACrE,4EAA4E;IAC5E,6EAA6E;IAC7E,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,OAAO;QACL,OAAO;QACP,MAAM;QACN,KAAK,EAAE,CAAC;QACR,UAAU;QACV,SAAS,EAAE,SAAS,IAAI,SAAS;QACjC,KAAK,EAAE,OAAO;YACZ,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,GAAG,CAAC,QAAQ;gBACZ,CAAC,CAAC,2BAA2B,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG;gBAC7D,CAAC,CAAC,kBAAkB,GAAG,CAAC,QAAQ,EAAE;QACtC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY;KAChF,CAAC;AACJ,CAAC"}
@@ -6,6 +6,17 @@ export type { ExecutorConfig, ExecutionResult, ExtensionStatus, ExtensionStatusM
6
6
  * pass through unchanged. Kept as an explicit map so renames on either
7
7
  * side surface as a type error rather than a silent runtime mismatch.
8
8
  */
9
- export declare const AGENTIC_PROFILE_FOR: Record<GitAccessProfile, string>;
9
+ export declare const AGENTIC_PROFILE_FOR: Record<GitAccessProfile, GitAccessProfile>;
10
+ /**
11
+ * The closed set of valid `--profile` values — the single source of truth for
12
+ * every sandbox adapter's `runAgent` guard. `RunAgentOpts.profile` is typed to
13
+ * the `GitAccessProfile` union, so a caller inside the codebase can't construct
14
+ * an invalid value; this set exists as defence-in-depth against values that
15
+ * arrive already erased to `string` (an `any`-cast test double, a future
16
+ * untyped caller) before they reach the agentic-pi CLI. Was previously
17
+ * hand-rolled as an identical `Set` in both the k8s and docker adapters —
18
+ * centralized here, next to `GitAccessProfile`, to kill that triplication.
19
+ */
20
+ export declare const AGENTIC_PROFILES: ReadonlySet<GitAccessProfile>;
10
21
  export declare const GITHUB_PERMISSION_PROFILES: Record<GitAccessProfile, GitHubTokenPermissions>;
11
22
  export declare function loadAgentContext(_dir?: string): string;
@@ -10,6 +10,22 @@ export const AGENTIC_PROFILE_FOR = {
10
10
  "review-write": "review-write",
11
11
  "repo-write": "repo-write",
12
12
  };
13
+ /**
14
+ * The closed set of valid `--profile` values — the single source of truth for
15
+ * every sandbox adapter's `runAgent` guard. `RunAgentOpts.profile` is typed to
16
+ * the `GitAccessProfile` union, so a caller inside the codebase can't construct
17
+ * an invalid value; this set exists as defence-in-depth against values that
18
+ * arrive already erased to `string` (an `any`-cast test double, a future
19
+ * untyped caller) before they reach the agentic-pi CLI. Was previously
20
+ * hand-rolled as an identical `Set` in both the k8s and docker adapters —
21
+ * centralized here, next to `GitAccessProfile`, to kill that triplication.
22
+ */
23
+ export const AGENTIC_PROFILES = new Set([
24
+ "read",
25
+ "issues-write",
26
+ "review-write",
27
+ "repo-write",
28
+ ]);
13
29
  export const GITHUB_PERMISSION_PROFILES = {
14
30
  read: {
15
31
  contents: "read",
@@ -17,12 +33,28 @@ export const GITHUB_PERMISSION_PROFILES = {
17
33
  pull_requests: "read",
18
34
  metadata: "read",
19
35
  },
36
+ // `pull_requests: "write"` is NOT an over-grant — it is what "comment on a
37
+ // PR" costs. GitHub resolves `POST /repos/:o/:r/issues/:n/comments` against
38
+ // the *target's* type: an issue checks `issues`, a pull request checks
39
+ // `pull_requests`. So an issues-write token could comment on issues but 403'd
40
+ // ("Resource not accessible by integration") on every PR — breaking
41
+ // `pr-comment`, and `verify` / `qa-test` / `demo` / `issue-comment` whenever
42
+ // they land on a PR (issue #239). The same rule governs labels + assignees on
43
+ // a PR. The profile's tool set (`ISSUES_WRITE_TOOLS` in agentic-pi) is
44
+ // unchanged and stays the behavioural boundary: no PR-review or
45
+ // PR-creation tool is registered here — that's still `review-write`.
20
46
  "issues-write": {
21
47
  contents: "read",
22
48
  issues: "write",
23
- pull_requests: "read",
49
+ pull_requests: "write",
24
50
  metadata: "read",
25
51
  },
52
+ // Same token scope as `issues-write` since #239 — GitHub has no finer grain
53
+ // than `pull_requests: write` for "comment on a PR" vs "submit a review".
54
+ // The two profiles stay distinct because the *tool set* differs:
55
+ // `REVIEW_WRITE_TOOLS` adds `github_create_pull_request` +
56
+ // `github_create_pull_request_review`, which the comment workflows must not
57
+ // be able to call.
26
58
  "review-write": {
27
59
  contents: "read",
28
60
  issues: "write",
@@ -1 +1 @@
1
- {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/engine/github/profiles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAkBzF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,YAAY;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAqD;IAC1F,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,MAAM;KACjB;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,OAAO;QACf,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,MAAM;KACjB;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,OAAO;QACf,aAAa,EAAE,OAAO;QACtB,QAAQ,EAAE,MAAM;KACjB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,OAAO;QACf,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,MAAM;KACj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AO;QACjB,MAAM,EAAE,OAAO;QACf,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,MAAM;KACjB;CACF,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC5C,OAAO,wBAAwB,EAAE,CAAC;AACpC,CAAC"}
package/dist/index.js CHANGED
@@ -17,9 +17,17 @@ import { CronScheduler } from "./cron/scheduler.js";
17
17
  import { getJobs } from "./cron/jobs.js";
18
18
  import { dispatchCronWorkflow, fanOutContexts } from "./cron/fanout.js";
19
19
  import { sweepSandboxes } from "./cron/sandbox-sweep.js";
20
+ import { sweepK8sSandboxes } from "./sandbox/k8s/sweep.js";
20
21
  import { discoverGreenDependencyPrs, discoverRedDependencyPrs, } from "./cron/dependabot-discovery.js";
22
+ import { discoverPrsAwaitingReview } from "./cron/review-discovery.js";
21
23
  import { mountAdmin } from "./admin/index.js";
22
24
  import { cleanupOrphanedSandboxes } from "./sandbox/index.js";
25
+ import { mountSkillBundle } from "./sandbox/k8s/skill-bundle-route.js";
26
+ import { skillBundleRegistry } from "./sandbox/k8s/skill-bundle.js";
27
+ import { mountAgentContext } from "./sandbox/k8s/agent-context-route.js";
28
+ import { agentContextRegistry } from "./sandbox/k8s/agent-context-registry.js";
29
+ import { mountArtifactUpload } from "./sandbox/k8s/artifact-upload-route.js";
30
+ import { artifactStore } from "./sandbox/artifact-store.js";
23
31
  import { writeEgressFirewallConfigs, writeOtelCollectorConfig } from "./sandbox/egress-firewall-config.js";
24
32
  import { initTelemetry, shutdownTelemetry } from "./telemetry/index.js";
25
33
  import { authMiddleware, authIsEnabled, actorFromContext } from "./admin/auth.js";
@@ -545,8 +553,9 @@ async function main() {
545
553
  }
546
554
  : onRunStart,
547
555
  };
556
+ let result;
548
557
  try {
549
- const result = await runSimpleWorkflow(workflowName, request, {
558
+ result = await runSimpleWorkflow(workflowName, request, {
550
559
  model: config.model,
551
560
  maxTurns: config.maxTurns,
552
561
  stateDir: config.stateDir,
@@ -579,12 +588,16 @@ async function main() {
579
588
  }
580
589
  finally {
581
590
  // Event-driven admission: after each dispatch settles, pull the next
582
- // queued run into a free slot (if any). Fire-and-forget — a slow
583
- // admission must not stall the caller.
584
- admissionController?.admitNext().catch((err) => {
585
- const msg = err instanceof Error ? err.message : String(err);
586
- console.warn(`[admission] admitNext error: ${msg}`);
587
- });
591
+ // queued run into a free slot. Skip it when THIS dispatch just requeued
592
+ // on quota backpressure — re-promoting instantly would re-hit the full
593
+ // quota in a tight loop; the periodic sweep + real completions pace the
594
+ // retry.
595
+ if (!result?.backpressure) {
596
+ admissionController?.admitNext().catch((err) => {
597
+ const msg = err instanceof Error ? err.message : String(err);
598
+ console.warn(`[admission] admitNext error: ${msg}`);
599
+ });
600
+ }
588
601
  }
589
602
  };
590
603
  // Set up connector registry
@@ -598,6 +611,9 @@ async function main() {
598
611
  // (src/cli/cli.ts, cli-server.ts).
599
612
  const app = new Hono();
600
613
  app.get("/health", (c) => c.json({ status: "ok" }));
614
+ mountSkillBundle(app, skillBundleRegistry);
615
+ mountAgentContext(app, agentContextRegistry);
616
+ mountArtifactUpload(app, artifactStore);
601
617
  // GitHub webhook connector (optional — requires both webhook secret and GitHub
602
618
  // App). It registers /webhooks/github onto the shared app; it no longer owns
603
619
  // the HTTP listener.
@@ -640,13 +656,20 @@ async function main() {
640
656
  delivery.register("slack", (msg) => slackConnector.sendToDeliveryChannel(msg));
641
657
  }
642
658
  }
643
- // Dependency-PR discoverers keyed by a cron context's `discover` value. Each
644
- // returns the eligible PRs (in code, no LLM); the runner fans out one run per
645
- // PR. Add a discoverer + a `cron-*.yaml` with the matching `discover:` key to
646
- // introduce a new backstop sweep.
647
- const DEP_PR_DISCOVERERS = {
659
+ // PR discoverers keyed by a cron context's `discover` value. Each returns the
660
+ // eligible PRs (in code, no LLM) and the runner fans out one bounded single-PR
661
+ // run each (with prNumber + head ref) — the shape the pr.* webhooks produce.
662
+ // Add a discoverer + a `cron-*.yaml` with the matching `discover:` key to
663
+ // introduce a new sweep. The harness `github` client (App auth) is passed to
664
+ // every discoverer, so a discoverer only needs the subset of it it uses.
665
+ const PR_DISCOVERERS = {
648
666
  "green-dependency-prs": discoverGreenDependencyPrs,
649
667
  "red-dependency-prs": discoverRedDependencyPrs,
668
+ // The pr-review cron: find open PRs awaiting review and fan out one single-PR
669
+ // pr-review run each. Replaces the old `mode: scan` review run, which ran the
670
+ // whole listing/reviewing inside the sandbox with a static token it couldn't
671
+ // re-mint and no way to hand its chosen PR to post-review.
672
+ "prs-awaiting-review": (repos, gh, opts) => discoverPrsAwaitingReview(repos, gh, { ...opts, botLogin: config.botLogin }),
650
673
  };
651
674
  // Construct the cron scheduler before mounting admin so the dashboard can
652
675
  // list/toggle/edit registered cron jobs. Jobs are registered further down
@@ -663,7 +686,7 @@ async function main() {
663
686
  // we dispatch one run each — the same shape the pr.checks_passed /
664
687
  // pr.checks_failed webhooks produce. Runs queue against the global cap.
665
688
  const discoverKey = typeof context.discover === "string" ? context.discover : undefined;
666
- const discoverer = discoverKey ? DEP_PR_DISCOVERERS[discoverKey] : undefined;
689
+ const discoverer = discoverKey ? PR_DISCOVERERS[discoverKey] : undefined;
667
690
  if (discoverer) {
668
691
  const repos = Array.isArray(context.repos)
669
692
  ? context.repos.filter((r) => typeof r === "string")
@@ -729,6 +752,7 @@ async function main() {
729
752
  resumeOpts,
730
753
  maxWorkflows: config.concurrency.maxWorkflows,
731
754
  maxQueueWaitMs: config.concurrency.maxQueueWaitMs,
755
+ backpressureMode: config.sandbox === "kubernetes",
732
756
  });
733
757
  // Mount admin dashboard on the shared HTTP server (always available).
734
758
  {
@@ -1035,12 +1059,27 @@ async function main() {
1035
1059
  // Reap-on-completion (workflows/simple.ts) handles the common case; this
1036
1060
  // sweeps failed/crashed leftovers and bounds the reusable per-PR cache. It
1037
1061
  // replaces the out-of-band host cron (scripts/cleanup-sandboxes.sh).
1062
+ // The `kubernetes` backend reclaims idle cluster PVCs (Plan 5) AND sweeps the
1063
+ // host-local artifact dirs its pods upload to (`<sandboxDir>/<taskId>`, since
1064
+ // the artifact store is host-local on every backend) — both via
1065
+ // `sweepK8sSandboxes`, which stands in for the host-dir sweep that's disabled
1066
+ // on k8s. Every other backend keeps the original host-dir sweep.
1038
1067
  const sweepCfg = config.cleanup.sandbox;
1039
1068
  if (sweepCfg.enabled) {
1040
1069
  cron.registerDirect({
1041
1070
  name: "sandbox-sweep",
1042
1071
  schedule: sweepCfg.sweepSchedule,
1043
1072
  handler: async () => {
1073
+ if (config.sandbox === "kubernetes") {
1074
+ await sweepK8sSandboxes({
1075
+ retentionHours: sweepCfg.retentionHours,
1076
+ maxIdlePVCs: sweepCfg.maxDirs,
1077
+ maxDirs: sweepCfg.maxDirs,
1078
+ stateDir: config.stateDir,
1079
+ sandboxDir: config.sandboxDir,
1080
+ });
1081
+ return;
1082
+ }
1044
1083
  sweepSandboxes({
1045
1084
  stateDir: config.stateDir,
1046
1085
  sandboxDir: config.sandboxDir,