elizaos--eliza
426e9eeabd
Voice Workbench / headless workbench (mocked backends) (push) Has been cancelled
Voice Workbench / real acoustic lane (nightly, provisioned only) (push) Has been cancelled
ci / test (push) Has been cancelled
ci / lint-and-format (push) Has been cancelled
ci / build (push) Has been cancelled
ci / dev-startup (push) Has been cancelled
gitleaks / gitleaks (push) Has been cancelled
Markdown Links / Relative Markdown Links (push) Has been cancelled
Quality (Extended) / Homepage Build (PR smoke) (push) Has been cancelled
Quality (Extended) / Comment-only diff guard (push) Has been cancelled
Quality (Extended) / Format + Type Safety Ratchet (push) Has been cancelled
Quality (Extended) / Develop Gate (secret scan + UI determinism) (push) Has been cancelled
Quality (Extended) / Develop Gate (lint) (push) Has been cancelled
Chat shell gestures / Chat shell gesture + parity e2e (push) Has been cancelled
Cloud Gateway Discord / Test (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx @biomejs/biome check packages/lifeops-bench/src, benchmark-lint) (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx vitest run --config packages/lifeops-bench/vitest.config.ts --root packages/lifeops-bench --passWithNoTests, benchmark-tests) (push) Has been cancelled
Build Agent Image / build-and-push (push) Has been cancelled
Dev Smoke / bun run dev onboarding chat (push) Has been cancelled
Dev Smoke / Vite HMR dependency-level smoke (push) Has been cancelled
Electrobun Submodule Guard / electrobun gitlink is fetchable (push) Has been cancelled
Publish @elizaos/example-code / check_npm (push) Has been cancelled
Publish @elizaos/example-code / publish_npm (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / verify_version (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / publish_npm (push) Has been cancelled
Sandbox Live Smoke / Sandbox live smoke (push) Has been cancelled
Snap Build & Test / Build Snap (amd64) (push) Has been cancelled
Snap Build & Test / Build Snap (arm64) (push) Has been cancelled
Test Packaging / elizaos CLI global-install smoke (node + bun) (push) Has been cancelled
Cloud Gateway Webhook / Test (push) Has been cancelled
Cloud Tests / lint-and-types (push) Has been cancelled
Cloud Tests / unit-tests (push) Has been cancelled
Cloud Tests / integration-tests (push) Has been cancelled
Cloud Tests / e2e-tests (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Apps Worker (Product 2) / Determine environment (push) Has been cancelled
Deploy Apps Worker (Product 2) / Deploy apps worker to apps-control host (${{ needs.determine-env.outputs.environment }}) (push) Has been cancelled
Deploy Eliza Provisioning Worker / Determine environment (push) Has been cancelled
Deploy Eliza Provisioning Worker / Deploy worker to Hetzner host (${{ needs.determine-env.outputs.environment }} @ ${{ needs.determine-env.outputs.deployment_sha }}) (push) Has been cancelled
Dev Smoke / Classify changed paths (push) Has been cancelled
supply-chain / sbom (push) Has been cancelled
supply-chain / vulnerability-scan (push) Has been cancelled
Build, Push & Deploy to Phala Cloud / build-and-push (push) Has been cancelled
Test Packaging / Validate Packaging Configs (push) Has been cancelled
Test Packaging / Build & Test PyPI Package (push) Has been cancelled
Test Packaging / PyPI on Python ${{ matrix.python }} (push) Has been cancelled
Test Packaging / Pack & Test JS Tarballs (push) Has been cancelled
UI Fixture E2E / ui-fixture-e2e (push) Has been cancelled
UI Fixture E2E / fixture-e2e (push) Has been cancelled
UI Story Gate / story-gate (push) Has been cancelled
vault-ci / test (macos-latest) (push) Has been cancelled
vault-ci / test (ubuntu-latest) (push) Has been cancelled
vault-ci / test (windows-latest) (push) Has been cancelled
vault-ci / app-core wiring tests (push) Has been cancelled
verify-patches / verify patches/CHECKSUMS.sha256 (push) Has been cancelled
Voice Benchmark Smoke / voice-emotion fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voiceagentbench fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench-quality unit smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench TypeScript unit (no audio) (push) Has been cancelled
Voice Benchmark Smoke / voice bench smoke summary (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/app-core test bun run --cwd packages/elizaos test bun run --cwd packages/cloud/shared test], app-and-cli) (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/scenario-runner test bun run --cwd packages/vault test bun run --cwd packages/security test bun run --cwd plugins/plugin-coding-tools test], framework-packages) (push) Has been cancelled
Windows CI / windows ([bun run --cwd plugins/plugin-elizacloud test bun run --cwd plugins/plugin-discord test bun run --cwd plugins/plugin-anthropic test bun run --cwd plugins/plugin-openai test bun run --cwd plugins/plugin-app-control test bun run --cwd plugins/pl… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run build --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/agent --concurrency=4 node packages/scripts/run-bash-linux-only.mjs scripts/verify-riscv64-buildpaths.sh node packages/scripts/run… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run typecheck --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/cloud-shared --concurrency=4 bun run --cwd packages/core test bun run --cwd packages/shared test], core-runtime, 75) (push) Has been cancelled
248 行
8.3 KiB
TypeScript
248 行
8.3 KiB
TypeScript
/**
|
|
* Drives every concrete scheduled-task primitive (goal, todo, message_triage, reminder,
|
|
* checkin, followup, recap, approval) through the real scheduled-task runner: fire,
|
|
* clock-advance with structural completion, and permanent-failure preserved as a domain
|
|
* artifact.
|
|
*/
|
|
import { describe, expect, it } from "vitest";
|
|
import type { LifeOpsScheduledPrimitive } from "./helpers/lifeops-scheduled-task-simulation.js";
|
|
import {
|
|
createLifeOpsScheduledTaskSimulationHarness,
|
|
SIMULATED_RENDERED_DISPATCH_MESSAGE,
|
|
} from "./helpers/lifeops-scheduled-task-simulation.js";
|
|
|
|
const PRIMITIVES: LifeOpsScheduledPrimitive[] = [
|
|
"goal",
|
|
"todo",
|
|
"message_triage",
|
|
"reminder",
|
|
"checkin",
|
|
"followup",
|
|
"recap",
|
|
"approval",
|
|
];
|
|
|
|
describe("LifeOps scheduled-task simulation harness", () => {
|
|
it("fires each concrete primitive through the real scheduled-task runner", async () => {
|
|
const h = createLifeOpsScheduledTaskSimulationHarness();
|
|
|
|
const tasks = [];
|
|
for (const primitive of PRIMITIVES) {
|
|
tasks.push(
|
|
await h.schedulePrimitive(primitive, {
|
|
output: {
|
|
destination: "channel",
|
|
target: `${primitive}:owner`,
|
|
persistAs: "task_metadata",
|
|
},
|
|
completionCheck:
|
|
primitive === "checkin" ? { kind: "user_acknowledged" } : undefined,
|
|
metadata:
|
|
primitive === "goal" ? { callerMetadata: "preserved" } : undefined,
|
|
}),
|
|
);
|
|
}
|
|
|
|
for (const task of tasks) {
|
|
const fired = await h.firePrimitive(task);
|
|
expect(fired.state.status).toBe("fired");
|
|
expect(fired.metadata?.lastDispatchResult).toMatchObject({ ok: true });
|
|
}
|
|
|
|
expect(h.dispatches).toHaveLength(PRIMITIVES.length);
|
|
expect(h.dispatches.map((entry) => entry.metadata?.primitive)).toEqual(
|
|
PRIMITIVES,
|
|
);
|
|
expect(h.dispatches.map((entry) => entry.channelKey)).toEqual(PRIMITIVES);
|
|
expect(h.dispatches[0]?.metadata).toMatchObject({
|
|
callerMetadata: "preserved",
|
|
primitive: "goal",
|
|
});
|
|
for (const entry of h.dispatches) {
|
|
expect(entry.result).toMatchObject({
|
|
ok: true,
|
|
messageId: `sim_${entry.taskId}`,
|
|
});
|
|
}
|
|
});
|
|
|
|
it("advances clock and completes fired tasks through structural checks", async () => {
|
|
const h = createLifeOpsScheduledTaskSimulationHarness();
|
|
const checkin = await h.schedulePrimitive("checkin", {
|
|
completionCheck: { kind: "user_acknowledged" },
|
|
});
|
|
await h.firePrimitive(checkin);
|
|
|
|
h.advanceMinutes(5);
|
|
const completed = await h.runner.evaluateCompletion(checkin.taskId, {
|
|
acknowledged: true,
|
|
});
|
|
|
|
expect(completed.state.status).toBe("completed");
|
|
expect(completed.state.completedAt).toBe(h.nowIso());
|
|
|
|
const log = await h.logStore.list({
|
|
agentId: "pa-simulation-agent",
|
|
taskId: checkin.taskId,
|
|
});
|
|
expect(log.map((row) => row.transition)).toEqual([
|
|
"scheduled",
|
|
"fire_attempt",
|
|
"fired",
|
|
"completed",
|
|
]);
|
|
});
|
|
|
|
it("fails the task on a permanent DispatchResult failure and preserves it as a domain artifact", async () => {
|
|
const h = createLifeOpsScheduledTaskSimulationHarness();
|
|
h.setDispatchResult({
|
|
ok: false,
|
|
reason: "auth_expired",
|
|
message: "owner grant expired",
|
|
userActionable: true,
|
|
});
|
|
|
|
const triage = await h.schedulePrimitive("message_triage", {
|
|
// Empty escalation ladder (priority low): the permanent failure is
|
|
// terminal on the first attempt. With rungs remaining the enforced
|
|
// dispatch policy ADVANCES the ladder instead (surface_degraded) —
|
|
// see plugin-scheduling's dispatch-policy-enforcement suite.
|
|
priority: "low",
|
|
output: {
|
|
destination: "channel",
|
|
target: "slack:owner",
|
|
persistAs: "task_metadata",
|
|
},
|
|
});
|
|
const fired = await h.firePrimitive(triage);
|
|
|
|
// #11041/#10993: a returned `{ ok: false }` with no retry step remaining
|
|
// is a permanent failure — the row must NOT be recorded as `fired`.
|
|
expect(fired.state.status).toBe("failed");
|
|
expect(fired.state.lastDecisionLog).toBe(
|
|
"dispatch_failed: auth_expired: owner grant expired",
|
|
);
|
|
expect(fired.metadata?.lastDispatchResult).toEqual({
|
|
ok: false,
|
|
reason: "auth_expired",
|
|
message: "owner grant expired",
|
|
userActionable: true,
|
|
});
|
|
expect(fired.metadata?.lastDispatchError).toEqual({
|
|
name: "DispatchResultError",
|
|
message: "auth_expired: owner grant expired",
|
|
});
|
|
expect(h.dispatches).toHaveLength(1);
|
|
expect(h.dispatches[0]?.result).toEqual(fired.metadata?.lastDispatchResult);
|
|
|
|
const log = await h.logStore.list({
|
|
agentId: "pa-simulation-agent",
|
|
taskId: triage.taskId,
|
|
});
|
|
// The claim-time "fired" transition stays in the trail; the appended
|
|
// "failed" entry records the dispatch outcome (matches runner.test.ts).
|
|
expect(log.map((row) => row.transition)).toEqual([
|
|
"scheduled",
|
|
"fire_attempt",
|
|
"fired",
|
|
"failed",
|
|
]);
|
|
});
|
|
|
|
it("reschedules the same step on a transient DispatchResult failure", async () => {
|
|
const h = createLifeOpsScheduledTaskSimulationHarness();
|
|
h.setDispatchResult({
|
|
ok: false,
|
|
reason: "rate_limited",
|
|
message: "429 from connector",
|
|
retryAfterMinutes: 7,
|
|
userActionable: false,
|
|
});
|
|
|
|
const triage = await h.schedulePrimitive("message_triage", {
|
|
output: {
|
|
destination: "channel",
|
|
target: "slack:owner",
|
|
persistAs: "task_metadata",
|
|
},
|
|
});
|
|
const retried = await h.firePrimitive(triage);
|
|
|
|
// #11041/#10993: `retryAfterMinutes > 0` is a transient failure — the row
|
|
// goes back to `scheduled` with `firedAt` pushed past the backoff, the
|
|
// escalation ladder is not advanced, and the enforced policy records a
|
|
// bounded retry continuation (attempt 1 of the per-step budget).
|
|
expect(retried.state.status).toBe("scheduled");
|
|
expect(retried.state.firedAt).toBe(
|
|
new Date(new Date(h.nowIso()).getTime() + 7 * 60_000).toISOString(),
|
|
);
|
|
expect(retried.state.lastDecisionLog).toBe(
|
|
"dispatch retry 1/3 in 7m (rate_limited)",
|
|
);
|
|
expect(retried.metadata?.lastDispatchResult).toMatchObject({
|
|
ok: false,
|
|
reason: "rate_limited",
|
|
retryAfterMinutes: 7,
|
|
});
|
|
expect(retried.metadata?.pendingDispatch).toEqual({
|
|
stepIndex: -1,
|
|
attempt: 1,
|
|
});
|
|
expect(h.dispatches).toHaveLength(1);
|
|
|
|
const log = await h.logStore.list({
|
|
agentId: "pa-simulation-agent",
|
|
taskId: triage.taskId,
|
|
});
|
|
expect(log.map((row) => row.transition)).toEqual([
|
|
"scheduled",
|
|
"fire_attempt",
|
|
"fired",
|
|
"dispatch_retried",
|
|
]);
|
|
});
|
|
|
|
it("drives the PA production dispatcher into a simulated real connector", async () => {
|
|
const h = createLifeOpsScheduledTaskSimulationHarness({
|
|
useProductionConnectorDispatcher: true,
|
|
});
|
|
const reminder = await h.schedulePrimitive("reminder", {
|
|
output: {
|
|
destination: "channel",
|
|
target: "discord:owner-room",
|
|
persistAs: "task_metadata",
|
|
},
|
|
});
|
|
|
|
const fired = await h.firePrimitive(reminder);
|
|
|
|
expect(fired.state.status).toBe("fired");
|
|
expect(fired.metadata?.lastDispatchResult).toMatchObject({
|
|
ok: true,
|
|
messageId: `sim_${reminder.taskId}`,
|
|
});
|
|
expect(h.connectorSends).toHaveLength(1);
|
|
// The connector receives the model-rendered message; the task's
|
|
// instruction-voice `promptInstructions` only ever reaches the model
|
|
// prompt, never the wire.
|
|
expect(h.connectorSends[0]?.payload).toMatchObject({
|
|
target: "owner-room",
|
|
message: SIMULATED_RENDERED_DISPATCH_MESSAGE,
|
|
metadata: {
|
|
taskId: reminder.taskId,
|
|
},
|
|
});
|
|
expect(h.modelPrompts).toHaveLength(1);
|
|
expect(h.modelPrompts[0]).toContain(reminder.promptInstructions);
|
|
// The runner records the connector's raw result enriched with the
|
|
// delivering channel + resolved target (#14885, fix #14724): the connector
|
|
// itself only sees `{ ok, messageId }`, so lastDispatchResult is that plus
|
|
// the routing fields the dispatcher stamps ("discord:owner-room" → owner-room).
|
|
expect(fired.metadata?.lastDispatchResult).toEqual({
|
|
...(h.connectorSends[0]?.result as object),
|
|
channelKey: "discord",
|
|
target: "owner-room",
|
|
});
|
|
});
|
|
});
|