@desplega.ai/agent-swarm 2.7.10 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-t949vbbp.js +15 -0
- package/dist/{actions-b8aqhrsg.js → actions-7e9czc7s.js} +18 -19
- package/dist/{amp-adapter-4c165vgn.js → amp-adapter-gv6cbb7d.js} +2 -3
- package/dist/{app-m9khefrh.js → app-b9fbkp9v.js} +3 -3
- package/dist/{assistant-rh4v3ntz.js → assistant-wjb7v4c7.js} +20 -21
- package/dist/{boot-args-schema-hwkc8bzv.js → boot-args-schema-2t37e0fe.js} +1 -1
- package/dist/{boot-reembed-5y6yw9sj.js → boot-reembed-a35nkyr1.js} +1 -1
- package/dist/{boot-reembed-fdyk55h4.js → boot-reembed-gka3zas7.js} +1 -1
- package/dist/{boot-scrub-sweep-r5r8kqsn.js → boot-scrub-sweep-65sdnp6c.js} +3 -3
- package/dist/{boot-seeds-8f9zt5cm.js → boot-seeds-x42tzytw.js} +4 -5
- package/dist/{claude-adapter-s5df247c.js → claude-adapter-v221b2fd.js} +7 -8
- package/dist/{claude-managed-adapter-h74d06yz.js → claude-managed-adapter-29eq09wd.js} +2 -2
- package/dist/{claude-managed-setup-9gsmwzyx.js → claude-managed-setup-9m6450zk.js} +2 -2
- package/dist/{claude-sdk-session-dq1j4nz9.js → claude-sdk-session-0q0ptaba.js} +9066 -8818
- package/dist/{cli-n5yexkdg.js → cli-0b4zam62.js} +1 -0
- package/dist/{cli-5wfz00be.js → cli-0jzra9ad.js} +2 -2
- package/dist/{cli-eqtfgfr6.js → cli-2gxeg5gr.js} +1 -1
- package/dist/{cli-eqk5p56g.js → cli-2wnq8jkz.js} +9 -9
- package/dist/{cli-hfkwwy1h.js → cli-2zp0et3v.js} +21 -2
- package/dist/{cli-rt0ag4x1.js → cli-334z18y3.js} +4 -4
- package/dist/{cli-6m6b4bep.js → cli-3rkdne1h.js} +2 -2
- package/dist/{cli-3xddv0rk.js → cli-4txa0ter.js} +5 -7
- package/dist/{cli-jc1g9ndz.js → cli-5j88qqa8.js} +10 -5
- package/dist/{cli-xfjrc279.js → cli-5mrq3ake.js} +48 -14
- package/dist/{cli-n07eecjs.js → cli-6t09sdhy.js} +3 -3
- package/dist/{cli-38yww4e9.js → cli-6wxjceza.js} +8 -8
- package/dist/{cli-5xcb8gxq.js → cli-7b8sbmag.js} +8 -8
- package/dist/{cli-3xj33nrx.js → cli-7cp6aa1q.js} +10 -3
- package/dist/{cli-mp9aa8g5.js → cli-7p1kvkck.js} +6 -6
- package/dist/{cli-w3bk0dgv.js → cli-8aes17e4.js} +2 -2
- package/dist/{cli-n9abj89w.js → cli-8fknbnhw.js} +8 -8
- package/dist/{cli-xd5ebp64.js → cli-8kzasymh.js} +3 -3
- package/dist/{cli-2tsfpc70.js → cli-a7wvp2km.js} +1 -1
- package/dist/{cli-kx4c8j05.js → cli-abejgen1.js} +63 -19
- package/dist/{cli-36wdfzgn.js → cli-bsywb58a.js} +8 -8
- package/dist/{cli-yz7v0sh4.js → cli-c55z5chy.js} +4 -6
- package/dist/{cli-18qt3few.js → cli-deefvewm.js} +1 -1
- package/dist/{cli-jg24scat.js → cli-ee0b971j.js} +3 -3
- package/dist/cli-f3vq58d2.js +242 -0
- package/dist/{cli-3xcwp3z8.js → cli-ffhtssbp.js} +2 -2
- package/dist/{cli-rjyghzg4.js → cli-g70vxtjh.js} +2 -2
- package/dist/{cli-g1px1g2e.js → cli-gxkx0zzp.js} +1 -1
- package/dist/{cli-j7d73g1y.js → cli-h38x262p.js} +3035 -354
- package/dist/{cli-zjphdj1a.js → cli-j790gp2w.js} +40 -18
- package/dist/{cli-f2zenhja.js → cli-kc7v1nfv.js} +1 -1
- package/dist/{cli-td33w98c.js → cli-m23zjcy2.js} +10 -10
- package/dist/{cli-8ewkreqd.js → cli-m28atx8q.js} +7 -9
- package/dist/{cli-x9exydey.js → cli-m4dqmnbp.js} +1 -1
- package/dist/{cli-ybjdc978.js → cli-mrt48bx7.js} +7 -4
- package/dist/{cli-mr97t7cc.js → cli-p1bq50aa.js} +263 -14
- package/dist/{cli-ttbqe3q4.js → cli-p1w18yhx.js} +1 -1
- package/dist/{cli-nj3x45rw.js → cli-p2gfst4m.js} +52 -43
- package/dist/{cli-z9cs5m0w.js → cli-pasjcnmj.js} +12 -12
- package/dist/{cli-an1knn2k.js → cli-qa4wdgsy.js} +5 -5
- package/dist/{cli-xncjscpm.js → cli-qfedvmcr.js} +50 -24
- package/dist/{cli-tmft5dz2.js → cli-qmqk2yc2.js} +1 -1
- package/dist/{cli-bxz823sz.js → cli-qsnnd04k.js} +1 -1
- package/dist/{cli-cr14kftt.js → cli-qwca7s44.js} +3 -3
- package/dist/{cli-7wz05bx3.js → cli-rfywm85n.js} +460 -737
- package/dist/{cli-v2fwbnsk.js → cli-rmmpt0wm.js} +6 -6
- package/dist/{cli-xbtq4d6s.js → cli-rzsy6nc6.js} +12 -8
- package/dist/{cli-0m7rtm11.js → cli-s7t6p9my.js} +1 -1
- package/dist/{cli-16phend6.js → cli-sdtt3men.js} +1 -1
- package/dist/{cli-pyrxt9gw.js → cli-tk7cjj8h.js} +1 -1
- package/dist/{cli-xvymtmv4.js → cli-tqegb8eq.js} +3 -3
- package/dist/{cli-kf3pxxdg.js → cli-v1dv1r37.js} +1 -1
- package/dist/{cli-h49ejvmc.js → cli-wcg8x116.js} +1 -1
- package/dist/{cli-q581b386.js → cli-wk18cm92.js} +5 -5
- package/dist/{cli-4vwxp550.js → cli-x1wa213s.js} +1 -1
- package/dist/{cli-jrp1dt73.js → cli-xzm9vcfg.js} +1 -1
- package/dist/{cli-eb2azq8n.js → cli-y97qxcfx.js} +9 -9
- package/dist/{cli-55bkx8hh.js → cli-yq3zak69.js} +1 -1
- package/dist/cli.js +17 -17
- package/dist/{codex-adapter-yr60sme6.js → codex-adapter-30j9bpzd.js} +5 -6
- package/dist/{codex-hook-fac6175r.js → codex-hook-h3vk6xzr.js} +1 -1
- package/dist/{codex-session-runner-pch8x584.js → codex-session-runner-8vp57v8w.js} +5 -6
- package/dist/{commands-phjfbkv0.js → commands-bngnz9g7.js} +3 -3
- package/dist/{controller-jkx994pz.js → controller-hxx8wwy1.js} +2 -2
- package/dist/{controllers-connect-c4448kwa.js → controllers-connect-e2b4gyxc.js} +19 -20
- package/dist/{cursor-adapter-ndebqnm8.js → cursor-adapter-n5nc3mfe.js} +1 -2
- package/dist/{db-ez6egt6v.js → db-bgm7vkc0.js} +3 -3
- package/dist/{db-ef32tbfc.js → db-c6np41ca.js} +10 -2
- package/dist/{devin-adapter-z46ep5ph.js → devin-adapter-xedz98zv.js} +1 -1
- package/dist/{dispatcher-g3tt9hs9.js → dispatcher-jnybck15.js} +17 -18
- package/dist/{dsh-adapter-tcyn3099.js → dsh-adapter-nrhbrjz8.js} +1 -2
- package/dist/{easter-egg-3d-e36hk5td.js → easter-egg-3d-533knw22.js} +1 -1
- package/dist/{embedding-space-4kyh5qqj.js → embedding-space-crsm2zp0.js} +6 -6
- package/dist/{embeddings-6a8v4a6t.js → embeddings-e7z3f27f.js} +1 -1
- package/dist/{execute-3cbg0twf.js → execute-b3mrb1mv.js} +1 -1
- package/dist/{external-channel-se646snz.js → external-channel-m77wf5z3.js} +2 -2
- package/dist/{fx-adapter-yw795hqq.js → fx-adapter-b6w0kf56.js} +7 -8
- package/dist/{grok-adapter-ttmcss2j.js → grok-adapter-4sqtebdk.js} +7 -8
- package/dist/handlers-kdjcyzdj.js +32 -0
- package/dist/heartbeat-xgb036sx.js +43 -0
- package/dist/{hook-g3nhexsy.js → hook-5h02c9ga.js} +6 -6
- package/dist/{hook-hq93y5ej.js → hook-xsk1jbha.js} +5 -5
- package/dist/{http-5a9p4h6y.js → http-txe7qhvn.js} +282 -140
- package/dist/{index-6haqt3v5.js → index-4a0670yh.js} +8917 -8476
- package/dist/index-835xdgnm.js +33 -0
- package/dist/index-d469300x.js +37 -0
- package/dist/index-rzqwp11g.js +32 -0
- package/dist/{index-s72rqgsx.js → index-tvfafeyy.js} +1 -1
- package/dist/{index-hgn3c961.js → index-vk63emp7.js} +978 -35
- package/dist/{index-3c5pxbge.js → index-ysvbhg5m.js} +1 -1
- package/dist/{keepalive-1j4n4dmk.js → keepalive-4zsrce78.js} +3 -3
- package/dist/lead-yqt47dkr.js +70 -0
- package/dist/{maintenance-dmghacy5.js → maintenance-86jvartk.js} +1 -1
- package/dist/{oauth-refresh-sweep-yy06c03c.js → oauth-refresh-sweep-j52kg9pr.js} +2 -2
- package/dist/{onboard-52f9t5dm.js → onboard-c2aj5p8q.js} +3 -3
- package/dist/{opencode-adapter-krnh9jkn.js → opencode-adapter-dsagkhtw.js} +5 -6
- package/dist/{otel-impl-xjqz6wjj.js → otel-impl-yyy203z8.js} +1 -1
- package/dist/{pi-mono-adapter-dbxyp0qv.js → pi-mono-adapter-546cd1cc.js} +9 -9
- package/dist/{pricing-refresh-ctdr74pd.js → pricing-refresh-1rgzqyzz.js} +2 -3
- package/dist/{rbac-roles-q0gr8eyj.js → rbac-roles-e70xfeyj.js} +4 -6
- package/dist/{rbac-roles-ehv8s10n.js → rbac-roles-q89qe8er.js} +3 -3
- package/dist/{registry-hpjfmcfz.js → registry-32b1mft6.js} +1 -1
- package/dist/{render-v2-5b6chvcq.js → render-v2-k6tt107q.js} +3 -3
- package/dist/{resume-5a5d2845.js → resume-cnnrjfxa.js} +6 -6
- package/dist/{runtime-khxszyfp.js → runtime-1hv06jsn.js} +1 -1
- package/dist/{session-access-gj0bjhqg.js → session-access-xkxkjw3n.js} +4 -4
- package/dist/{session-source-backfill-2sy0krfk.js → session-source-backfill-1d5pdwww.js} +2 -2
- package/dist/{setup-7ssfakk1.js → setup-se8q7gkc.js} +1 -1
- package/dist/{virtual-modules-pjj0knwf.js → virtual-modules-gazyapte.js} +3 -3
- package/dist/{work-objects-bf3syvhq.js → work-objects-1kxnbzy5.js} +20 -21
- package/dist/{worker-follow-up-38xevga6.js → worker-follow-up-zqm8apt4.js} +17 -18
- package/dist/worker-j6xxtq7p.js +70 -0
- package/openapi.json +334 -7
- package/package.json +4 -4
- package/src/apps/definition.ts +11 -0
- package/src/apps/store.ts +28 -8
- package/src/be/db/model-profiles.ts +147 -38
- package/src/be/db/tasks/read.ts +5 -1
- package/src/be/db/workflow-run-definitions.ts +117 -0
- package/src/be/db.ts +24 -3
- package/src/be/memory/constants.ts +14 -1
- package/src/be/memory/key-paths.ts +8 -0
- package/src/be/memory/providers/sqlite-store.ts +160 -10
- package/src/be/memory/task-learning.ts +79 -14
- package/src/be/memory/types.ts +24 -1
- package/src/be/migrations/279_backfill_learning_expiry.sql +15 -0
- package/src/be/migrations/281_model_profiles_pr2.sql +28 -0
- package/src/be/migrations/283_workflow_run_definitions.sql +14 -0
- package/src/be/model-profile-check.ts +284 -0
- package/src/be/model-tier-resolution.ts +112 -12
- package/src/be/multi-runtime.ts +27 -0
- package/src/be/runtime-pools/routing.ts +52 -4
- package/src/be/scripts/typecheck.ts +1 -0
- package/src/be/seed-scripts/catalog/dreaming-learnings.ts +552 -0
- package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +389 -14
- package/src/be/seed-scripts/catalog/dreaming-memtax.ts +6 -3
- package/src/be/seed-scripts/index.ts +9 -0
- package/src/be/steering.ts +8 -2
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +32 -1
- package/src/fs/provider.ts +17 -3
- package/src/heartbeat/heartbeat.ts +12 -1
- package/src/heartbeat/index.ts +1 -0
- package/src/http/agents.ts +56 -4
- package/src/http/apps.ts +3 -1
- package/src/http/config.ts +2 -6
- package/src/http/index.ts +2 -3
- package/src/http/model-profiles.ts +58 -10
- package/src/http/poll.ts +36 -3
- package/src/http/schedules.ts +42 -3
- package/src/http/tasks.ts +37 -12
- package/src/http/workflows.ts +15 -2
- package/src/prompts/session-templates.ts +1 -1
- package/src/providers/acp-targets.ts +11 -6
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-sdk-session.ts +132 -23
- package/src/providers/codex-skill-resolver.ts +10 -4
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/devin-skill-resolver.ts +5 -5
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/scheduler/schedule-task.ts +1 -0
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-sdk.ts +18 -1
- package/src/scripts-runtime/types/stdlib.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -0
- package/src/server.ts +2 -0
- package/src/slack/app.ts +93 -0
- package/src/slack/inbound-dispatch.ts +18 -1
- package/src/slack/workspace-guard.ts +345 -0
- package/src/tasks/task-terminal-effects.ts +4 -0
- package/src/tasks/worker-follow-up.ts +102 -2
- package/src/tests/acp-adapter.test.ts +82 -0
- package/src/tests/apps-icon.test.ts +120 -0
- package/src/tests/chained-task-follow-up.test.ts +248 -0
- package/src/tests/check-pr-body.test.ts +40 -0
- package/src/tests/claude-sdk-lifecycle.test.ts +216 -1
- package/src/tests/claude-sdk-process.fixture.ts +57 -0
- package/src/tests/codex-skill-resolver.test.ts +31 -0
- package/src/tests/credentials-allowlist.test.ts +470 -0
- package/src/tests/db-task-read-contract.test.ts +5 -0
- package/src/tests/db-task-write-contract.test.ts +5 -0
- package/src/tests/deferred-wake-follow-up.test.ts +47 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dreaming-learnings.test.ts +1395 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/explicit-model-validation.test.ts +2 -0
- package/src/tests/fs-provider.test.ts +42 -0
- package/src/tests/heartbeat.test.ts +28 -1
- package/src/tests/human-free-reclassify.test.ts +5 -1
- package/src/tests/list-endpoint-slimming.test.ts +17 -0
- package/src/tests/migration-283-workflow-run-definitions.test.ts +69 -0
- package/src/tests/model-profile-check.test.ts +387 -0
- package/src/tests/model-profiles-api.test.ts +528 -1
- package/src/tests/profile-claim.test.ts +415 -3
- package/src/tests/profile-tier-alias.test.ts +382 -0
- package/src/tests/schedule-profile.test.ts +359 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/script-per-script-executor.test.ts +1 -0
- package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +141 -0
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/slack-inbound-receipts.test.ts +22 -2
- package/src/tests/slack-socket-ack.test.ts +16 -1
- package/src/tests/slack-workspace-guard.test.ts +905 -0
- package/src/tests/steering-core.test.ts +40 -0
- package/src/tests/store-progress-learning.test.ts +605 -20
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/workflow-convergence.test.ts +46 -40
- package/src/tests/workflow-definition-pinning-recovery.test.ts +552 -0
- package/src/tests/workflow-definition-pinning.test.ts +645 -0
- package/src/tests/workflow-executors.test.ts +16 -7
- package/src/tests/workflow-foreach.test.ts +43 -20
- package/src/tests/workflow-notify-slack-ready.test.ts +161 -0
- package/src/tests/workflow-profile.test.ts +328 -0
- package/src/tools/app-upsert.ts +1 -1
- package/src/tools/memory-edit.ts +2 -1
- package/src/tools/model-profiles/check-model-profile.ts +63 -0
- package/src/tools/schedules/create-schedule.ts +45 -4
- package/src/tools/schedules/patch-schedule.ts +50 -4
- package/src/tools/schedules/update-schedule.ts +50 -4
- package/src/tools/send-task.ts +17 -2
- package/src/tools/store-progress.ts +15 -3
- package/src/tools/task-action.ts +9 -1
- package/src/tools/templates.ts +13 -0
- package/src/tools/tool-config.ts +2 -1
- package/src/tools/utils.ts +61 -4
- package/src/tools/workflows/create-workflow.ts +1 -1
- package/src/tools/workflows/retry-workflow-run.ts +1 -1
- package/src/tools/workflows/update-workflow.ts +10 -1
- package/src/types.ts +56 -1
- package/src/utils/credentials.ts +89 -12
- package/src/workflows/engine.ts +10 -1
- package/src/workflows/executors/agent-task.ts +21 -2
- package/src/workflows/executors/foreach.ts +4 -1
- package/src/workflows/executors/notify.ts +62 -6
- package/src/workflows/executors/sub-workflow.ts +1 -1
- package/src/workflows/executors/swarm-script.ts +4 -1
- package/src/workflows/foreach-driver.ts +8 -5
- package/src/workflows/limits.ts +2 -1
- package/src/workflows/model-validation.ts +27 -2
- package/src/workflows/patch-definition.ts +3 -1
- package/src/workflows/recovery.ts +6 -6
- package/src/workflows/resume.ts +9 -9
- package/src/workflows/retry-poller.ts +2 -2
- package/templates/skills/apps/SKILL.md +2 -0
- package/templates/skills/apps/content.md +2 -0
- package/templates/skills/code-quality/content.md +12 -0
- package/templates/skills/memory/content.md +8 -0
- package/templates/skills/scheduling/config.json +1 -1
- package/templates/skills/scheduling/content.md +2 -2
- package/templates/skills/swarm-docs/content.md +4 -0
- package/templates/skills/swarm-extensions/content.md +1 -1
- package/templates/skills/swarm-scripts/SKILL.md +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- package/templates/skills/work-on-task/SKILL.md +2 -0
- package/templates/skills/work-on-task/content.md +2 -0
- package/templates/workflows/dreaming/content.md +174 -7
- package/dist/acp-adapter-srfhs1s9.js +0 -16
- package/dist/cli-bzvs88tv.js +0 -339
- package/dist/cli-cyn9v8zr.js +0 -748
- package/dist/cli-ed6yqpf1.js +0 -779
- package/dist/handlers-17wha3ze.js +0 -33
- package/dist/heartbeat-gwewgdms.js +0 -42
- package/dist/index-8arwq8mw.js +0 -34
- package/dist/index-tpw054az.js +0 -38
- package/dist/index-waq75j2j.js +0 -31
- package/dist/lead-re73kdgc.js +0 -72
- package/dist/worker-r8mz7a65.js +0 -72
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// default (MODEL_PROFILE), and how both sit in the precedence next to a raw
|
|
3
3
|
// `model` and a `modelTier`. Drives the real `/api/poll` handler.
|
|
4
4
|
|
|
5
|
-
import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
|
|
5
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from "bun:test";
|
|
6
6
|
import { unlink } from "node:fs/promises";
|
|
7
7
|
import {
|
|
8
8
|
closeDb,
|
|
9
9
|
createAgent,
|
|
10
|
+
createSwarmRepo,
|
|
10
11
|
createTaskExtended,
|
|
11
12
|
getDbClient,
|
|
12
13
|
getTaskById,
|
|
@@ -14,10 +15,21 @@ import {
|
|
|
14
15
|
upsertSwarmConfig,
|
|
15
16
|
} from "../be/db";
|
|
16
17
|
import { createModelProfile, getAgentDefaultProfileName } from "../be/db/model-profiles";
|
|
18
|
+
import { checkProfileForAgent } from "../be/model-profile-check";
|
|
17
19
|
import { recordClaimModelResolution } from "../be/model-tier-resolution";
|
|
20
|
+
import { upsertRuntimeInstance } from "../be/multi-runtime";
|
|
21
|
+
import {
|
|
22
|
+
bindAgentToPool,
|
|
23
|
+
createRuntimeController,
|
|
24
|
+
createRuntimePool,
|
|
25
|
+
} from "../be/runtime-pools/db";
|
|
26
|
+
import { routePoolTasks } from "../be/runtime-pools/routing";
|
|
27
|
+
import { mintRuntimeToken } from "../be/users";
|
|
18
28
|
import { handlePoll } from "../http/poll";
|
|
19
29
|
import { taskModelPin } from "../tasks/model-pin";
|
|
20
30
|
import { inheritedModelSelection } from "../tasks/worker-follow-up";
|
|
31
|
+
import { registerPollTaskTool } from "../tools/poll-task";
|
|
32
|
+
import { setRequestAuth } from "../utils/request-auth-context";
|
|
21
33
|
|
|
22
34
|
const TEST_DB_PATH = "./test-profile-claim.sqlite";
|
|
23
35
|
|
|
@@ -33,13 +45,34 @@ async function removeDbFiles(path: string): Promise<void> {
|
|
|
33
45
|
|
|
34
46
|
type Trigger = { type: string; taskId: string; task: Record<string, unknown> };
|
|
35
47
|
|
|
36
|
-
async function callPoll(
|
|
48
|
+
async function callPoll(
|
|
49
|
+
agentId: string,
|
|
50
|
+
runtimeId?: string,
|
|
51
|
+
auth: "runtime-token" | "shared-key" = "runtime-token",
|
|
52
|
+
): Promise<Trigger | null> {
|
|
37
53
|
let bodyStr = "";
|
|
38
54
|
const req = {
|
|
39
55
|
method: "GET",
|
|
40
56
|
url: "/api/poll",
|
|
41
|
-
headers: {
|
|
57
|
+
headers: {
|
|
58
|
+
"x-agent-id": agentId,
|
|
59
|
+
...(runtimeId ? { "x-runtime-instance-id": runtimeId } : {}),
|
|
60
|
+
},
|
|
42
61
|
} as unknown as Parameters<typeof handlePoll>[0];
|
|
62
|
+
// A runtime-token poll, as a pooled worker's runtime makes it; a shared-key
|
|
63
|
+
// runtime authenticates as the operator.
|
|
64
|
+
if (runtimeId && auth === "shared-key") {
|
|
65
|
+
setRequestAuth(req, { kind: "operator", fingerprint: "shared-key" });
|
|
66
|
+
} else if (runtimeId) {
|
|
67
|
+
setRequestAuth(req, {
|
|
68
|
+
kind: "agent",
|
|
69
|
+
agentId,
|
|
70
|
+
taskId: null,
|
|
71
|
+
runtimeId,
|
|
72
|
+
tokenId: "runtime-token",
|
|
73
|
+
expiresAt: new Date(Date.now() + 3600_000).toISOString(),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
43
76
|
const res = {
|
|
44
77
|
setHeader() {},
|
|
45
78
|
writeHead() {},
|
|
@@ -73,9 +106,33 @@ async function setDefault(agentId: string, profile: string): Promise<void> {
|
|
|
73
106
|
});
|
|
74
107
|
}
|
|
75
108
|
|
|
109
|
+
type PollTaskHandler = (args: unknown, extra: unknown) => Promise<unknown>;
|
|
110
|
+
const mcpHandlers = new Map<string, PollTaskHandler>();
|
|
111
|
+
|
|
112
|
+
/** MCP poll-task as a worker runtime calls it; onNotify runs between passes. */
|
|
113
|
+
async function pollTaskAs(agentId: string, runtimeId: string, onNotify: () => Promise<void>) {
|
|
114
|
+
const handler = mcpHandlers.get("poll-task");
|
|
115
|
+
if (!handler) throw new Error("poll-task not registered");
|
|
116
|
+
return (await handler(
|
|
117
|
+
{},
|
|
118
|
+
{
|
|
119
|
+
sessionId: "test-session",
|
|
120
|
+
requestInfo: { headers: { "x-agent-id": agentId, "x-runtime-instance-id": runtimeId } },
|
|
121
|
+
sendNotification: onNotify,
|
|
122
|
+
},
|
|
123
|
+
)) as { structuredContent?: { task?: { id?: string } } };
|
|
124
|
+
}
|
|
125
|
+
|
|
76
126
|
beforeAll(async () => {
|
|
77
127
|
await removeDbFiles(TEST_DB_PATH);
|
|
78
128
|
initDb(TEST_DB_PATH);
|
|
129
|
+
const mcp = {
|
|
130
|
+
registerTool(name: string, _config: unknown, handler: PollTaskHandler) {
|
|
131
|
+
mcpHandlers.set(name, handler);
|
|
132
|
+
return { name };
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
registerPollTaskTool(mcp as unknown as Parameters<typeof registerPollTaskTool>[0]);
|
|
79
136
|
});
|
|
80
137
|
|
|
81
138
|
afterAll(async () => {
|
|
@@ -170,6 +227,361 @@ describe("a task's own profile", () => {
|
|
|
170
227
|
expect(trigger?.taskId).toBe(task.id);
|
|
171
228
|
expect(trigger?.task.resolvedProfile).toBe("claude-opus-high");
|
|
172
229
|
});
|
|
230
|
+
|
|
231
|
+
test("a pool task waits for a worker that passes the profile check", async () => {
|
|
232
|
+
await createModelProfile({
|
|
233
|
+
name: "claude-pinned-key",
|
|
234
|
+
harness: "claude",
|
|
235
|
+
model: "opus",
|
|
236
|
+
credentials: { CLAUDE_CODE_OAUTH_TOKEN: ["22222"] },
|
|
237
|
+
});
|
|
238
|
+
const a = await worker("p-check-fail", "claude");
|
|
239
|
+
const b = await worker("p-check-pass", "claude");
|
|
240
|
+
for (const [agentId, value] of [
|
|
241
|
+
[a.id, "sk-ant-oat01-key-a-11111"],
|
|
242
|
+
[b.id, "sk-ant-oat01-key-b-22222"],
|
|
243
|
+
] as const) {
|
|
244
|
+
await upsertSwarmConfig({
|
|
245
|
+
scope: "agent",
|
|
246
|
+
scopeId: agentId,
|
|
247
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
248
|
+
value,
|
|
249
|
+
exportToEnv: true,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
// Two tasks on one profile: A judges it once per poll and skips both.
|
|
253
|
+
const first = await createTaskExtended("pool work", { profile: "claude-pinned-key" });
|
|
254
|
+
await createTaskExtended("pool work", { profile: "claude-pinned-key" });
|
|
255
|
+
|
|
256
|
+
expect(await callPoll(a.id)).toBeNull();
|
|
257
|
+
expect((await getTaskById(first.id))?.status).toBe("unassigned");
|
|
258
|
+
const trigger = await callPoll(b.id);
|
|
259
|
+
expect(trigger?.taskId).toBe(first.id);
|
|
260
|
+
expect(trigger?.task.resolvedProfile).toBe("claude-pinned-key");
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
test("a pool task's repo-scoped key counts, and one poll judges each repo apart", async () => {
|
|
264
|
+
await createModelProfile({
|
|
265
|
+
name: "claude-repo-key",
|
|
266
|
+
harness: "claude",
|
|
267
|
+
model: "opus",
|
|
268
|
+
credentials: { CLAUDE_CODE_OAUTH_TOKEN: ["22222"] },
|
|
269
|
+
});
|
|
270
|
+
const w = await worker("p-repo", "claude");
|
|
271
|
+
await upsertSwarmConfig({
|
|
272
|
+
scope: "agent",
|
|
273
|
+
scopeId: w.id,
|
|
274
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
275
|
+
value: "sk-ant-oat01-key-a-11111",
|
|
276
|
+
exportToEnv: true,
|
|
277
|
+
});
|
|
278
|
+
const repo = await createSwarmRepo({ url: "https://github.com/acme/widgets", name: "widgets" });
|
|
279
|
+
await upsertSwarmConfig({
|
|
280
|
+
scope: "repo",
|
|
281
|
+
scopeId: repo.id,
|
|
282
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
283
|
+
value: "sk-ant-oat01-key-b-22222",
|
|
284
|
+
exportToEnv: true,
|
|
285
|
+
});
|
|
286
|
+
// The repo-less task is scanned first and fails on the agent's key; the
|
|
287
|
+
// repo task must not inherit that verdict.
|
|
288
|
+
const bare = await createTaskExtended("pool work", { profile: "claude-repo-key" });
|
|
289
|
+
await Bun.sleep(5);
|
|
290
|
+
const scoped = await createTaskExtended("pool work", {
|
|
291
|
+
profile: "claude-repo-key",
|
|
292
|
+
vcsRepo: "acme/widgets",
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
const trigger = await callPoll(w.id);
|
|
296
|
+
expect(trigger?.taskId).toBe(scoped.id);
|
|
297
|
+
expect((await getTaskById(bare.id))?.status).toBe("unassigned");
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
test("automatic pool routing skips a worker that fails the profile check", async () => {
|
|
301
|
+
await createModelProfile({
|
|
302
|
+
name: "claude-routed-key",
|
|
303
|
+
harness: "claude",
|
|
304
|
+
model: "opus",
|
|
305
|
+
credentials: { CLAUDE_CODE_OAUTH_TOKEN: ["22222"] },
|
|
306
|
+
});
|
|
307
|
+
const a = await worker("p-route-fail", "claude");
|
|
308
|
+
await upsertSwarmConfig({
|
|
309
|
+
scope: "agent",
|
|
310
|
+
scopeId: a.id,
|
|
311
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
312
|
+
value: "sk-ant-oat01-key-a-11111",
|
|
313
|
+
exportToEnv: true,
|
|
314
|
+
});
|
|
315
|
+
const task = await createTaskExtended("pool work", { profile: "claude-routed-key" });
|
|
316
|
+
expect((await checkProfileForAgent(a.id, "claude-routed-key"))?.ok).toBe(false);
|
|
317
|
+
|
|
318
|
+
expect(await routePoolTasks()).toEqual([]);
|
|
319
|
+
expect(await callPoll(a.id)).toBeNull();
|
|
320
|
+
expect((await getTaskById(task.id))?.status).toBe("unassigned");
|
|
321
|
+
|
|
322
|
+
const b = await worker("p-route-pass", "claude");
|
|
323
|
+
await upsertSwarmConfig({
|
|
324
|
+
scope: "agent",
|
|
325
|
+
scopeId: b.id,
|
|
326
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
327
|
+
value: "sk-ant-oat01-key-b-22222",
|
|
328
|
+
exportToEnv: true,
|
|
329
|
+
});
|
|
330
|
+
expect(await routePoolTasks()).toEqual([{ taskId: task.id, agentId: b.id }]);
|
|
331
|
+
const trigger = await callPoll(b.id);
|
|
332
|
+
expect(trigger?.taskId).toBe(task.id);
|
|
333
|
+
expect(trigger?.task.resolvedProfile).toBe("claude-routed-key");
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test("pool routing judges a runtime worker on the config its runtime token reads", async () => {
|
|
337
|
+
const saved = {
|
|
338
|
+
RUNTIME_POOLS_ENABLED: process.env.RUNTIME_POOLS_ENABLED,
|
|
339
|
+
MULTI_RUNTIME_ENABLED: process.env.MULTI_RUNTIME_ENABLED,
|
|
340
|
+
};
|
|
341
|
+
process.env.RUNTIME_POOLS_ENABLED = "true";
|
|
342
|
+
process.env.MULTI_RUNTIME_ENABLED = "true";
|
|
343
|
+
try {
|
|
344
|
+
await createModelProfile({
|
|
345
|
+
name: "claude-secret-repo-key",
|
|
346
|
+
harness: "claude",
|
|
347
|
+
model: "opus",
|
|
348
|
+
credentials: { CLAUDE_CODE_OAUTH_TOKEN: ["22222"] },
|
|
349
|
+
});
|
|
350
|
+
const w = await worker("p-route-runtime", "claude");
|
|
351
|
+
const runtimeId = crypto.randomUUID();
|
|
352
|
+
await upsertRuntimeInstance({ id: runtimeId, agentId: w.id, reportedSlots: 1 });
|
|
353
|
+
await mintRuntimeToken(w.id, runtimeId);
|
|
354
|
+
await upsertSwarmConfig({
|
|
355
|
+
scope: "agent",
|
|
356
|
+
scopeId: w.id,
|
|
357
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
358
|
+
value: "sk-ant-oat01-key-a-11111",
|
|
359
|
+
exportToEnv: true,
|
|
360
|
+
});
|
|
361
|
+
const repo = await createSwarmRepo({
|
|
362
|
+
url: "https://github.com/acme/widgets",
|
|
363
|
+
name: "widgets",
|
|
364
|
+
});
|
|
365
|
+
// A non-lead runtime token does not read secret repo rows, so this worker's
|
|
366
|
+
// env keeps the agent's 11111 key.
|
|
367
|
+
await upsertSwarmConfig({
|
|
368
|
+
scope: "repo",
|
|
369
|
+
scopeId: repo.id,
|
|
370
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
371
|
+
value: "sk-ant-oat01-key-b-22222",
|
|
372
|
+
isSecret: true,
|
|
373
|
+
exportToEnv: true,
|
|
374
|
+
});
|
|
375
|
+
const task = await createTaskExtended("pool work", {
|
|
376
|
+
profile: "claude-secret-repo-key",
|
|
377
|
+
vcsRepo: "acme/widgets",
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
expect(await routePoolTasks()).toEqual([]);
|
|
381
|
+
expect(await callPoll(w.id, runtimeId)).toBeNull();
|
|
382
|
+
expect((await getTaskById(task.id))?.status).toBe("unassigned");
|
|
383
|
+
|
|
384
|
+
// Control: the same key as a plain repo row reaches the runtime, and routes.
|
|
385
|
+
await upsertSwarmConfig({
|
|
386
|
+
scope: "repo",
|
|
387
|
+
scopeId: repo.id,
|
|
388
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
389
|
+
value: "sk-ant-oat01-key-b-22222",
|
|
390
|
+
isSecret: false,
|
|
391
|
+
exportToEnv: true,
|
|
392
|
+
});
|
|
393
|
+
expect(await routePoolTasks()).toEqual([{ taskId: task.id, agentId: w.id }]);
|
|
394
|
+
const trigger = await callPoll(w.id, runtimeId);
|
|
395
|
+
expect(trigger?.taskId).toBe(task.id);
|
|
396
|
+
expect(trigger?.task.resolvedProfile).toBe("claude-secret-repo-key");
|
|
397
|
+
} finally {
|
|
398
|
+
await getDbClient().run("DELETE FROM runtime_instances");
|
|
399
|
+
for (const [key, value] of Object.entries(saved)) {
|
|
400
|
+
if (value === undefined) delete process.env[key];
|
|
401
|
+
else process.env[key] = value;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
describe("pool routing by runtime authentication", () => {
|
|
407
|
+
let saved: Record<string, string | undefined>;
|
|
408
|
+
beforeEach(() => {
|
|
409
|
+
saved = {
|
|
410
|
+
RUNTIME_POOLS_ENABLED: process.env.RUNTIME_POOLS_ENABLED,
|
|
411
|
+
MULTI_RUNTIME_ENABLED: process.env.MULTI_RUNTIME_ENABLED,
|
|
412
|
+
};
|
|
413
|
+
process.env.RUNTIME_POOLS_ENABLED = "true";
|
|
414
|
+
process.env.MULTI_RUNTIME_ENABLED = "true";
|
|
415
|
+
});
|
|
416
|
+
afterEach(async () => {
|
|
417
|
+
await getDbClient().run("DELETE FROM runtime_instances");
|
|
418
|
+
await getDbClient().run("UPDATE agents SET runtime_pool_id = NULL");
|
|
419
|
+
await getDbClient().run("DELETE FROM runtime_pools");
|
|
420
|
+
await getDbClient().run("DELETE FROM runtime_controllers");
|
|
421
|
+
for (const [key, value] of Object.entries(saved)) {
|
|
422
|
+
if (value === undefined) delete process.env[key];
|
|
423
|
+
else process.env[key] = value;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// Agent key 11111, secret repo override 22222, and one profile per key.
|
|
428
|
+
async function keyedWorker(name: string) {
|
|
429
|
+
await createModelProfile({
|
|
430
|
+
name: `${name}-key-a`,
|
|
431
|
+
harness: "claude",
|
|
432
|
+
model: "opus",
|
|
433
|
+
credentials: { CLAUDE_CODE_OAUTH_TOKEN: ["11111"] },
|
|
434
|
+
});
|
|
435
|
+
await createModelProfile({
|
|
436
|
+
name: `${name}-key-b`,
|
|
437
|
+
harness: "claude",
|
|
438
|
+
model: "opus",
|
|
439
|
+
credentials: { CLAUDE_CODE_OAUTH_TOKEN: ["22222"] },
|
|
440
|
+
});
|
|
441
|
+
const w = await worker(name, "claude");
|
|
442
|
+
await upsertSwarmConfig({
|
|
443
|
+
scope: "agent",
|
|
444
|
+
scopeId: w.id,
|
|
445
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
446
|
+
value: "sk-ant-oat01-key-a-11111",
|
|
447
|
+
exportToEnv: true,
|
|
448
|
+
});
|
|
449
|
+
const repo = await createSwarmRepo({
|
|
450
|
+
url: "https://github.com/acme/widgets",
|
|
451
|
+
name: "widgets",
|
|
452
|
+
});
|
|
453
|
+
await upsertSwarmConfig({
|
|
454
|
+
scope: "repo",
|
|
455
|
+
scopeId: repo.id,
|
|
456
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
457
|
+
value: "sk-ant-oat01-key-b-22222",
|
|
458
|
+
isSecret: true,
|
|
459
|
+
exportToEnv: true,
|
|
460
|
+
});
|
|
461
|
+
return w;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
test("a shared-key runtime is judged on the secret repo rows it reads", async () => {
|
|
465
|
+
const w = await keyedWorker("p-route-shared");
|
|
466
|
+
const runtimeId = crypto.randomUUID();
|
|
467
|
+
await upsertRuntimeInstance({ id: runtimeId, agentId: w.id, reportedSlots: 1 });
|
|
468
|
+
|
|
469
|
+
// Its operator config read carries the secret repo key 22222, not 11111.
|
|
470
|
+
const keyA = await createTaskExtended("needs 11111", {
|
|
471
|
+
profile: "p-route-shared-key-a",
|
|
472
|
+
vcsRepo: "acme/widgets",
|
|
473
|
+
});
|
|
474
|
+
expect(await routePoolTasks()).toEqual([]);
|
|
475
|
+
expect((await getTaskById(keyA.id))?.status).toBe("unassigned");
|
|
476
|
+
|
|
477
|
+
const keyB = await createTaskExtended("needs 22222", {
|
|
478
|
+
profile: "p-route-shared-key-b",
|
|
479
|
+
vcsRepo: "acme/widgets",
|
|
480
|
+
});
|
|
481
|
+
expect(await routePoolTasks()).toEqual([{ taskId: keyB.id, agentId: w.id }]);
|
|
482
|
+
const trigger = await callPoll(w.id, runtimeId, "shared-key");
|
|
483
|
+
expect(trigger?.taskId).toBe(keyB.id);
|
|
484
|
+
expect(trigger?.task.resolvedProfile).toBe("p-route-shared-key-b");
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
test("an agent with token and shared-key runtimes routes only when both pass", async () => {
|
|
488
|
+
const w = await keyedWorker("p-route-mixed");
|
|
489
|
+
const tokenRuntime = crypto.randomUUID();
|
|
490
|
+
await upsertRuntimeInstance({ id: tokenRuntime, agentId: w.id, reportedSlots: 1 });
|
|
491
|
+
await mintRuntimeToken(w.id, tokenRuntime);
|
|
492
|
+
await upsertRuntimeInstance({ id: crypto.randomUUID(), agentId: w.id, reportedSlots: 1 });
|
|
493
|
+
|
|
494
|
+
// The token runtime gets 11111 and the shared-key runtime 22222: either may
|
|
495
|
+
// start the task, so neither single-key profile routes.
|
|
496
|
+
const keyA = await createTaskExtended("needs 11111", {
|
|
497
|
+
profile: "p-route-mixed-key-a",
|
|
498
|
+
vcsRepo: "acme/widgets",
|
|
499
|
+
});
|
|
500
|
+
const keyB = await createTaskExtended("needs 22222", {
|
|
501
|
+
profile: "p-route-mixed-key-b",
|
|
502
|
+
vcsRepo: "acme/widgets",
|
|
503
|
+
});
|
|
504
|
+
expect(await routePoolTasks()).toEqual([]);
|
|
505
|
+
|
|
506
|
+
// Control: once the token runtime also sees 22222, the 22222 task routes.
|
|
507
|
+
const repoId = (await getDbClient().get<{ id: string }>("SELECT id FROM swarm_repos"))!.id;
|
|
508
|
+
await upsertSwarmConfig({
|
|
509
|
+
scope: "repo",
|
|
510
|
+
scopeId: repoId,
|
|
511
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
512
|
+
value: "sk-ant-oat01-key-b-22222",
|
|
513
|
+
isSecret: false,
|
|
514
|
+
exportToEnv: true,
|
|
515
|
+
});
|
|
516
|
+
expect(await routePoolTasks()).toEqual([{ taskId: keyB.id, agentId: w.id }]);
|
|
517
|
+
expect((await getTaskById(keyA.id))?.status).toBe("unassigned");
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
test("a wake past the grace still judges the agent's live shared-key runtime", async () => {
|
|
521
|
+
const w = await keyedWorker("p-route-wake");
|
|
522
|
+
const controller = await createRuntimeController({ name: "p-wake-docker", kind: "docker" });
|
|
523
|
+
const pool = await createRuntimePool({
|
|
524
|
+
name: "p-wake-coders",
|
|
525
|
+
kind: "docker",
|
|
526
|
+
placements: [controller.id],
|
|
527
|
+
image: "test-worker",
|
|
528
|
+
});
|
|
529
|
+
await bindAgentToPool(w.id, pool.id);
|
|
530
|
+
await upsertRuntimeInstance({ id: crypto.randomUUID(), agentId: w.id, reportedSlots: 1 });
|
|
531
|
+
|
|
532
|
+
// The live runtime reads 22222 and would poll the woken task before any
|
|
533
|
+
// new runtime starts, so the 11111 task waits, before and after the grace.
|
|
534
|
+
const task = await createTaskExtended("needs 11111", {
|
|
535
|
+
profile: "p-route-wake-key-a",
|
|
536
|
+
vcsRepo: "acme/widgets",
|
|
537
|
+
});
|
|
538
|
+
const afterGrace = new Date(Date.parse(task.createdAt) + 16000);
|
|
539
|
+
expect(await routePoolTasks({ now: new Date(task.createdAt) })).toEqual([]);
|
|
540
|
+
expect(await routePoolTasks({ now: afterGrace })).toEqual([]);
|
|
541
|
+
expect((await getTaskById(task.id))?.status).toBe("unassigned");
|
|
542
|
+
|
|
543
|
+
// Control: a fully cold wake is judged as the minted token, which reads 11111.
|
|
544
|
+
await getDbClient().run("DELETE FROM runtime_instances");
|
|
545
|
+
expect(await routePoolTasks({ now: afterGrace })).toEqual([
|
|
546
|
+
{ taskId: task.id, agentId: w.id },
|
|
547
|
+
]);
|
|
548
|
+
expect((await getTaskById(task.id))?.poolWakeAt).toBe(afterGrace.toISOString());
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
test("a draining token runtime is still judged, since MCP poll-task can start work on it", async () => {
|
|
552
|
+
const w = await keyedWorker("p-route-drain");
|
|
553
|
+
await upsertRuntimeInstance({ id: crypto.randomUUID(), agentId: w.id, reportedSlots: 1 });
|
|
554
|
+
const draining = crypto.randomUUID();
|
|
555
|
+
await upsertRuntimeInstance({ id: draining, agentId: w.id, reportedSlots: 1 });
|
|
556
|
+
await mintRuntimeToken(w.id, draining);
|
|
557
|
+
await getDbClient().run("UPDATE runtime_instances SET draining = 1 WHERE id = ?", [draining]);
|
|
558
|
+
|
|
559
|
+
// The shared-key sibling reads 22222, the draining token runtime 11111.
|
|
560
|
+
const task = await createTaskExtended("needs 22222", {
|
|
561
|
+
profile: "p-route-drain-key-b",
|
|
562
|
+
vcsRepo: "acme/widgets",
|
|
563
|
+
});
|
|
564
|
+
await routePoolTasks();
|
|
565
|
+
const result = await pollTaskAs(w.id, draining, async () => {
|
|
566
|
+
// Retire the runtime so the long poll ends on its next pass.
|
|
567
|
+
await getDbClient().run("DELETE FROM runtime_instances WHERE id = ?", [draining]);
|
|
568
|
+
});
|
|
569
|
+
expect(result.structuredContent?.task?.id ?? null).toBeNull();
|
|
570
|
+
expect((await getTaskById(task.id))?.status).toBe("unassigned");
|
|
571
|
+
|
|
572
|
+
// Control: once the token view also reads 22222, the task routes.
|
|
573
|
+
const repoId = (await getDbClient().get<{ id: string }>("SELECT id FROM swarm_repos"))!.id;
|
|
574
|
+
await upsertSwarmConfig({
|
|
575
|
+
scope: "repo",
|
|
576
|
+
scopeId: repoId,
|
|
577
|
+
key: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
578
|
+
value: "sk-ant-oat01-key-b-22222",
|
|
579
|
+
isSecret: false,
|
|
580
|
+
exportToEnv: true,
|
|
581
|
+
});
|
|
582
|
+
expect(await routePoolTasks()).toEqual([{ taskId: task.id, agentId: w.id }]);
|
|
583
|
+
});
|
|
584
|
+
});
|
|
173
585
|
});
|
|
174
586
|
|
|
175
587
|
describe("the agent's default profile", () => {
|