Skip to content

feat(loops): improve loop schedule display#3714

Merged
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/loop-display-run-status
Jul 22, 2026
Merged

feat(loops): improve loop schedule display#3714
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/loop-display-run-status

Conversation

@MattPua

@MattPua MattPua commented Jul 22, 2026

Copy link
Copy Markdown
Member

Problem

Loop detail views showed raw schedule/model values, which made common scheduled loops harder to scan.

Changes

  • Format schedule triggers as readable times for common cron patterns.
  • Show resolved default loop models when no model is configured.
  • Add coverage for clock formatting and schedule display.

Screenshots: not included, display-only copy changes covered by tests.

How did you test this?

  • pnpm --filter @posthog/shared test -- time.test.ts
  • pnpm --filter @posthog/ui test -- loopDisplay.test.ts
  • pnpm --filter @posthog/shared typecheck
  • pnpm --filter @posthog/ui typecheck
  • Full pre-commit pnpm typecheck failed in existing apps/web module resolution/type errors for @posthog/agent/* and @posthog/host-trpc/* imports.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 7fc28633-4525-4dd9-b8b4-217dab72b7d7
@trunk-io

trunk-io Bot commented Jul 22, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit fa2c736.

@MattPua MattPua changed the title fix: improve loop run and schedule display feat(loops): improve loop run and schedule display Jul 22, 2026
@MattPua MattPua added the Stamphog This will request an autostamp by stamphog on small changes label Jul 22, 2026
@MattPua
MattPua marked this pull request as ready for review July 22, 2026 14:23
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix 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
Comment thread packages/ui/src/features/loops/hooks/useLoopRuns.ts Outdated
Comment thread packages/ui/src/features/loops/hooks/useLoopRuns.ts Outdated
@MattPua MattPua changed the title feat(loops): improve loop run and schedule display fix: improve loop schedule and model display Jul 22, 2026

@github-actions github-actions 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.

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

@posthog

posthog Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

👋 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.

@MattPua MattPua changed the title fix: improve loop schedule and model display feat(loops): improve loop schedule display Jul 22, 2026
@trunk-io
trunk-io Bot merged commit 1de5c15 into main Jul 22, 2026
32 of 34 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/loop-display-run-status branch July 22, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant