Skip to content

[copilot-finds] Bug: ActivityResponse missing instanceId on failure path #121

@github-actions

Description

@github-actions

Problem

In TaskHubGrpcWorker._executeActivityInternal(), when an activity throws an exception, the ActivityResponse sent back to the sidecar is missing the instanceId field. The success path correctly sets it (line 768), but the error path (lines 782-785) omits it.

File: packages/durabletask-js/src/worker/task-hub-grpc-worker.ts, line 782

// Success path (correct):
res = new pb.ActivityResponse();
res.setInstanceid(instanceId);  // ✅ Present

// Error path (before fix):
res = new pb.ActivityResponse();
// ❌ Missing: res.setInstanceid(instanceId);
res.setTaskid(req.getTaskid());
res.setCompletiontoken(completionToken);
res.setFailuredetails(failureDetails);

Root Cause

The error handling catch block constructs a new ActivityResponse but was not ported symmetrically with the success path. The instanceId field was simply omitted. The .NET SDK always sets InstanceId on the ActivityResponse regardless of success or failure.

Fix Available

Branch copilot-finds/bug/fix-activity-response-missing-instanceid contains the fix (one-line addition) and 3 new tests. A PR could not be created due to GitHub Actions token permissions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copilot-findsFindings from daily automated code review agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions