fix: resolve runStep broken method signature and swapped arguments#58
Open
rishab11250 wants to merge 1 commit into
Open
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Overview
Fixes two bugs in
packages/core/src/lib/runtime.tsthat broke therunStepmethod signature and causedrunStepWithRetryto 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()passedargs.correlationIdas thetenantIdparameter and the retryattemptnumber as thecorrelationIdparameter. 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
runStepand collapsed to a single clean signature that properly includesattempt: numberas the 5th parameterrunStepWithRetrycall site to passargs.tenantId,args.correlationId, andattemptin the correct order matching the method signatureexecute()method that had incorrect indentation, a stale 4-paramrunStepcall, and was missing its closing}tenantIdto thestartSpancall in the retry loopruntime.test.ts: closed uncloseddescribe/itblocks, removed duplicate imports block that was injected mid-first-test, and added missingExecutionSnapshot/TraceSpan/PulseInfratype importsBreaking Changes
Testing Methodology
runtime.tsandruntime.test.tsproduces zero errorsconfig.ts([Bug]: WorkflowRuntime.execute() crashes at parse time due to duplicate const declarations #38) andcontracts/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 PRsPerformance & 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