feat(loops): improve loop schedule display#3714
Conversation
Generated-By: PostHog Code Task-Id: 7fc28633-4525-4dd9-b8b4-217dab72b7d7
|
😎 Merged successfully - details. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/ui/src/features/loops/hooks/useLoopRuns.ts:48
**Latest Run Mislabels History**
When a task is retried or run again, `task.latest_run` can refer to a newer execution than this loop-history entry. A failure or cancellation of that newer execution is then copied onto the older entry, including the wrong completion time and error message; reconciliation must identify the task run that actually backs this loop run.
### Issue 2 of 2
packages/ui/src/features/loops/hooks/useLoopRuns.ts:55-63
**Rejected Fetch Preserves Stale Status**
When `getTask` persistently returns 404 or 403, such as after a backing task is deleted or becomes inaccessible, this branch silently drops the result. The loop run remains `in_progress` on every poll even when the task already failed or was cancelled, preserving the stale state this reconciliation is intended to correct.
Reviews (1): Last reviewed commit: "fix: improve loop run and schedule displ..." | Re-trigger Greptile |
Generated-By: PostHog Code Task-Id: 7fc28633-4525-4dd9-b8b4-217dab72b7d7
There was a problem hiding this comment.
Display-only formatting fix for loop schedule/model text (cron→readable time, resolved default model), backed by new unit tests; not risky territory. The unresolved Greptile findings concern useLoopRuns.ts, a file not touched by this diff — stale/inapplicable to the current change.
- Author wrote 0% of the modified lines and has 10 merged PRs in these paths (familiarity MODERATE).
- 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 76L, 5F substantive, 115L/7F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1c-medium (115L, 7F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 8e9165b · reviewed head fa2c736 |
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
Problem
Loop detail views showed raw schedule/model values, which made common scheduled loops harder to scan.
Changes
Screenshots: not included, display-only copy changes covered by tests.
How did you test this?
pnpm --filter @posthog/shared test -- time.test.tspnpm --filter @posthog/ui test -- loopDisplay.test.tspnpm --filter @posthog/shared typecheckpnpm --filter @posthog/ui typecheckpnpm typecheckfailed in existingapps/webmodule resolution/type errors for@posthog/agent/*and@posthog/host-trpc/*imports.Automatic notifications
Created with PostHog Code