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:
callActivity — input ? JSON.stringify(input) → input !== undefined ? JSON.stringify(input)
callSubOrchestrator — same pattern
setComplete — if (result) → if (result !== undefined)
getActions (continue-as-new input) — this._newInput ? → this._newInput !== undefined ?
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.
Problem
Falsy JavaScript values (
0,"",false,null) are silently dropped when passed as:callActivity(activity, 0)callSubOrchestrator(orch, 0)return 0)continueAsNewinput and carryover event valuesThis happens because the serialization code uses truthy checks (
if (input)) instead of explicit undefined checks (if (input !== undefined)). For example, inruntime-orchestration-context.ts:Interestingly, other methods in the same file (
sendEvent,signalEntity,callEntity) already use the correct!== undefinedpattern, making this an inconsistency within the codebase.Root Cause
JavaScript truthy evaluation treats
0,"",false, andnullas falsy. The affected code paths useif (value)to check whether to serialize, which incorrectly skips these valid values.Fix Available
Branch
copilot-finds/bug/fix-falsy-input-serializationcontains the complete fix with 14 new unit tests.Changes in
runtime-orchestration-context.ts:callActivity—input ? JSON.stringify(input)→input !== undefined ? JSON.stringify(input)callSubOrchestrator— same patternsetComplete—if (result)→if (result !== undefined)getActions(continue-as-new input) —this._newInput ?→this._newInput !== undefined ?getActions(carryover events) —eventValue ?→eventValue !== undefined ?Tests added in
falsy-input-serialization.spec.ts:callActivitywith each falsy value (0, "", false, null)callSubOrchestratorwith each falsy valuecontinueAsNewwith zero inputAll 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.