fix(terminal): change algo to compute colors based on hash of execution id and pointer from bottom#2817
Merged
waleedlatif1 merged 1 commit intostagingfrom Jan 14, 2026
Merged
Conversation
…execution id and pointer from bottom
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryReplaced simple index-based color assignment with offset-tracking algorithm to preserve execution colors when old entries are trimmed from the terminal. Key Changes
How It WorksThe algorithm builds an array of execution IDs from oldest to newest, compares it with the previous state, and when old executions are trimmed, increments the color offset by the number of removed executions. This ensures that if execution A had color green, it keeps green even after older executions B and C are removed from the display. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Store as Terminal Store
participant Terminal as Terminal Component
participant ColorMap as executionColorMap (useMemo)
participant ColorState as colorStateRef
participant UI as Run ID Display
Store->>Terminal: allWorkflowEntries updates
Note over Terminal: Entries may be trimmed<br/>when limit exceeded
Terminal->>ColorMap: Trigger useMemo recalculation
ColorMap->>ColorMap: Build currentIds array<br/>(oldest to newest)
Note over ColorMap: Loop entries backward,<br/>collect unique execution IDs
ColorMap->>ColorState: Read previous state<br/>(prevIds, prevOffset)
alt Old executions trimmed
ColorMap->>ColorMap: Check if prevIds[0] != currentIds[0]
ColorMap->>ColorMap: Calculate trimmedCount = indexOf(currentOldest)
ColorMap->>ColorMap: Update newOffset = (prevOffset + trimmedCount) % 8
else No trimming
ColorMap->>ColorMap: Keep prevOffset unchanged
end
ColorMap->>ColorMap: Assign colors:<br/>RUN_ID_COLORS[(newOffset + i) % 8]
ColorMap->>ColorState: Save new state<br/>(currentIds, newOffset)
ColorMap->>Terminal: Return executionColorMap
Terminal->>UI: Render run IDs with colors
UI->>ColorMap: getRunIdColor(executionId, colorMap)
ColorMap->>UI: Return color string (e.g., '#4ADE80')
|
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx
Show resolved
Hide resolved
Collaborator
Author
|
@greptile |
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.
Summary
Type of Change
Testing
Tested manually
Checklist