Bug Description
There are two separate bugs in packages/core/src/lib/runtime.ts affecting the runStep method:
Bug A — Syntax error: The runStep() method at lines 365-375 has two ): Promise<...> { return-type declarations, making the file invalid TypeScript.
Bug B — Swapped arguments: runStepWithRetry() at line 303 passes args.correlationId as the tenantId parameter and the retry attempt number as the correlationId parameter. Every step event (tool.called, llm.requested) emitted to the event pipeline has wrong tenant and correlation IDs, breaking tenant isolation.
Prerequisites
Steps to Reproduce
- Open
packages/core/src/lib/runtime.ts.
- Observe the
runStep method signature at lines 365-375 — it has two return declarations.
- Observe the call at line 303 in
runStepWithRetry:
const result = await this.runStep(
args.step,
args.state,
args.correlationId, // passed as tenantId
attempt, // passed as correlationId
);
- Compare with the method signature parameter order at lines 369-370:
tenantId: string, // 3rd param
correlationId: string, // 4th param
Expected Behavior
The method should have a single valid signature, and runStepWithRetry should pass args.tenantId as the 3rd argument and args.correlationId as the 4th argument. All step events should carry the correct tenant and correlation identifiers.
Actual Behavior
Bug A — Line 371 and 375 both have ): Promise<...> {:
// Line 371 — first return declaration
): Promise<StepResult> {
// Lines 373-374 — orphaned param declarations between two function headers
correlationId: string,
attempt: number,
// Line 375 — second return declaration
): Promise<Omit<StepResult, 'attempts' | 'retry'>> {
Bug B — Line 303 passes args.correlationId as the 3rd argument (tenantId) and attempt as the 4th (correlationId):
const result = await this.runStep(
args.step,
args.state,
args.correlationId, // ❌ should be args.tenantId
attempt, // ❌ should be args.correlationId
);
This causes every tool.called, llm.requested, step.retrying, and step.failed event to carry incorrect tenant and correlation data.
Diagnostic Information
Environment Details
Additional Context
The method also has duplicate parameter declarations at lines 372-375 that appear to be a failed attempt at method overloading. The fix requires: (1) removing lines 372-375 to leave a single clean signature, and (2) swapping the arguments at line 306-307 to pass args.tenantId and args.correlationId in the correct order.
Bug Description
There are two separate bugs in
packages/core/src/lib/runtime.tsaffecting therunStepmethod:Bug A — Syntax error: The
runStep()method at lines 365-375 has two): Promise<...> {return-type declarations, making the file invalid TypeScript.Bug B — Swapped arguments:
runStepWithRetry()at line 303 passesargs.correlationIdas thetenantIdparameter and the retryattemptnumber as thecorrelationIdparameter. Every step event (tool.called,llm.requested) emitted to the event pipeline has wrong tenant and correlation IDs, breaking tenant isolation.Prerequisites
mainbranch of PulseStack.Steps to Reproduce
packages/core/src/lib/runtime.ts.runStepmethod signature at lines 365-375 — it has two return declarations.runStepWithRetry:Expected Behavior
The method should have a single valid signature, and
runStepWithRetryshould passargs.tenantIdas the 3rd argument andargs.correlationIdas the 4th argument. All step events should carry the correct tenant and correlation identifiers.Actual Behavior
Bug A — Line 371 and 375 both have
): Promise<...> {:Bug B — Line 303 passes
args.correlationIdas the 3rd argument (tenantId) andattemptas the 4th (correlationId):This causes every
tool.called,llm.requested,step.retrying, andstep.failedevent to carry incorrect tenant and correlation data.Diagnostic Information
Environment Details
mainbranch, post-PR fix runtime tenant tracing events #34Additional Context
The method also has duplicate parameter declarations at lines 372-375 that appear to be a failed attempt at method overloading. The fix requires: (1) removing lines 372-375 to leave a single clean signature, and (2) swapping the arguments at line 306-307 to pass
args.tenantIdandargs.correlationIdin the correct order.