Repository navigation
Refresh automation run history reliably - #31375
AmethystLiang wants to merge 2 commits into
Conversation
- Preserve loaded run pages and unrelated host caches on change events - Retain visible history during same-host refresh failures - Show recovery notices on run details and avoid retrying pruned runs
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
546e501f-6aaa-4072-9bc9-c9a266d54aa8
📒 Files selected for processing: 18
src/renderer/src/components/automations/AutomationRunDetailsPage.tsxsrc/renderer/src/components/automations/AutomationRunPageFrame.tsxsrc/renderer/src/components/automations/AutomationRunUnavailablePage.tsxsrc/renderer/src/components/automations/AutomationsPage.dashboard-refresh.test.tsxsrc/renderer/src/components/automations/AutomationsPage.run-history.test.tsxsrc/renderer/src/components/automations/AutomationsPage.run-visibility.test.tsxsrc/renderer/src/components/automations/AutomationsPageListPanel.tsxsrc/renderer/src/components/automations/AutomationsPageSurface.tsxsrc/renderer/src/components/automations/automation-host-cache-controller.test.tssrc/renderer/src/components/automations/automation-host-cache-controller.tssrc/renderer/src/components/automations/automation-run-actions.tssrc/renderer/src/components/automations/automations-page-test-harness.tsxsrc/renderer/src/components/automations/use-automation-host-catalog.tssrc/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsxsrc/renderer/src/components/automations/use-automations-page-refresh.tssrc/renderer/src/components/automations/use-automations-page-setup-state.tssrc/renderer/src/components/automations/use-selected-automation-run-history.test.tsxsrc/renderer/src/components/automations/use-selected-automation-run-history.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| const selectedRowRef = useRef(selectedRow) | ||
| selectedRowRef.current = selectedRow |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,215p' src/renderer/src/components/automations/use-automations-page-refresh.ts
rg -n 'check-react-doctor-changed|react-doctor/no-ref-current-in-render' .github config package.jsonRepository: stablyai/orca
Length of output: 8132
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- React Doctor gate/config ---'
sed -n '1,240p' config/scripts/check-react-doctor-changed.mjs
sed -n '365,410p' package.json
sed -n '315,345p' .github/workflows/pr.yml
printf '%s\n' '--- refreshRunHistory references ---'
rg -n -F --glob '*.{ts,tsx}' -e 'refreshRunHistory' -e 'useAutomationsPageRefresh' src/renderer/src
printf '%s\n' '--- relevant consumer excerpts ---'
rg -l -F --glob '*.{ts,tsx}' 'refreshRunHistory' src/renderer/src | while read -r f; do
echo "### $f"
sed -n '1,260p' "$f"
doneRepository: stablyai/orca
Length of output: 26506
Move the selectedRowRef update out of render.
The current assignment fails the repository’s blocking React Doctor check. Use useLayoutEffect, not useEffect, so the ref updates after commit and before passive effects or user events can invoke refreshRunHistory or the host invalidation callback.
🔧 Suggested fix
-import { useCallback, useEffect, useRef, useState } from 'react'
+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
@@
// Async completions and host events must use the current selection.
const selectedRowRef = useRef(selectedRow)
- selectedRowRef.current = selectedRow
+ useLayoutEffect(() => {
+ selectedRowRef.current = selectedRow
+ }, [selectedRow])🧰 Tools
🪛 GitHub Actions: PR 31375 | source 2339740cb15f517f2505bfaaed33122fd77702f0 | workflow 2339740cb15f517f2505bfaaed33122fd77702f0 | unit full / static analysis and typecheck
[error] 50-50: React Doctor: Ref was mutated during render (react-doctor/no-ref-current-in-render). Command 'node config/scripts/check-react-doctor-changed.mjs' failed with exit code 1.
|
Closing as superseded: selected-history refresh on host events, keeping last-known runs on a failed read, ordering of in-flight reads, and re-reading on reopen all landed in #31617 (use-selected-automation-run-history.ts). One small gap remains (an open run page whose run was pruned keeps showing a loading skeleton). It'll be fixed separately and narrowly from main. |
Problem
Automation run history could stay stale after a run, rerun, or host update. Refreshing the dashboard could also discard loaded run pages or refresh unrelated hosts.
Solution
Refresh only the selected automation's history when it changes, preserve valid history during temporary read failures, and show a recoverable unavailable state when a run has been removed. Manual refresh now reloads the selected history without disrupting dashboard state.
ELI5
Run history now updates like the rest of the automation page, without making unrelated computers or already-loaded dashboard pages start over.
What Changed
Why
Previously, several refresh paths updated the broader automation state but not the selected run history, leaving stale results visible. Targeted history refreshes keep the page current while avoiding unnecessary reads and preserving dashboard pagination.
Linked Issue
TODO: No linked issue.
Visual Proof
TODO: Attach before/after proof for this UI behavior change.
Testing
Added coverage for dashboard refresh isolation, run history after Run Now and rerun, missing or failed history reads, host-scoped refreshes, remote history, and stale response handling.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
No known issues in security, cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, backwards compatibility, or performance. Remote history refreshes are scoped to the selected host.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)