Skip to content

SEP-1670: Hide the log line-cap select when a finished task's logs are already within the smallest cap - #1314

Open
nachodd wants to merge 3 commits into
mainfrom
SEP-1670
Open

SEP-1670: Hide the log line-cap select when a finished task's logs are already within the smallest cap#1314
nachodd wants to merge 3 commits into
mainfrom
SEP-1670

Conversation

@nachodd

@nachodd nachodd commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

What changed

TaskLogViewer now drops the line-cap select from the log console toolbar once a finished task history's log stream has reached its terminal state and the received log is provably complete and short. At that size every option in LOG_TAIL_LINE_OPTIONS renders the same thing, so the control cannot change what the user sees.

  • Derive SMALLEST_LOG_TAIL_OPTION from LOG_TAIL_LINE_OPTIONS (smallest numeric value), so changing the options list moves the threshold with no other edit. Guarded against a list with no numeric entry, where Math.min() of an empty list would be Infinity.
  • Destructure streamStatus from the existing useTaskLogs call (it was already returned and discarded) and gate the decision on 'finished', so the control does not flicker while a finished history's lines are still arriving.
  • Add countLines / maxPaneLineCount helpers that walk textByStep across every step and both streams and return the largest pane, so the control does not flip as the user moves between step tabs or the stdout/stderr tabs.
  • Wrap the existing tooltip / FormControl / Select block in the new showLogTailSelect flag. Nothing else in the toolbar moved.

"Provably complete" means either the request carried no tail parameter (the All lines choice), or every pane's line count is strictly below the requested tail. A pane sitting exactly at the requested cap may have been trimmed server-side, so the select stays visible there. That ambiguity is resolved conservatively on purpose: the failure mode is a redundant control rather than a hidden one the user needed.

Acceptance criteria covered

  1. Select not rendered for a finished history whose largest pane is within the smallest option, once the stream is terminal.
  2. Provably complete = no tail param, or every pane strictly below the requested tail; exactly-at-cap keeps the select.
  3. Threshold derived from LOG_TAIL_LINE_OPTIONS, no second constant.
  4. Counts evaluated across every step and both streams, decision uses the largest pane, so step / stream tab switches do not toggle the control.
  5. RUNNING behaviour unchanged: visible but disabled with its existing tooltip.
  6. Hiding leaves sep.taskLogViewer.tail in local storage untouched.
  7. Requests are unchanged; the stream is still opened with the stored cap.
  8. Existing select coverage still passes; new cases cover hidden, exactly-at-cap, and running.

An aborted stream (sep-error) is deliberately not treated as proof of completeness, so the select stays visible there too.

Out of scope

No backend or API change. No change to the running-task behaviour, the option list, the default, the local-storage persistence, or any other toolbar control.

Test plan

  • pnpm --filter @sep/framework exec vitest run src/components/TaskLogViewer — 51 passed.
  • pnpm --filter @sep/framework type-check — clean.
  • oxlint / oxfmt --check — clean (one pre-existing warning in ExecutionEventsPanel.tsx, untouched here).

New cases: hidden below the smallest option, hidden for a short All lines log, visible at exactly the requested cap, visible when the largest pane exceeds the smallest option (largest-pane rule), visible after a stream error, visible-but-disabled while running.

Code was reviewed before opening this PR and the feedback is folded into the second commit.

nachodd added 2 commits August 7, 2026 20:24
…omplete

Once a finished task history's log stream reaches its terminal state, the
line-cap select is dropped from the toolbar when the received log is provably
complete and its largest pane holds no more lines than the smallest numeric
option in LOG_TAIL_LINE_OPTIONS. At that size every option renders the same
thing, so the control cannot change what the user sees.

"Provably complete" means the request carried no tail parameter, or every
pane's line count is strictly below the requested tail. A pane sitting exactly
at the cap may have been trimmed server-side, so the select stays visible.

The threshold is derived from LOG_TAIL_LINE_OPTIONS rather than a second
constant. Line counts are taken across every step and both streams and the
decision uses the largest pane, so the control does not flip as the user moves
between step or stream tabs. Gating on the terminal stream status avoids the
control flickering while lines are still arriving.

Running tasks are unchanged: the select stays visible but disabled with its
existing tooltip. The stored tail choice and the requests made are untouched.
Guard the derived threshold against an options list with no numeric entry,
where Math.min() would return Infinity and hide the select for every finished
task. Add coverage proving a short log that ends in a stream error keeps the
select, since an aborted stream never proves the log is complete.
Copilot AI lite review requested due to automatic review settings August 7, 2026 23:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the TaskLogViewer toolbar UX so the “line cap” select is hidden once a finished task’s streamed logs are terminal and provably complete and short enough that every cap option would render the same output.

Changes:

  • Derives SMALLEST_LOG_TAIL_OPTION from LOG_TAIL_LINE_OPTIONS and uses it as the hide threshold for finished, complete, short logs.
  • Adds helpers to compute the maximum line count across all steps and both stdout/stderr panes, preventing UI toggling when switching tabs.
  • Expands TaskLogViewer tests to cover hidden/visible edge-cases (below smallest, exactly-at-cap, running, stream error).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/packages/framework/src/components/TaskLogViewer/TaskLogViewer.tsx Adds logic to hide the line-cap select for finished, provably-complete logs within the smallest cap; computes max line count across panes.
frontend/packages/framework/src/components/TaskLogViewer/tests/TaskLogViewer.test.tsx Adds test coverage for the new hide/show behavior across key scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/packages/framework/src/components/TaskLogViewer/TaskLogViewer.tsx Outdated
…shold

Line counting saturates at one line over the smallest option, so a big
"All lines" log no longer pays a full O(total size) pass just to decide the
select stays visible. Any pane above the threshold keeps the select whatever
the requested cap was, so the exact count past that point is not needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants