-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(terminal): change algo to compute colors based on hash of execution id and pointer from bottom #2817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…execution id and pointer from bottom
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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')
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 1 comment
Summary
Type of Change
Testing
Tested manually
Checklist