Handle missing task in comment workflow as no-op#118
Merged
neekolas merged 1 commit intoxmtplabs:mainfrom Apr 21, 2026
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #116
Summary
When a comment is posted on an issue or PR with no associated Coder task,
runCommentpreviously threwNonRetryableErrorfrom thelocate-taskstep. That transitioned the workflow instance toerroredstate — visible inwrangler workflows instances listand 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-taskreturnsnullwhenfindTaskByNamereturnsnull.runCommentchecks for this and returns early, silently matching the existing "PR comment with no linked issue" short-circuit. The same pattern is already used insrc/workflows/steps/failed-check.ts.id/owner_idscalars) still throwNonRetryableError— 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 checkpasses locally (typecheck + lint + format + 374 vitest tests).step.callsends atlocate-taskwith no reaction, nosend-task-input, and no thrown error.🤖 Generated with Claude Code
Note
Handle missing task in comment workflow as a silent no-op instead of throwing
When
runCommentcannot find a task for an issue or PR, thelocate-taskstep now returnsnulland the workflow exits early instead of throwing aNonRetryableError. No task input is sent and no GitHub reactions are added.NonRetryableError; it now silently short-circuits with no error and no side effects.Macroscope summarized 50c156e.