Skip to content

perf(chat): cache revisions for immutable conversation turns - #788

Merged
devswha merged 3 commits into
devswha:mainfrom
kilhyeonjun:feat/immutable-turn-revision-20261011
Oct 11, 2026
Merged

devswha merged 3 commits into
devswha:mainfrom
kilhyeonjun:feat/immutable-turn-revision-20261011

Conversation

@kilhyeonjun

Copy link
Copy Markdown
Contributor

Change

Unrelated chat renders no longer rescan an unchanged immutable conversation turn to build its render-boundary revision. An explicit immutable opt-in caches revisions in a WeakMap; the default remains mutation-sensitive, including same-length edits. Only ChatView's API snapshot turns opt in. New snapshots retain new revisions and the existing boundary behavior.

This is a standalone client optimization from main. It does not change API polling, ETag responses, turn sharing or pane state. Includes mutation/read-count regression tests and the immutability contract in source documentation.

Validation

  • Generated schema freshness, full typecheck and production build: pass.
  • Full unit suite: 2,506 pass, 50 skip, 0 fail (148.12s), including default mutable updates and repeated immutable reads.
  • Complete official browser lane: pass (481.6s).
  • Independent implementation review: GO, immutable snapshot premise checked against current API/ChatView code.

The Native integration suite was also run, not marked green: cache 397 pass/5 fail/6 skip (295.2s), compression 398 pass/4 fail/6 skip (307.7s). An unchanged same-SHA baseline with the same Bun/herdr binary reproduced all those named failures: 396 pass/6 fail/6 skip (285.1s), in the same three unchanged server contract files. No new named failure in either candidate. Main has since merged the pending-input fixture polling fix (#756); this branch is independently based on 2f6bb46.

Workflow syntax skipped (actionlint unavailable); no workflow YAML changed. Fork CI requires maintainer approval.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ce35f87-abe0-418a-983a-a1134c4bb085

📥 Commits

Reviewing files that changed from the base of the PR and between d129037 and 1562323.


📒 Files selected for processing (5)
  • CHANGELOG.md
  • src/AGENTS.md
  • src/components/ChatView.tsx
  • src/lib/turnRevision.test.ts
  • src/lib/turnRevision.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 790c3a47-2473-45df-b6e0-38c3882a1f63



📥 Commits

Reviewing files that changed from the base of the PR and between cb49d69 and d129037.




📒 Files selected for processing (5)
  • CHANGELOG.md
  • src/AGENTS.md
  • src/components/ChatView.tsx
  • src/lib/turnRevision.test.ts
  • src/lib/turnRevision.ts



Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.





📝 Summary

Summary by CodeRabbit

  • Changed
    • Unchanged chat turns now reuse their existing revisions across renders, improving efficiency when displaying conversation history.
    • Changes to chat content are still detected, including edits that preserve the original text length.
📝 Summary
📝 Summary

Walkthrough

turnRevision now supports optional revision caching for immutable turns. ChatView uses that mode for transcript reset keys. Tests cover repeated reads of immutable turns and mutation detection in ordinary calls.

Changes

Turn Revision Caching

Layer / File(s) Summary
Revision caching and validation
src/lib/turnRevision.ts, src/lib/turnRevision.test.ts
turnRevision accepts an optional immutable flag and caches revisions by turn object when enabled. Tests verify cached reads and mutation detection when caching is disabled.
Transcript reset-key integration
src/components/ChatView.tsx, src/AGENTS.md, CHANGELOG.md
ChatView passes true to turnRevision for transcript reset keys. The guidance and changelog describe this behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: devswha





Merge Risk: ⚪ Minimal · up to d1290

No current ChatView update path was found to mutate cached turns, so this change has no identified merge-blocking risk.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: caching revisions for immutable conversation turns.
Description check Passed The description includes the required Change and Validation sections. It explains the behavior, scope, tests, browser results, known Native integration failures, and skipped workflow validation.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (2 skipped: 2 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.





✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR





  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devswha added a commit that referenced this pull request Oct 11, 2026
…791)

## Change

When an agent's structured conversation is not yet available, ChatView
used to await a terminal read even while its terminal-output disclosure
was folded. A stalled read held the serialized conversation reader and
delayed initial display and later structured answers.

Agent terminal fallback now reads independently, only while its
disclosure is open and the page is visible. Non-agent scrollback stays
inline. Conversation/terminal HTTP headers and JSON/error bodies share a
15-second deadline; a timed-out late answer cannot replace the
conversation ETag cache. Changing the agent in the same pane reinstalls
and immediately refreshes the reader.

This standalone change is separate from #650's Codex session identity
work and #783's Send now behavior. It adds ko/ja/zh timeout labels,
documentation/changelog and registered/typechecked browser coverage
without private APIs or deployment configuration.

## Validation

- Generated schema freshness, full typecheck and production build: pass.
- Full unit suite: 2,508 pass, 50 skip, 0 fail (138.02s). Header/body
stalls, ignored-abort late body and ETag identity/recovery covered.
- Actual ChatView browser: no hidden terminal read; an opened stalled
fallback cannot block structured refresh; late cleanup; same-pane
agent-kind change resumes reads; non-agent output remains inline.
- Complete official browser lane: pass (492.2s), including the new
regression.
- Independent implementation review: GO; agent-change polling finding
reproduced and fixed before re-review.
- Workflow syntax skipped (actionlint unavailable); no workflow YAML
changed. No separate Native integration pass is claimed:
unchanged-server baseline comparison is recorded in #787/#788. Fork CI
requires maintainer approval.

Synthetic [closed fallback
screenshot](https://github.com/kilhyeonjun/herdr-web-ui/blob/fix/chat-read-fallback-20261011/docs/screenshots/chat-fallback/terminal-fallback-closed.png).

## Review follow-up

Addressed both posted review findings: agent terminal fallback no longer
presents an empty-conversation prompt, and terminal-read failures use
`role="alert"`. The actual ChatView browser regression reproduced both
before the fixes and now verifies fallback/failure, the ordinary empty
structured-conversation prompt, non-agent inline output and stale
cleanup.

Frozen final commit `a1ff9a3`: generated freshness, typecheck, build and
full unit pass (2508 pass, 50 skip, zero failures; unit 138.33s). The
previously reported full browser lane ran on `22f707b`; the updated
focused actual-component browser regression passed for the two UI fixes,
with refreshed synthetic evidence. Changelog now links this PR and
credits its author. Validation remains against public baseline
`2f6bb46`; latest observed main `5eafefc` is separate, and full
Native/Windows/updated-main integration is not claimed.

---------

Co-authored-by: Hako <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: devswha <[email protected]>
The changelog entry moves under Unreleased: the branch was cut before
0.4.6 and 0.4.7 were released. Unreleased had two Fixed headings on main
since a clean auto-merge; they are one again here.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@devswha
devswha merged commit 1bb5e49 into devswha:main Oct 11, 2026
9 checks passed
devswha added a commit that referenced this pull request Oct 12, 2026
## Change

Release 0.4.8, from main at ca6db6e (20 PRs since v0.4.7: the 0.4.7
mobile walk-through fixes, two contributor PRs and the revived #793).

- `package.json` and `herdr-plugin.toml`: 0.4.8.
- CHANGELOG: `[Unreleased]` becomes `[0.4.8] - 2026-10-12`, with the
compare links. Twelve entries that had no PR link get theirs (#835 #837
#838 #840 #842 #843 #844+#848 #845 #847 #849 #851 #852). A Maintenance
line says the remote-PC runtime is now version 27.
- `release-summaries.json`: 0.4.8 in en/ko/ja/zh/tr (3 new, 6 improved,
8 fixed). The Turkish lines are not checked by a native speaker.
- `REMOTE_BUNDLE_VERSION` 26 -> 27: #836 adds the `pending-hold` server
feature and #787 serves precompressed assets, so `remote-v27` is
published before the app release.

Every PR merged since v0.4.7 is linked in the section: #787 #788 #793
#835 #836 #837 #838 #839 #840 #841 #842 #843 #844 #845 #846 #847 #848
#849 #851 #852.

## Validation

- `bun scripts/release-notes.ts 0.4.8` renders the summaries and the
full changelog (116 lines).
- `bun run check fast`: generated types, typecheck, build and 2800+ unit
tests pass.

## Release

After this merges and its CI on `main` passes: push `remote-v27`, wait
for its release, then run the Release workflow with `0.4.8`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <[email protected]>
Haeminway1 added a commit to Haeminway1/herdr-web-ui that referenced this pull request Oct 12, 2026
Conflicts: version 0.4.801; the classic tab strip and one-pane canvas kept beside
upstream devswha#835's pane actions in the touch tab menu; the open latest work prop kept
with devswha#788's immutable turn revisions. Upstream devswha#846 removed the header's plan button
and its dialog: they stay as the default, and its plan in the background-task chip
is Settings → Appearance → Plan in the message box, off (on under automation).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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