Skip to content

fix(terminal): refine workflow summary layout#224

Open
omarluq wants to merge 3 commits into
mainfrom
fix/workflow-summary-footer
Open

fix(terminal): refine workflow summary layout#224
omarluq wants to merge 3 commits into
mainfrom
fix/workflow-summary-footer

Conversation

@omarluq

@omarluq omarluq commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep collapsed workflow summaries at their natural height, including while focused
  • reserve detail rows only when workflow details are expanded
  • use the shared pending-circle indicator for active workflows
  • update workflow summary and layout regression tests

Validation

  • mise exec -- go test ./...
  • mise exec -- task build
  • mise exec -- task ci

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds bulk workflow-agent task retrieval and exposes it through the workflow service. Introduces a terminal workflows panel with progress details, navigation, inline summary expansion, cancellation, refresh handling, slash-command access, and expanded test coverage.

Changes

Workflow data access

Layer / File(s) Summary
Bulk workflow task data access
internal/database/agent_task_repository.go, internal/database/workflow_repository.go, internal/database/workflow_repository_test.go, internal/workflow/service.go, internal/workflow/service_internal_test.go
Adds bulk agent-task lookup, workflow/task link pairing, the AgentTaskDetails service method, and repository/service failure and mapping tests.

Terminal workflow experience

Layer / File(s) Summary
Workflow panel flow
internal/terminal/app.go, internal/terminal/workflows.go, internal/terminal/commands.go, internal/terminal/input.go, internal/terminal/panel_actions.go, internal/terminal/autocomplete.go, internal/terminal/workflows_internal_test.go
Adds workflow panel state, /workflows entry, panel routing, run detail rendering, progress aggregation, task selection, cancellation, refresh behavior, and panel tests.
Agent summary workflow expansion
internal/terminal/agent_tasks.go, internal/terminal/agent_task_summary.go, internal/terminal/transcript_list_internal_test.go, internal/terminal/agent_tasks_behavior_internal_test.go, internal/terminal/workflow_summary_internal_test.go
Adds workflow tracking reconciliation, progress labels, expanded step rendering, selection and Escape handling, and updated summary behavior tests.
Workflow inspector test support
internal/terminal/workflow_test_helpers_internal_test.go
Extends terminal test doubles with workflow task detail, event, task, and cancellation operations.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TerminalApp
  participant WorkflowService
  participant WorkflowRepository
  User->>TerminalApp: Run /workflows
  TerminalApp->>WorkflowService: Load workflow runs
  WorkflowService->>WorkflowRepository: Load linked agent task details
  WorkflowRepository-->>WorkflowService: Return workflow/task details
  WorkflowService-->>TerminalApp: Return workflow data
  TerminalApp-->>User: Render workflow panel
  User->>TerminalApp: Select run or press Ctrl+C
  TerminalApp->>WorkflowService: Open detail or cancel workflow
Loading

Possibly related PRs

Poem

A rabbit hops through workflows bright,
With agent steps lined up just right.
Press Enter—details bloom,
Ctrl+C clears the room.
Tasks and progress dance in sight!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and clearly reflects the main focus on refining the terminal workflow summary layout.
Description check ✅ Passed The description matches the changeset, covering workflow summary layout, active workflow indicators, and regression tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/workflow-summary-footer

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.68421% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.72%. Comparing base (bc1c6d6) to head (9419263).

Files with missing lines Patch % Lines
internal/terminal/workflows.go 74.11% 27 Missing and 17 partials ⚠️
internal/terminal/agent_tasks.go 91.45% 8 Missing and 2 partials ⚠️
internal/database/workflow_repository.go 72.72% 5 Missing and 4 partials ⚠️
internal/database/agent_task_repository.go 60.00% 5 Missing and 3 partials ⚠️
internal/terminal/commands.go 0.00% 2 Missing and 1 partial ⚠️
internal/terminal/app.go 71.42% 1 Missing and 1 partial ⚠️
internal/terminal/input.go 60.00% 2 Missing ⚠️
internal/terminal/panel_actions.go 50.00% 1 Missing and 1 partial ⚠️
internal/workflow/service.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #224      +/-   ##
==========================================
- Coverage   84.83%   84.72%   -0.11%     
==========================================
  Files         313      314       +1     
  Lines       28745    29106     +361     
==========================================
+ Hits        24386    24661     +275     
- Misses       2995     3051      +56     
- Partials     1364     1394      +30     
Flag Coverage Δ
unittests 84.72% <78.68%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
internal/database/workflow_repository_test.go (1)

81-127: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer table-driven retrieval scenarios.

Represent the populated and empty-input cases as named test cases so future ordering, missing-link, and multi-step regressions can be added consistently.

As per coding guidelines, prefer table-driven tests for core behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/database/workflow_repository_test.go` around lines 81 - 127,
Refactor TestWorkflowRepositoryListAgentTaskDetails into named table-driven
cases covering the populated and nil-input scenarios. Move each case’s setup,
ListAgentTaskDetails invocation, and assertions into the table-driven test flow,
preserving current expectations and leaving room for future ordering,
missing-link, and multi-step cases.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/terminal/agent_task_summary.go`:
- Around line 38-56: Guard the confirm handling in the agentTaskSummaryFocused
flow so it does not select an active workflow when workflowSummaryRunID is
already set. Update the branch around selectedAgentTaskSummaryTaskID and the
activeWorkflows index check to require the collapsed state before assigning
workflowSummaryRunID, while preserving normal confirmation behavior when no
workflow is expanded.

In `@internal/terminal/workflow_test_helpers_internal_test.go`:
- Around line 62-65: Add a detailsErr error field to workflowInspectorStub and
update AgentTaskDetails to return stub.detailsErr instead of stub.agentTasksErr,
keeping AgentTasks controlled by its existing error field.

In `@internal/terminal/workflows.go`:
- Around line 55-66: Update refreshWorkflowsPanel’s detail-view branch around
openWorkflowDetail to capture the currently selected detail item before
refreshing and restore that selection after the new panel is created, mirroring
the list-view SelectedValue()/SetSelectedIndex preservation. Ensure the
restoration handles the item no longer existing by retaining the panel’s valid
default selection.

---

Nitpick comments:
In `@internal/database/workflow_repository_test.go`:
- Around line 81-127: Refactor TestWorkflowRepositoryListAgentTaskDetails into
named table-driven cases covering the populated and nil-input scenarios. Move
each case’s setup, ListAgentTaskDetails invocation, and assertions into the
table-driven test flow, preserving current expectations and leaving room for
future ordering, missing-link, and multi-step cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d5f8cd34-bb1e-4f6e-8920-444e9deb92b7

📥 Commits

Reviewing files that changed from the base of the PR and between 96eb840 and 4a99afa.

📒 Files selected for processing (19)
  • internal/database/agent_task_repository.go
  • internal/database/workflow_repository.go
  • internal/database/workflow_repository_test.go
  • internal/terminal/agent_task_summary.go
  • internal/terminal/agent_tasks.go
  • internal/terminal/agent_tasks_behavior_internal_test.go
  • internal/terminal/app.go
  • internal/terminal/autocomplete.go
  • internal/terminal/autocomplete_internal_test.go
  • internal/terminal/commands.go
  • internal/terminal/input.go
  • internal/terminal/panel_actions.go
  • internal/terminal/transcript_list_internal_test.go
  • internal/terminal/workflow_summary_internal_test.go
  • internal/terminal/workflow_test_helpers_internal_test.go
  • internal/terminal/workflows.go
  • internal/terminal/workflows_internal_test.go
  • internal/workflow/service.go
  • internal/workflow/service_internal_test.go

Comment thread internal/terminal/agent_task_summary.go
Comment thread internal/terminal/workflow_test_helpers_internal_test.go Outdated
Comment thread internal/terminal/workflows.go
@omarluq
omarluq force-pushed the fix/workflow-summary-footer branch from 4a99afa to 8205da4 Compare July 22, 2026 20:37
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 22, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant