Skip to content

Handle missing task in comment workflow as no-op#118

Merged
neekolas merged 1 commit intoxmtplabs:mainfrom
xmtp-coder-agent:fix/issue-116
Apr 21, 2026
Merged

Handle missing task in comment workflow as no-op#118
neekolas merged 1 commit intoxmtplabs:mainfrom
xmtp-coder-agent:fix/issue-116

Conversation

@xmtp-coder-agent
Copy link
Copy Markdown
Collaborator

@xmtp-coder-agent xmtp-coder-agent commented Apr 21, 2026

Resolves #116

Summary

When a comment is posted on an issue or PR with no associated Coder task, runComment previously threw NonRetryableError from the locate-task step. That transitioned the workflow instance to errored state — visible in wrangler workflows instances list and Workers Logs as a failure — even though the situation is benign (e.g. a comment on an issue that was never assigned to the agent).

Changes

  • src/workflows/steps/comment.ts: locate-task returns null when findTaskByName returns null. runComment checks for this and returns early, silently matching the existing "PR comment with no linked issue" short-circuit. The same pattern is already used in src/workflows/steps/failed-check.ts.
  • Malformed SDK shapes (present task but missing id/owner_id scalars) still throw NonRetryableError — that failure mode is distinct and should remain loud.
  • src/workflows/steps/comment.test.ts: replaced the "throws NonRetryableError when task not found (PR path)" test with two tests covering silent short-circuit on both PR and issue paths.

Test plan

  • npm run check passes locally (typecheck + lint + format + 374 vitest tests).
  • New tests assert step.calls ends at locate-task with no reaction, no send-task-input, and no thrown error.
  • Regression coverage for the happy path and the malformed-SDK path is unchanged.

🤖 Generated with Claude Code

Note

Handle missing task in comment workflow as a silent no-op instead of throwing

When runComment cannot find a task for an issue or PR, the locate-task step now returns null and the workflow exits early instead of throwing a NonRetryableError. No task input is sent and no GitHub reactions are added.

  • Behavioral Change: previously a missing task caused a NonRetryableError; it now silently short-circuits with no error and no side effects.

Macroscope summarized 50c156e.

When a comment is posted on an issue or PR with no associated Coder
task, runComment previously threw NonRetryableError from locate-task.
That surfaces the workflow instance as `errored` in listings even
though the situation is benign (e.g. a comment on an issue that was
never assigned to the agent).

Return null from the locate-task step when findTaskByName returns
null and short-circuit runComment, matching failed-check.ts's
behavior for the same case. Malformed SDK shapes still throw
NonRetryableError — that failure mode is distinct and should remain
loud.

Fixes xmtplabs#116

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@neekolas neekolas marked this pull request as ready for review April 21, 2026 13:26
@neekolas neekolas merged commit bfbc9db into xmtplabs:main Apr 21, 2026
3 checks passed
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.

Unknown task should not error workflow

2 participants