Skip to content

feat(inbox): render the signal report artefact log#2557

Open
oliverb123 wants to merge 2 commits into
mainfrom
sig/artefact-log-ui
Open

feat(inbox): render the signal report artefact log#2557
oliverb123 wants to merge 2 commits into
mainfrom
sig/artefact-log-ui

Conversation

@oliverb123

Copy link
Copy Markdown
Contributor

Problem

Signal reports now accumulate a richer set of artefacts on the backend — code references, diffs, pushed branches, task runs, and notes — alongside the existing judgments and findings. The inbox had no way to surface them, so all that work-log context was invisible to reviewers.

This is the PostHog Code side of the artefact-log feature. The backend half (new artefact types, the append-only log, the pushed_branch diff endpoint, and the task_run (product, type) model) lands in PostHog/posthog#61545.

Changes

Adds a chronological artefact log at the bottom of the report detail pane, rendering every artefact type with a tailored body rather than raw JSON:

  • Code references / line references — syntax-highlighted code blocks with the relevant span and note.
  • Code diffs — unified-diff rendering with add/remove coloring (DiffBlock).
  • Pushed branches — metadata always shown, with a collapsible "View diff" that fetches the branch-vs-base diff on demand from the new backend endpoint; missing/deleted branches surface a clean message instead of a raw error.
  • Task runs — loads the linked task and expands to its full conversation log via TaskLogsPanel. Badged from the artefact's (product, type): signals-pipeline runs show Research / Implementation; custom agents show their humanized product + type.
  • Notes / judgments / findings / reviewers — each rendered as a point-in-time entry with a relative timestamp.
  • A dev-only raw-JSON inspector on each row (hidden in release builds, same pattern as other dev-only controls).

Artefact content types are hand-written in shared/types.ts and normalized in posthogClient.ts (the task_run content carries product/type, matching the backend).

How did you test this?

  • pnpm typecheck — passes.
  • biome check — clean on all changed files.
  • Manual: rendered a report seeded with one of each artefact type against a local backend; verified the pushed_branch diff loads against a real pushed branch, the task_run entry expands to the conversation log, and the timeline orders correctly by timestamp.
  • No automated component tests were added for these renderers.

Automatic notifications

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

Created with PostHog Code

Render every signal-report artefact type in a chronological work-log at the
bottom of the report detail: syntax-highlighted code references and line
references, unified diffs for code_diff and pushed_branch (collapsible, fetched
on demand), an expandable task_run that loads the linked task and its full
conversation log, and notes. Each entry is framed as a point-in-time action
with a relative timestamp, plus a dev-only raw-JSON inspector.

task_run artefacts now carry a (product, type) pair (matching the backend
change in PostHog/posthog#61545) — signals-pipeline runs badge as Research /
Implementation, custom agents show their humanized product + type.

Generated-By: PostHog Code
Task-Id: 3afae508-37cd-4bd9-9624-cffcd7c1a486
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

React Doctor found 2 issues in 2 files · 2 warnings.

2 warnings

src/renderer/features/inbox/components/detail/ArtefactLogList.tsx

src/renderer/features/inbox/components/detail/ReportDetailPane.tsx

Reviewed by React Doctor for commit 2ad6d0e.

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. apps/code/src/renderer/features/inbox/components/detail/ArtefactTaskRun.tsx, line 814-819 (link)

    P2 Eager task fetches vs. lazy diff fetches

    ArtefactPushedBranch only fetches the diff when the user expands the row (enabled: expanded), but ArtefactTaskRun fires getTask immediately on mount regardless of whether the row is expanded. In a report with many task_run artefacts this generates N simultaneous API calls as soon as the detail pane opens. The task title displayed in the collapsed state is the only reason for eager loading, but content.task_id could be used as the fallback text (it already is, on line 851) until the user expands the row, which would allow lazy loading here too.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/code/src/renderer/features/inbox/components/detail/ArtefactTaskRun.tsx
    Line: 814-819
    
    Comment:
    **Eager task fetches vs. lazy diff fetches**
    
    `ArtefactPushedBranch` only fetches the diff when the user expands the row (`enabled: expanded`), but `ArtefactTaskRun` fires `getTask` immediately on mount regardless of whether the row is expanded. In a report with many `task_run` artefacts this generates N simultaneous API calls as soon as the detail pane opens. The task title displayed in the collapsed state is the only reason for eager loading, but `content.task_id` could be used as the fallback text (it already is, on line 851) until the user expands the row, which would allow lazy loading here too.
    
    How can I resolve this? If you propose a fix, please make it concise.
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
apps/code/src/renderer/features/inbox/components/detail/ArtefactTaskRun.tsx:814-819
**Eager task fetches vs. lazy diff fetches**

`ArtefactPushedBranch` only fetches the diff when the user expands the row (`enabled: expanded`), but `ArtefactTaskRun` fires `getTask` immediately on mount regardless of whether the row is expanded. In a report with many `task_run` artefacts this generates N simultaneous API calls as soon as the detail pane opens. The task title displayed in the collapsed state is the only reason for eager loading, but `content.task_id` could be used as the fallback text (it already is, on line 851) until the user expands the row, which would allow lazy loading here too.

### Issue 2 of 2
apps/code/src/renderer/features/inbox/components/detail/ArtefactTaskRun.tsx:37-38
`getTask` already returns `Task` internally (it does its own `as unknown as Task` cast). The additional cast here is redundant and suggests a type mismatch that isn't actually present. Removing the outer cast makes the intent clear.

```suggestion
    (client) => client.getTask(content.task_id),
```

Reviews (1): Last reviewed commit: "feat(inbox): render the signal report ar..." | Re-trigger Greptile

Comment on lines +37 to +38
async (client) =>
(await client.getTask(content.task_id)) as unknown as Task,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 getTask already returns Task internally (it does its own as unknown as Task cast). The additional cast here is redundant and suggests a type mismatch that isn't actually present. Removing the outer cast makes the intent clear.

Suggested change
async (client) =>
(await client.getTask(content.task_id)) as unknown as Task,
(client) => client.getTask(content.task_id),
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/inbox/components/detail/ArtefactTaskRun.tsx
Line: 37-38

Comment:
`getTask` already returns `Task` internally (it does its own `as unknown as Task` cast). The additional cast here is redundant and suggests a type mismatch that isn't actually present. Removing the outer cast makes the intent clear.

```suggestion
    (client) => client.getTask(content.task_id),
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

The backend now appends a new suggested_reviewers status artefact on each edit
(latest-wins) rather than mutating in place (PostHog/posthog#61545). The detail
pane already derives current reviewers as the latest row, so update the optimistic
mutation to append a synthetic latest row — mirroring the server — instead of
patching the existing one, keeping the prior row in the work log as history.

Generated-By: PostHog Code
Task-Id: 3afae508-37cd-4bd9-9624-cffcd7c1a486
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