Skip to content

[copilot-finds] Bug: Falsy values (0, "", false, null) silently dropped when serializing inputs and results #127

@github-actions

Description

@github-actions

Problem

Falsy JavaScript values (0, "", false, null) are silently dropped when passed as:

  • Activity input via callActivity(activity, 0)
  • Sub-orchestration input via callSubOrchestrator(orch, 0)
  • Orchestration return values (e.g., return 0)
  • continueAsNew input and carryover event values

This happens because the serialization code uses truthy checks (if (input)) instead of explicit undefined checks (if (input !== undefined)). For example, in runtime-orchestration-context.ts:

// Before (broken): drops 0, "", false, null
const encodedInput = input ? JSON.stringify(input) : undefined;

// After (fixed): only skips undefined
const encodedInput = input !== undefined ? JSON.stringify(input) : undefined;

Interestingly, other methods in the same file (sendEvent, signalEntity, callEntity) already use the correct !== undefined pattern, making this an inconsistency within the codebase.

Root Cause

JavaScript truthy evaluation treats 0, "", false, and null as falsy. The affected code paths use if (value) to check whether to serialize, which incorrectly skips these valid values.

Fix Available

Branch copilot-finds/bug/fix-falsy-input-serialization contains the complete fix with 14 new unit tests.

Changes in runtime-orchestration-context.ts:

  1. callActivityinput ? JSON.stringify(input)input !== undefined ? JSON.stringify(input)
  2. callSubOrchestrator — same pattern
  3. setCompleteif (result)if (result !== undefined)
  4. getActions (continue-as-new input)this._newInput ?this._newInput !== undefined ?
  5. getActions (carryover events)eventValue ?eventValue !== undefined ?

Tests added in falsy-input-serialization.spec.ts:

  • 4 tests for callActivity with each falsy value (0, "", false, null)
  • 4 tests for callSubOrchestrator with each falsy value
  • 4 tests for orchestration completion results with each falsy value
  • 1 test for continueAsNew with zero input
  • 1 test confirming undefined inputs are still correctly treated as "no input"

All 730 existing unit tests continue to pass. A PR could not be created automatically due to GitHub Actions permissions — the fix branch is ready for manual PR creation.

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