acoustic-carpenter-78188
07/14/2026, 9:59 PMWatchActions under-reported a run's actions / children_phase_counts for large runs. The
initial snapshot paged with OFFSET, which ListActions silently ignored (every page
re-read the first page), and even once paging worked OFFSET is O(n²/page) — so a large
run's snapshot exceeded the console's stream timeout and truncated (e.g. an 8K run showed
~4.6K, a 32K run ~11K, wobbling between refreshes). A map task also bulk-creates thousands
of children with identical created_at, so paging over a non-unique order skipped rows.
Separately, the `ListRuns`/`ListActions` RPC needs to paginate a run's (possibly sorted)
action list without truncating.
What changes were proposed in this pull request?
1. WatchActions snapshot → ascending keyset, O(n).
• New ListResourceInput.KeysetAfterCreatedAt / `KeysetAfterName`; ListActions emits the
Postgres row-value keyset (created_at, name) > (?, ?), requiring the (created_at ASC, name ASC) sort. created_at primary keeps parents before children (insertAction
requires the parent present); name is the unique per-run tiebreaker giving a total
order, so tied created_at never skips a page boundary.
• New index idx_actions_run_created_name (project, domain, run_name, created_at, name)
makes each snapshot page an index range-scan.
• listAndSendAllActions walks the run in pages of 1000 via this keyset.
2. `ListRuns`/`ListActions` RPC → plain offset page token (matching the cloud service).
• The page token is the running offset (strconv.Itoa(offset+limit)), decoded back into
ListResourceInput.Offset via strconv.Atoi in NewListResourceInputFromProto. This
works with any client sortBy.
• Replaces an earlier composite keyset cursor that rejected client-sorted pagination past
page 1 (the console lists actions sorted, so it truncated to ~one page). The
composite-cursor machinery (actionCursor / EncodeActionCursor / decodeActionCursor)
is removed; CursorToken is retained as a reserved (currently unused) field.
The two pagination modes are mutually exclusive and validated (Offset rejects negatives;
KeysetAfter requires its name key and exact sort).
How was this patch tested?
Unit tests:
• TestListActions_KeysetPagination — snapshot keyset over tied `created_at`: full coverage
• total order + sort/mutual-exclusion validation.
• TestListActions_OffsetPagination — offset paging over 250 tied-created_at actions: full
non-overlapping coverage + negative-offset and offset/keyset mutual-exclusion rejection.
• TestListRuns — service round-trips plain integer offset tokens.
• TestListAndSendAllActionsUsesAscendingSort — snapshot emits (created_at ASC, name ASC).
Verified on flyte-development against a 32,001-action run:
• WatchActions snapshot (keyset): full 32,001 distinct actions (8K→~1.4s, 16K→~2.25s).
• ListActions no sort: 32,001 over 161 pages.
• ListActions sorted created_at DESC (previously errored on page 2): pages advance
200 → 400 → 600, no error.
Trade-off: deep offset paging on the RPC is O(n²) (same as cloud); the console loads pages
lazily and the DAG uses the O(n) keyset snapshot, so it isn't user-facing.
Labels
• fixed
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
• #7585 — the original WatchActions-snapshot PR; this PR supersedes its RPC composite cursor
with plain offset tokens while retaining the snapshot keyset fix.
https://claude.ai/code/session_01AjhEAjx4yGQY9MhpY5DEXd
flyteorg/flyteacoustic-carpenter-78188
07/15/2026, 3:43 AM