Skip to content

fix: resolve runStep broken method signature and swapped arguments#58

Open
rishab11250 wants to merge 1 commit into
NEXARA-oss:mainfrom
rishab11250:fix/issue-40-runstep-broken-signature-swapped-args
Open

fix: resolve runStep broken method signature and swapped arguments#58
rishab11250 wants to merge 1 commit into
NEXARA-oss:mainfrom
rishab11250:fix/issue-40-runstep-broken-signature-swapped-args

Conversation

@rishab11250
Copy link
Copy Markdown

Pull Request Overview

Fixes two bugs in packages/core/src/lib/runtime.ts that broke the runStep method signature and caused runStepWithRetry to pass swapped arguments, resulting in every step event carrying incorrect tenant and correlation IDs.

Bug A — Syntax error: The runStep() method had two conflicting return-type declarations (): Promise<StepResult> { and ): Promise<Omit<StepResult, 'attempts' | 'retry'>> {) with orphaned param declarations (correlationId, attempt) dangling between them, causing the file to be invalid TypeScript.

Bug B — Swapped arguments: runStepWithRetry() passed args.correlationId as the tenantId parameter and the retry attempt number as the correlationId parameter. This caused every step event (tool.called, llm.requested, step.retrying, step.failed) emitted to the event pipeline to carry wrong tenant and correlation identifiers, breaking tenant isolation.

Related Issues

Architecture and Implementation Details

  • Removed the duplicate return type declaration in runStep and collapsed to a single clean signature that properly includes attempt: number as the 5th parameter
  • Corrected the runStepWithRetry call site to pass args.tenantId, args.correlationId, and attempt in the correct order matching the method signature
  • Removed first-draft dead code inside the execute() method that had incorrect indentation, a stale 4-param runStep call, and was missing its closing }
  • Added missing tenantId to the startSpan call in the retry loop
  • Fixed runtime.test.ts: closed unclosed describe/it blocks, removed duplicate imports block that was injected mid-first-test, and added missing ExecutionSnapshot/TraceSpan/PulseInfra type imports

Breaking Changes

  • Yes (Describe below)
  • No

Testing Methodology

  1. Verified TypeScript compilation of runtime.ts and runtime.test.ts produces zero errors
  2. Pre-existing syntax errors in config.ts ([Bug]: WorkflowRuntime.execute() crashes at parse time due to duplicate const declarations #38) and contracts/index.ts ([Bug]: Duplicate kind field in traceSpanSchema silently drops memory and trigger span types #39) block the full test suite — these are unrelated issues introduced by prior PRs

Performance & Observability Impact

None. Fixes a data-corruption bug in the event pipeline — events now carry the correct tenantId and correlationId from the workflow definition rather than swapped/incorrect values.

Contributor Checklist

  • I have read and adhered to the PulseStack Contributing Guidelines.
  • I have successfully executed the local test suite without errors.
  • I have updated the corresponding documentation to reflect these changes.
  • I have added adequate test coverage for my implementation.
  • I have verified that my code aligns with the repository's formatting and linting standards.

- Removed duplicate return type declaration in runStep method (Bug A)
- Fixed runStepWithRetry passing args.correlationId as tenantId and
  attempt as correlationId (Bug B)
- Removed first-draft dead code left inside execute() callback
- Added missing tenantId to startSpan call in retry loop
- Fixed runtime.test.ts: closed unclosed describe/it blocks,
  removed duplicate imports, added missing type imports

Closes NEXARA-oss#40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: runStep() has broken method signature (syntax error) and runStepWithRetry passes swapped arguments

1 participant