You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the provider is git and we have file history, surface a markdown-aware diff in the review screen so reviewers can see what changed — not just that something closed. Most useful in two contexts:
"What changed since I last signed?" When a slot has signed_at: <ISO> + body_sha256, the artifact pane could offer a "show changes since I signed" toggle. We already have gitLogSinceTimestamp in packages/haiku/src/orchestrator/workflow/drift-sweep.ts:63 and git show <commit>:<path> for retrieving body-at-commit; the missing piece is the renderer.
Why this isn't trivial
Markdown is paragraph-flow, not line-flow. A naive line diff produces visual noise where prose got reflowed but didn't actually change meaning.
Three approach families:
diff (npm) → unified line diff inside <MarkdownViewer>. Smallest blast radius. Works fine for code blocks and structural edits; ugly for prose reflows.
markdown-diff (npm). Markdown-aware; outputs markdown-flavored unified diff. Lighter weight, last published Apr 2024.
Custom remark-based renderer. We already have remark + remark-gfm + remark-html in packages/haiku-ui/package.json. Could AST-diff with token-level granularity. Highest fidelity, most work.
Suggested scope (minimum viable)
Add diff package to packages/haiku-ui.
Build <UnifiedDiff body=\"...\" since=\"...\" /> component that renders a unified-diff block with +/- lines + minimal syntax highlighting.
In FeedbackItem.tsx expanded view, when:
the FB is closed
iterations[] has at least one entry with a commit SHA
the host runtime is git-mode (a new gitMode: boolean prop threaded from session data)
…surface a "Show changes" expander next to the iteration row. Click → fetch the diff via a new /api/diff/:commit/:path endpoint that shells git show <commit>:<path> against the previous parent and returns the raw bodies for the renderer to diff client-side.
Out of scope for v1
Side-by-side view (unified is enough for prose).
Multi-file diff per iteration (one commit = one rendered file path).
Image diff (fileSha256 outputs are already covered by the drift sweep; image diff is a separate UX surface).
References
packages/haiku/src/orchestrator/workflow/drift-sweep.ts:63 — gitLogSinceTimestamp exists for git enrichment.
packages/haiku/src/state-tools.ts:1036 — isGitRepo() is the runtime gate.
packages/haiku-api/src/schemas/feedback.ts:127 — iterations[] schema; commit: z.string().max(64).optional() is the field to consume.
packages/haiku-ui/src/organisms/FeedbackItem.tsx — the iteration commit pill is already rendered (truncated to 7 chars). Diff expander hooks here.
Tracking
Filed as a followup to the review-screen UX bundle that landed Task #94 (iterations chain rendering) and Task #95 (agent excerpts via inline_anchor).
Summary
When the provider is git and we have file history, surface a markdown-aware diff in the review screen so reviewers can see what changed — not just that something closed. Most useful in two contexts:
iterations[], expand the FeedbackItem to show a unified diff of the file the fix-hat touched. Connects directly to the iteration history we just shipped (feat(builder): add version-aware building with rollback guidance #95-adjacent — Task feat(planner): add relevance-ranked learning search #94 in the local tracker; FeedbackItem renders the chain but the commit pill is currently display-only).signed_at: <ISO>+body_sha256, the artifact pane could offer a "show changes since I signed" toggle. We already havegitLogSinceTimestampinpackages/haiku/src/orchestrator/workflow/drift-sweep.ts:63andgit show <commit>:<path>for retrieving body-at-commit; the missing piece is the renderer.Why this isn't trivial
Markdown is paragraph-flow, not line-flow. A naive line diff produces visual noise where prose got reflowed but didn't actually change meaning.
Three approach families:
diff(npm) → unified line diff inside<MarkdownViewer>. Smallest blast radius. Works fine for code blocks and structural edits; ugly for prose reflows.markdown-diff(npm). Markdown-aware; outputs markdown-flavored unified diff. Lighter weight, last published Apr 2024.remark+remark-gfm+remark-htmlinpackages/haiku-ui/package.json. Could AST-diff with token-level granularity. Highest fidelity, most work.Suggested scope (minimum viable)
Add
diffpackage topackages/haiku-ui.Build
<UnifiedDiff body=\"...\" since=\"...\" />component that renders a unified-diff block with+/-lines + minimal syntax highlighting.In
FeedbackItem.tsxexpanded view, when:iterations[]has at least one entry with acommitSHAgitMode: booleanprop threaded from session data)…surface a "Show changes" expander next to the iteration row. Click → fetch the diff via a new
/api/diff/:commit/:pathendpoint that shellsgit show <commit>:<path>against the previous parent and returns the raw bodies for the renderer to diff client-side.Out of scope for v1
fileSha256outputs are already covered by the drift sweep; image diff is a separate UX surface).References
packages/haiku/src/orchestrator/workflow/drift-sweep.ts:63—gitLogSinceTimestampexists for git enrichment.packages/haiku/src/state-tools.ts:1036—isGitRepo()is the runtime gate.packages/haiku-api/src/schemas/feedback.ts:127—iterations[]schema;commit: z.string().max(64).optional()is the field to consume.packages/haiku-ui/src/organisms/FeedbackItem.tsx— the iteration commit pill is already rendered (truncated to 7 chars). Diff expander hooks here.Tracking
Filed as a followup to the review-screen UX bundle that landed Task #94 (iterations chain rendering) and Task #95 (agent excerpts via
inline_anchor).