Skip to content

fix(tasks): refresh active cloud run on task open#3758

Merged
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/fix-cloud-run-reconciliation
Jul 23, 2026
Merged

fix(tasks): refresh active cloud run on task open#3758
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/fix-cloud-run-reconciliation

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Problem

After a failed cloud run resumes into a new run, a renderer reload can keep showing the cached failed parent. The task view then remains attached to stale run state until the desktop app is restarted.

Changes

Refresh the authoritative task detail whenever a task view mounts while retaining cached data for immediate rendering. The existing session reconciliation then switches its watcher when the latest run ID changes.

Generated-By: PostHog Code
Task-Id: 048d944e-5259-4824-8a45-87a9fa88c148
@trunk-io

trunk-io Bot commented Jul 23, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 2d0ccba.

@tatoalo tatoalo self-assigned this Jul 23, 2026
@tatoalo
tatoalo marked this pull request as ready for review July 23, 2026 14:18
Generated-By: PostHog Code
Task-Id: 048d944e-5259-4824-8a45-87a9fa88c148
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. packages/ui/src/features/task-detail/hooks/useTaskData.ts, line 26-27 (link)

    P1 Detail cache shadows live updates

    When a task's latest run changes after the mount-time detail request, the polled task list receives the new run but refreshedTask remains defined and permanently takes precedence. This leaves latest_run-dependent session and cloud state attached to the old run until the detail query is invalidated or the view remounts.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/ui/src/features/task-detail/hooks/useTaskData.ts
    Line: 26-27
    
    Comment:
    **Detail cache shadows live updates**
    
    When a task's latest run changes after the mount-time detail request, the polled task list receives the new run but `refreshedTask` remains defined and permanently takes precedence. This leaves `latest_run`-dependent session and cloud state attached to the old run until the detail query is invalidated or the view remounts.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/ui/src/features/task-detail/hooks/useTaskData.ts:26-27
**Detail cache shadows live updates**

When a task's latest run changes after the mount-time detail request, the polled task list receives the new run but `refreshedTask` remains defined and permanently takes precedence. This leaves `latest_run`-dependent session and cloud state attached to the old run until the detail query is invalidated or the view remounts.

Reviews (1): Last reviewed commit: "refactor(tasks): use authoritative task ..." | Re-trigger Greptile

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@tatoalo
tatoalo requested a review from a team July 23, 2026 15:20
@PostHog PostHog deleted a comment from stamphog Bot Jul 23, 2026
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@stamphog

stamphog Bot commented Jul 23, 2026

Copy link
Copy Markdown

Note

🤖 stamphog reviewed 2d0ccbad432e89807769e4084567f8e3ce32e057 — verdict: REFUSED

Greptile flagged a substantive, unaddressed P1 concern: the new hook fetches the task detail once on mount (no refetch interval), so once populated it permanently shadows the live-polled task list — meaning after the initial mount, later run-status changes (the exact scenario this PR is meant to fix) stop propagating to the view until it remounts. The diff shows no follow-up commit addressing this.

  • Author wrote 0% of the modified lines and has 7 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
  • Unresolved/unaddressed Greptile P1 comment on useTaskData.ts: detail-query data has no refetch interval and takes precedence over the polled task list indefinitely once fetched, so live run-status updates stop reaching the view after mount until it remounts or the query is otherwise invalidated.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 23L, 2F substantive, 80L/3F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1b-small (80L, 3F, single-area, fix)
stamphog 2.0.0b3 .stamphog/policy.yml @ dec9229 · reviewed head 2d0ccba

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 23, 2026
@tatoalo
tatoalo enabled auto-merge (squash) July 23, 2026 15:27
@trunk-io
trunk-io Bot merged commit 65d220d into main Jul 23, 2026
57 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/fix-cloud-run-reconciliation branch July 23, 2026 15:40
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.

2 participants