fix(ui-next): sort Agent Name on the column that is actually indexed - #1516
Closed
manan164 wants to merge 1 commit into
Closed
fix(ui-next): sort Agent Name on the column that is actually indexed#1516manan164 wants to merge 1 commit into
manan164 wants to merge 1 commit into
Conversation
manan164
marked this pull request as draft
August 10, 2026 14:13
manan164
force-pushed
the
fix/agent-executions-sort-agent-name
branch
from
August 10, 2026 15:04
44e651f to
dea8db4
Compare
Clicking the Agent Name header on the agent executions page sent `sort=workflowName:ASC`, because handleSort renamed the column id `workflowType` to `workflowName` on the way out. The index query builders snake_case the sort field and match it against an allow-list of real columns. `workflow_name` is not one of them -- `workflow_type` is -- so getSort() matched nothing and returned "", emitting no ORDER BY at all. The query became a bare `SELECT json_data FROM workflow_index [WHERE ...] LIMIT ? OFFSET ?`, so row order was whatever the query plan happened to yield: table-scan order with no filters, index order once a status filter narrowed it. That is why the sort looked like it worked sometimes and not others, and why ASC and DESC could return identical rows. Nothing surfaced the mismatch, since an unrecognised sort field is dropped silently rather than rejected. Drop the rename and send the column id through unchanged. The same remap existed on the workflow executions and task search pages, which sort the same `workflow_type` column; all five call sites now share one helper so the mapping is stated once and covered by a test. Also pin the backend contract the UI violated. The sqlite and postgres query builder tests now assert that `workflowType:ASC` produces `ORDER BY workflow_type ASC`, and that an unindexed field such as `workflowName` produces no ORDER BY. Fixes #1514
manan164
force-pushed
the
fix/agent-executions-sort-agent-name
branch
from
August 10, 2026 15:33
dea8db4 to
ddf660a
Compare
Contributor
Author
|
Closing this since #1515 takes care of this. |
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.
Fixes #1514
handleSortwas renaming the column idworkflowTypetoworkflowNamebefore sending it.workflowNameisn't a real field on any backend — not in the sqlite/postgresVALID_FIELDS, not in the ES mappings — so the sort was dropped and rows came back in whatever order the query plan yielded. On Elasticsearch it's worse: the unmapped field is rejected outright and the search returns HTTP 500, so the page fails to load rather than mis-ordering. This PR deletes that rename; the column id now goes through unchanged. The same bad remap existed on the workflow executions and task search pages, so all five call sites now share one helper.Before — clicking the name column sends
workflowName:DESC→ 500, table emptyAfter — sends
workflowType:DESC→ 200, rows sortedSame URL, same filters, same server; only the
handleSortline differs. (Captured on the Workflow Executions page, which shares the identical remap — the environment had no agent executions to show.)Frontend-only, no backend behaviour change. Tests added at both layers (
buildSortParam, sqlite + postgres query builders), each confirmed failing before the fix.Not addressed here:
workflow_typeis non-unique and no tiebreaker is appended, so rows sharing an agent name can still shuffle across page boundaries under offset paging.