Repository navigation
feat(webui): memory panel with recall hits and accepted memories - #679
Conversation
Server: persist each turn's context pack into run.metadata["context_pack"]
via a contributor-keyed stash on ctx.config (semantic_memory + kb),
copied into run metadata by RuntimeTurnFinalizer through the existing
finish chain. The shape matches what the developer console's
_context_summary_from_run already parses, so /console/context lights up
too. Recall hits become readable over GET /sessions/{id}/runs.
Frontend: new MemoryPanel component (recall-hits table with score +
similarity/overlap badge, accepted-memories list from the existing
GET /sessions/{id}/memory/reviews?status=accepted endpoint), fetched on
session select and after turn completion.
Docs: web-client-api-contract.md gains the four /memory/* endpoints and
the run metadata context_pack shape.
Tests: 80 focused python tests + 20 vitest (6 new MemoryPanel tests)
pass; full tests/coding_agent + developer_console suite 1654 passed.
📝 WalkthroughWalkthroughChangesMemory context flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant App
participant AgentClient
participant MemoryPanel
App->>AgentClient: load runs and accepted memory reviews
AgentClient-->>App: return runtime runs and memory review records
App->>MemoryPanel: render recall hits and accepted memories
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
coding-agent/webui/app/src/lib/types.ts (1)
181-191: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
ContextPackItemtype/rendering drops KB citation location fields (repo_path,line_start,line_end). The backendContextPackItemdataclass includes these optional fields and the KB plugin populates them for repo/test-failure references, but the frontend type doesn't model them and the panel never renders them — so recall hits for KB citations lose their file/line context in the UI.
coding-agent/webui/app/src/lib/types.ts#L181-L191: addrepo_path?: string | null,line_start?: number | null,line_end?: number | nulltoContextPackItemto match the backendto_dict()shape.coding-agent/webui/app/src/components/MemoryPanel.tsx#L52-L69: once typed, renderrepo_path/line_start-line_end(e.g. alongsidesource_kind) for KB-sourced hits.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@coding-agent/webui/app/src/lib/types.ts` around lines 181 - 191, Add optional repo_path, line_start, and line_end fields to the ContextPackItem interface in coding-agent/webui/app/src/lib/types.ts:181-191, matching the backend nullable types. Update the KB-hit rendering in coding-agent/webui/app/src/components/MemoryPanel.tsx:52-69 to display the repository path and line range alongside source_kind when citation fields are present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@coding-agent/webui/app/src/App.tsx`:
- Around line 140-156: Update refreshMemory to use a sequence counter, following
the existing loadSeqRef pattern used by newSession/loadSession. Increment and
capture the counter for each refresh, then require both the captured sequence
and activeSessionRef.current to match before applying success or error state,
preventing stale same-session responses from overwriting newer results.
---
Nitpick comments:
In `@coding-agent/webui/app/src/lib/types.ts`:
- Around line 181-191: Add optional repo_path, line_start, and line_end fields
to the ContextPackItem interface in
coding-agent/webui/app/src/lib/types.ts:181-191, matching the backend nullable
types. Update the KB-hit rendering in
coding-agent/webui/app/src/components/MemoryPanel.tsx:52-69 to display the
repository path and line range alongside source_kind when citation fields are
present.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 42d8fdb3-12bd-43b9-b692-0aa226fd79b9
📒 Files selected for processing (14)
coding-agent/docs/web-client-api-contract.mdcoding-agent/src/coding_agent/plugins/kb.pycoding-agent/src/coding_agent/plugins/semantic_memory.pycoding-agent/src/coding_agent/runs/lifecycle.pycoding-agent/src/coding_agent/runs/persistence.pycoding-agent/src/coding_agent/topics/context_pack.pycoding-agent/tests/coding_agent/plugins/test_kb_plugin.pycoding-agent/tests/coding_agent/plugins/test_semantic_memory.pycoding-agent/tests/coding_agent/test_run_lifecycle.pycoding-agent/webui/app/src/App.tsxcoding-agent/webui/app/src/components/MemoryPanel.test.tsxcoding-agent/webui/app/src/components/MemoryPanel.tsxcoding-agent/webui/app/src/lib/api.tscoding-agent/webui/app/src/lib/types.ts
改动
服务端:turn 的 context pack 经
ctx.config上的 contributor-keyed stash(semantic_memory + kb 两个插件各自写入,顺序无关)在 turn 完成时由RuntimeTurnFinalizer沿现有 finish 链写入run.metadata["context_pack"]。shape 与 developer console 的_context_summary_from_run已有解析逻辑完全一致,所以/console/context页面也同时点亮。recall 命中由此可通过GET /sessions/{id}/runs读取。前端:新增
MemoryPanel组件 —— recall 命中表(score + similarity/overlap 徽标)+ accepted memories 列表(复用已在线的GET /sessions/{id}/memory/reviews?status=accepted),session 选中时和 turn 完成后拉取。文档:
web-client-api-contract.md补上 4 个已存在的/memory/*端点和 run metadata 的 context_pack shape。测试
tests/coding_agent/+test_developer_console.py:1654 passedSummary by CodeRabbit
New Features
Documentation