Skip to content

fix(tasks): stale routed wake no longer throws Invalid job outcome - #2476

Merged
mattzcarey merged 1 commit into
cloudflare:mainfrom
mattzcarey:fix/issue-2467
Oct 4, 2026
Merged

mattzcarey merged 1 commit into
cloudflare:mainfrom
mattzcarey:fix/issue-2467

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Part of #2467 (ask 1, the Invalid job outcome throw). Does not address the version-swap re-push question or arming the no-progress budget at spawn.

  • When a routed Task wake's owner facet is missing from the root registry, routeLifecycleToTarget cleans the stale prefix and returns false. Tasks.onJob passed that straight to applyOutcome, which throws on every alarm.
  • onJob now maps a false routed reply to undefined, so the mirror job is deleted quietly.
if (winner.outcome === false) return undefined;
return winner.outcome as LifecycleJobOutcome;

Devin Review

@changeset-bot

changeset-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 05bcbc2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agents Patch
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +1016 to +1023
it("returns no outcome for a routed Task wake whose owner facet is gone", async () => {
const name = uniqueName();
const agent = await getAgentByName(env.TestSubAgentParent, name);

expect(await agent.driveStaleRoutedTaskWake("task_stale_direct")).toBe(
"undefined"
);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Regression test bypasses the alarm queue

The test calls tasks.onJob directly, without persisting a wake or driving an alarm. It cannot catch a failure when applyOutcome processes the result.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@agent-think

agent-think Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

✅ agents import sizes: no significant changes (2f3176b9 → 05bcbc26, workflow run)

@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2476

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2476

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2476

hono-agents

npm i https://pkg.pr.new/hono-agents@2476

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2476

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2476

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2476

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2476

commit: 05bcbc2

@mattzcarey
mattzcarey merged commit 9f92f6f into cloudflare:main Oct 4, 2026
17 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant