Skip to content

feat(tape): implement view manifest flow#1767

Merged
zerob13 merged 4 commits into
devfrom
codex/deepchat-tape-view-manifest-sdd
Jun 15, 2026
Merged

feat(tape): implement view manifest flow#1767
zerob13 merged 4 commits into
devfrom
codex/deepchat-tape-view-manifest-sdd

Conversation

@zerob13

@zerob13 zerob13 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add Tape SDD docs for ViewManifest shadow mode, replay slices, assembler, policy boundary, policy provenance, and policy selector
  • persist view/assembled Tape events through DeepChatTapeService and expose manifest diagnostics plus replay slice export APIs
  • route chat and resume context assembly through TapeViewAssembler and TapeViewPolicy while preserving legacy provider-message parity
  • extend TraceDialog with Request, View Manifest, Tape Entries, and Budget diagnostics

Verification

  • pnpm run format
  • pnpm run i18n
  • pnpm run lint
  • pnpm run typecheck:node
  • pnpm run typecheck:web
  • pnpm vitest run test/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.ts test/main/presenter/agentRuntimePresenter/tapeViewManifest.test.ts test/main/presenter/agentRuntimePresenter/tapeService.test.ts test/main/presenter/agentRuntimePresenter/tapeViewPolicy.test.ts test/main/presenter/agentRuntimePresenter/tapeViewAssembler.test.ts test/renderer/components/trace/TraceDialog.test.ts --reporter=dot
  • pnpm vitest run --reporter=dot
  • git diff --check

Summary by CodeRabbit

  • New Features
    • Added message diagnostics to the Trace dialog with a tabbed interface (Request, View, Entries, Budget), including view/manifest availability and expanded metadata.
    • Added message-level view manifest inspection and deterministic tape replay slice export for a given message request (optionally by request sequence).
  • Improvements
    • Expanded persisted context tracking to record which history items were included/excluded and why.
    • Added policy/version provenance so the Trace dialog can surface policy details when available.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd95743a-d3b2-4e68-bbc3-251412f17949

📥 Commits

Reviewing files that changed from the base of the PR and between bd14a7d and 99b45c1.

📒 Files selected for processing (7)
  • src/main/presenter/agentRuntimePresenter/tapeService.ts
  • src/main/presenter/agentRuntimePresenter/tapeViewManifest.ts
  • src/renderer/api/SessionClient.ts
  • src/shared/contracts/routes/sessions.routes.ts
  • test/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.ts
  • test/main/presenter/agentRuntimePresenter/tapeService.test.ts
  • test/main/presenter/agentRuntimePresenter/tapeViewManifest.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/main/presenter/agentRuntimePresenter/tapeViewManifest.test.ts
  • src/shared/contracts/routes/sessions.routes.ts
  • src/main/presenter/agentRuntimePresenter/tapeViewManifest.ts
  • src/main/presenter/agentRuntimePresenter/tapeService.ts

📝 Walkthrough

Walkthrough

Adds tape policy/view contracts, manifest persistence and replay export, presenter and route wiring, a tabbed trace diagnostics UI, localization updates, tests, and architecture documentation.

Changes

DeepChat Tape ViewManifest and Replay System

Layer / File(s) Summary
Shared tape contracts and type models
src/shared/types/tape-view-manifest.ts, src/shared/types/tape-replay.ts, src/shared/types/agent-interface.d.ts, src/shared/types/presenters/agent-session.presenter.d.ts, src/shared/contracts/routes.ts, src/shared/contracts/routes/sessions.routes.ts
Adds manifest and replay export type contracts, extends agent and session interfaces with manifest/replay methods, and updates route catalogs and IPC contracts.
Context metadata, policy resolution, and assembler
src/main/presenter/agentRuntimePresenter/contextBuilder.ts, src/main/presenter/agentRuntimePresenter/tapeViewPolicy.ts, src/main/presenter/agentRuntimePresenter/tapeViewAssembler.ts
Refactors context builders to return inclusion/exclusion metadata, introduces the legacy_context_v1 policy registry and resolver, and adds the assembler boundary that wraps policy outputs with provenance fields.
Manifest assembly, persistence, and replay export
src/main/presenter/agentRuntimePresenter/tapeViewManifest.ts, src/main/presenter/agentRuntimePresenter/tapeService.ts
Adds deterministic manifest hashing and ref builders, persists view/assembled manifests in tape storage, validates manifest payloads, and exports replay slices with trace and entry snapshots.
Runtime stream orchestration and manifest emission
src/main/presenter/agentRuntimePresenter/index.ts
Threads assembler and manifest helpers into chat/resume flows, tracks per-request sequence and context-pressure recovery state during streaming, appends manifests per provider request with task type and selection, and exposes runtime list/export APIs.
Session routes, presenter delegation, and renderer client
src/main/presenter/agentSessionPresenter/index.ts, src/main/routes/index.ts, src/renderer/api/SessionClient.ts
Propagates manifest diagnostics and replay export through session presenter delegation, main route handler dispatch, and renderer session client methods with IPC endpoints.
Trace dialog diagnostics UI and locales
src/renderer/src/components/trace/TraceDialog.vue, src/renderer/settings/components/ProviderConfigImportDialog.vue, src/renderer/src/components/mcp-config/AgentMcpSelector.vue, src/renderer/src/i18n/*/traceDialog.json
Refactors trace dialog into tabbed diagnostics (request/view/entries/budget) driven by merged trace and manifest sequences, applies two localized TypeScript fixes in Vue components, and adds diagnostic translation keys across all locales.
Test coverage and validation
test/main/presenter/agentRuntimePresenter/*, test/renderer/components/trace/TraceDialog.test.ts, test/main/presenter/presenterCallErrorHandler.test.ts
Adds and updates tests for context metadata, policy/assembler parity, manifest hashing and determinism, tape service persistence and replay export, runtime manifest sequencing, trace dialog diagnostics interaction, and event publishing setup.
Architecture documentation
docs/architecture/deepchat-tape-view-policy/*, docs/architecture/deepchat-tape-view-assembler/*, docs/architecture/deepchat-tape-policy-provenance/*, docs/architecture/deepchat-tape-view-manifest/*, docs/architecture/deepchat-tape-replay-contract/*, docs/architecture/deepchat-tape-policy-selector/*, docs/architecture/deepchat_tape_spec_v1.md, docs/issues/deepchat-tape-view-manifest-pr-review/*
Adds planning, spec, task documents, and baseline tape system documentation for policy selection, assembler boundary, manifest provenance, view manifest shadow mode, replay contract, and PR #1767 review follow-up.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • ThinkInAIXYZ/deepchat#1558: Both PRs modify src/main/presenter/agentRuntimePresenter/contextBuilder.ts in the context-building pipeline—main PR adds metadata-returning context builders, while the retrieved PR adds and threads preserveEmptyInterleavedReasoning through buildContext/buildResume and recordToChatMessages/buildHistoryTurns.
  • ThinkInAIXYZ/deepchat#1085: Both PRs modify the TraceDialog/traceDialog i18n UI around the same "trace" preview concept (main extends TraceDialog to show request/view manifest diagnostics and policy/version details, building on the earlier request-parameter TraceDialog foundations).
  • ThinkInAIXYZ/deepchat#1669: Main PR extends DeepChatTapeService with view-manifest source-maps and deterministic exportReplaySlice/appendViewManifest logic on top of the session tape memory foundation added by PR #1669.

Suggested labels

codex

🐇 Hop hop, the tape is bright,
With policies and manifests in sight.
Tabs now bloom and hashes gleam,
The rabbit grins at every stream. ✨📋

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/deepchat-tape-view-manifest-sdd

@zerob13 zerob13 requested a review from yyhhyyyyyy June 15, 2026 06:18

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/main/presenter/agentRuntimePresenter/index.ts (2)

3174-3221: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Refresh resume history after compaction before assembling the view.

resolveCompactionStateForResumeTurn can insert a compaction message and shift existing order sequences, but buildTapeResumeView still receives the pre-compaction tapeReady.historyRecords snapshot on Line 3211. Refresh the history after summary resolution so the resume context and manifest refs use current ordering.

Proposed direction
       const tapeReady = this.tapeService.ensureSessionTapeReady(sessionId, this.messageStore)
+      const initialResumeHistoryRecords = getTapeContextHistoryRecords(tapeReady.historyRecords)
       const resumeTargetOrderSeq =
         tapeReady.historyRecords.find((record) => record.id === messageId)?.orderSeq ??
         this.messageStore.getMessage(messageId)?.orderSeq
...
-            historyRecords: tapeReady.historyRecords,
+            historyRecords: initialResumeHistoryRecords,
             compactionMessageOrderSeq: resumeTargetOrderSeq,
             signal: preStreamAbortSignal
           })
         : this.sessionStore.getSummaryState(sessionId)
       this.throwIfAbortRequested(preStreamAbortSignal)
+      const resumeHistoryRecords = getTapeContextHistoryRecords(
+        this.tapeService.ensureSessionTapeReady(sessionId, this.messageStore).historyRecords
+      )
       const systemPrompt = appendReconstructionAnchorStateSection(
...
-        historyRecords: tapeReady.historyRecords,
+        historyRecords: resumeHistoryRecords,
         options: {
🤖 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 `@src/main/presenter/agentRuntimePresenter/index.ts` around lines 3174 - 3221,
After `resolveCompactionStateForResumeTurn` completes (which can insert
compaction messages and modify order sequences), the `tapeReady.historyRecords`
snapshot passed to `buildTapeResumeView` is stale. Before calling
`buildTapeResumeView`, refresh the history records from the tape service to
ensure the resume context uses the current ordering after compaction. Retrieve
the updated history records (using the appropriate method like
`this.tapeService.ensureSessionTapeReady`) and pass them to
`buildTapeResumeView` instead of the pre-compaction snapshot.

2472-2488: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Carry the context-pressure recovery cursor into the manifest.

recoverRequestContextPressure can create a new summary, but Line 2540 still records the pre-recovery viewContext.summaryCursorOrderSeq. Return the recovery summaryCursorOrderSeq and use it when appending the manifest so replay provenance matches the actual provider request.

Proposed direction
-            let recoveredFromContextPressure = false
+            let recoveredFromContextPressure = false
+            let manifestSummaryCursorOrderSeq = viewContext?.summaryCursorOrderSeq ?? 1
...
                 const recovered = await recoverContextPressure({
...
                 })
                 recoveredFromContextPressure = true
+                if (recovered.summaryCursorOrderSeq !== undefined) {
+                  manifestSummaryCursorOrderSeq = recovered.summaryCursorOrderSeq
+                }
...
-              summaryCursorOrderSeq: viewContext?.summaryCursorOrderSeq ?? 1,
+              summaryCursorOrderSeq: manifestSummaryCursorOrderSeq,

And have recoverRequestContextPressure return the cursor when it applies recovery:

-  }): Promise<{ messages: ChatMessage[]; systemPrompt?: string }> {
+  }): Promise<{ messages: ChatMessage[]; systemPrompt?: string; summaryCursorOrderSeq?: number }> {
...
     return {
       messages: fitRequestMessagesToContextWindow({
...
       }),
-      systemPrompt
+      systemPrompt,
+      summaryCursorOrderSeq: summaryState.summaryCursorOrderSeq
     }

Also applies to: 2540-2540

🤖 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 `@src/main/presenter/agentRuntimePresenter/index.ts` around lines 2472 - 2488,
The recoverContextPressure function creates a new summary during context
pressure recovery, but the recovery's resulting summaryCursorOrderSeq cursor is
not being captured and used when the manifest is appended. Modify
recoverContextPressure to return the summaryCursorOrderSeq value from the
recovery result, capture this returned cursor in the code block where
recoverContextPressure is called (lines 2472-2488), and then use this recovered
cursor value instead of the pre-recovery viewContext.summaryCursorOrderSeq when
recording the manifest to ensure replay provenance matches the actual provider
request.
src/renderer/src/components/trace/TraceDialog.vue (1)

331-359: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Request-sequence selection can display mismatched diagnostics.

When a selected requestSeq exists only in traces or only in manifests, current fallback logic shows the first record from the other list, which can present data from a different request.

Proposed fix
 const selectedTrace = computed(() => {
   if (!traceList.value.length) {
     return null
   }

   if (selectedRequestSeq.value !== null) {
-    const matched = traceList.value.find((item) => item.requestSeq === selectedRequestSeq.value)
-    if (matched) {
-      return matched
-    }
+    return traceList.value.find((item) => item.requestSeq === selectedRequestSeq.value) ?? null
   }

   return traceList.value[0] ?? null
 })

 const selectedManifest = computed(() => {
   if (!manifestList.value.length) {
     return null
   }

   if (selectedRequestSeq.value !== null) {
-    const matched = manifestList.value.find((item) => item.requestSeq === selectedRequestSeq.value)
-    if (matched) {
-      return matched
-    }
+    return manifestList.value.find((item) => item.requestSeq === selectedRequestSeq.value) ?? null
   }

   return manifestList.value[0] ?? null
 })
🤖 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 `@src/renderer/src/components/trace/TraceDialog.vue` around lines 331 - 359,
The selectedTrace and selectedManifest computed properties have a logic issue
where they fall back to returning the first item from their respective lists
even when a selectedRequestSeq is explicitly set but not found. This causes
mismatched data to be displayed. Modify both computed properties so that the
fallback to the first item (traceList.value[0] and manifestList.value[0]
respectively) only occurs when selectedRequestSeq.value is null or undefined.
When selectedRequestSeq.value is set but no matching item is found in the list,
return null instead of falling back to the first item, ensuring that traces and
manifests for the same request are always displayed together or neither is
displayed.
🧹 Nitpick comments (3)
docs/architecture/deepchat-tape-view-manifest/plan.md (1)

143-150: 💤 Low value

Minor: Rollout steps have repetitive sentence starts.

Lines 143, 145, 146, and 148 each begin with "Add", which creates a stylistic repetition. While this does not affect clarity, consider rewording to vary the sentence structure—e.g., "Extend trace-dialog tabs" instead of "Add trace-dialog tabs", or restructure as a single pipeline.

🤖 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 `@docs/architecture/deepchat-tape-view-manifest/plan.md` around lines 143 -
150, The Rollout section contains repetitive sentence structure with steps 2, 3,
and 4 all starting with "Add". Vary the sentence starters by rewording these
steps with different verbs or phrases—for example, replace "Add route/client and
tests" with an alternative verb like "Implement", replace "Add trace-dialog
tabs" with "Extend" or "Integrate", and replace "Add context parity coverage"
with "Ensure" or "Establish"—to improve stylistic flow while maintaining clarity
of intent.
docs/architecture/deepchat-tape-view-assembler/spec.md (1)

22-28: 💤 Low value

Improve sentence structure in Non-Goals section.

Lines 24, 25, and 26 all begin with "Changing" and should use varied phrasing for readability.

Suggested rewording
 ## Non-Goals

 - Changing context selection policy.
-- Changing compaction policy.
-- Changing provider preflight or context-pressure recovery.
+- Compaction policy updates.
+- Provider preflight or context-pressure recovery modifications.
🤖 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 `@docs/architecture/deepchat-tape-view-assembler/spec.md` around lines 22 - 28,
The Non-Goals section has repetitive sentence structure with three consecutive
bullet points all beginning with "Changing" which reduces readability. Reword
the bullet points for "Changing context selection policy", "Changing compaction
policy", and "Changing provider preflight or context-pressure recovery" to use
varied phrasing and different sentence structures instead of repeating the
"Changing" pattern at the start of each item.

Source: Linters/SAST tools

src/main/presenter/agentRuntimePresenter/tapeViewManifest.ts (1)

263-270: 💤 Low value

Consider importing isCompactionRecord from contextBuilder.ts instead of duplicating.

This function is identical to the one in contextBuilder.ts (lines 175-182). While not a bug, consolidating to a single source would reduce maintenance burden.

🤖 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 `@src/main/presenter/agentRuntimePresenter/tapeViewManifest.ts` around lines
263 - 270, The isCompactionRecord function in tapeViewManifest.ts is duplicated
from contextBuilder.ts. Remove the isCompactionRecord function definition (lines
263-270) from tapeViewManifest.ts and instead import it from contextBuilder.ts
at the top of the file. This consolidates the single source of truth for the
function and reduces maintenance burden by eliminating the duplicate code.
🤖 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 `@docs/architecture/deepchat_tape_spec_v1.md`:
- Around line 4-9: The reference to `deepchat-tape-view-assembler/spec.md` in
`docs/architecture/deepchat_tape_spec_v1.md` (lines 4-9, specifically line 6)
points to a missing file that breaks the baseline reference. You must choose one
of two paths: either add the missing `spec.md` file at
`docs/architecture/deepchat-tape-view-assembler/spec.md` following the same
structure and format as the existing `deepchat-tape-view-manifest/spec.md` and
`deepchat-tape-view-policy/spec.md` files (documenting goals, acceptance
criteria, and contract), or remove the reference to
`deepchat-tape-view-assembler/spec.md` from line 6 in
`docs/architecture/deepchat_tape_spec_v1.md` if the specification is
intentionally deferred.

In `@src/main/presenter/agentRuntimePresenter/contextBuilder.ts`:
- Around line 1194-1199: The filter condition in the `excludedRecords`
assignment (around line 1194) is missing a check for `emittedRecordIds` to
prevent duplicate exclusion entries. Records marked as `empty_after_formatting`
in lines 1188-1193 could also be included in the `out_of_budget` exclusion list,
causing duplicates. Add a check similar to the pattern used in
`buildContextWithMetadata` at lines 1031-1032 by adding
`!emittedRecordIds.has(record.id)` to the filter condition to ensure mutual
exclusivity between records marked as `empty_after_formatting` and those marked
as `out_of_budget`.

In `@src/main/presenter/agentSessionPresenter/index.ts`:
- Around line 1445-1471: The resolveAgentImplementation method calls at both
locations can throw exceptions when encountering stale or unknown agent IDs,
causing hard IPC failures instead of graceful degradation. Wrap the
resolveAgentImplementation call in the first method (around line 1445) in a
try-catch block and return an empty array [] on failure. Similarly, wrap the
resolveAgentImplementation call in the exportMessageTapeReplaySlice method
(around line 1464) in a try-catch block and return null on failure. This ensures
both methods degrade gracefully when agent resolution fails rather than
propagating exceptions.

In `@src/renderer/api/SessionClient.ts`:
- Around line 247-258: Both listMessageTraceDiagnostics and
listMessageViewManifests functions cast result.manifests to
DeepChatTapeViewManifestRecord[] without handling the case where manifests is
undefined, which violates the array return contract. Normalize the manifests
value in both functions by returning either the actual manifests array (if
defined) or an empty array as a fallback, replacing the unsafe type casts with
proper normalization logic.

In `@src/renderer/src/i18n/da-DK/traceDialog.json`:
- Around line 18-51: The file contains English text instead of Danish
translations for diagnostic UI labels. Replace all the English values with
Danish translations for the following keys in the traceDialog.json file:
tabs.request, tabs.view, tabs.entries, tabs.budget, empty, emptyDesc,
requestUnavailable, requestUnavailableDesc, manifestUnavailable,
manifestUnavailableDesc, viewId, policy, policyVersion, taskType, requestSeq,
latestEntryId, promptHash, toolDefinitionsHash, manifestHash, includedEntries,
excludedEntries, entryId, messageId, orderSeq, role, source, reason,
contextLength, requestedMaxTokens, effectiveMaxTokens, reserveTokens,
toolReserveTokens, and estimatedPromptTokens. Provide appropriate Danish
translations for each key to ensure Danish-speaking users see the correct
language in the TraceDialog UI.

In `@src/renderer/src/i18n/de-DE/traceDialog.json`:
- Around line 18-51: The German translation file (de-DE/traceDialog.json) from
lines 18–51 contains English strings instead of German translations for all
diagnostic UI labels and metadata keys. Replace the English text for all keys
with appropriate German translations, including: tabs.request, tabs.view,
tabs.entries, tabs.budget, empty, emptyDesc, requestUnavailable,
requestUnavailableDesc, manifestUnavailable, manifestUnavailableDesc, and all
metadata label keys (viewId, policy, policyVersion, taskType, requestSeq,
latestEntryId, promptHash, toolDefinitionsHash, manifestHash, includedEntries,
excludedEntries, entryId, messageId, orderSeq, role, source, reason,
contextLength, requestedMaxTokens, effectiveMaxTokens, reserveTokens,
toolReserveTokens, estimatedPromptTokens). Ensure each translation is
contextually accurate for the diagnostic trace dialog UI.

In `@src/renderer/src/i18n/es-ES/traceDialog.json`:
- Around line 18-51: The traceDialog.json file for the es-ES locale contains
English text values instead of Spanish translations. Replace all English values
with their appropriate Spanish equivalents for every key from line 18 onward,
including the tabs object keys (request, view, entries, budget), empty state
messages (empty, emptyDesc), unavailability messages (requestUnavailable,
requestUnavailableDesc, manifestUnavailable, manifestUnavailableDesc), and all
metadata labels (viewId, policy, policyVersion, taskType, requestSeq,
latestEntryId, promptHash, toolDefinitionsHash, manifestHash, includedEntries,
excludedEntries, entryId, messageId, orderSeq, role, source, reason,
contextLength, requestedMaxTokens, effectiveMaxTokens, reserveTokens,
toolReserveTokens, estimatedPromptTokens). Ensure each translation maintains the
original meaning and context appropriate for the TraceDialog UI.

In `@src/renderer/src/i18n/fa-IR/traceDialog.json`:
- Around line 17-51: All new traceDialog keys in lines 17-51 across seven locale
files are using English text instead of proper translations. Translate all keys
in this range to their target languages: in
src/renderer/src/i18n/fa-IR/traceDialog.json translate to Persian (فارسی), in
src/renderer/src/i18n/fr-FR/traceDialog.json translate to French, in
src/renderer/src/i18n/he-IL/traceDialog.json translate to Hebrew (עברית), in
src/renderer/src/i18n/id-ID/traceDialog.json translate to Indonesian (Bahasa
Indonesia), in src/renderer/src/i18n/it-IT/traceDialog.json translate to Italian
(Italiano), in src/renderer/src/i18n/tr-TR/traceDialog.json translate to Turkish
(Türkçe), and in src/renderer/src/i18n/vi-VN/traceDialog.json translate to
Vietnamese (Tiếng Việt). The keys that require translation include: tabs, empty,
emptyDesc, requestUnavailable, requestUnavailableDesc, manifestUnavailable,
manifestUnavailableDesc, viewId, policy, policyVersion, taskType, requestSeq,
latestEntryId, promptHash, toolDefinitionsHash, manifestHash, includedEntries,
excludedEntries, entryId, messageId, orderSeq, role, source, reason,
contextLength, requestedMaxTokens, effectiveMaxTokens, reserveTokens,
toolReserveTokens, and estimatedPromptTokens.

In `@src/renderer/src/i18n/ja-JP/traceDialog.json`:
- Around line 17-51: All six locale files contain English-language strings
instead of native-language translations for the newly added TraceDialog
diagnostic UI elements. Translate lines 17–51 in each of the following files to
their respective languages: src/renderer/src/i18n/ja-JP/traceDialog.json to
Japanese, src/renderer/src/i18n/ko-KR/traceDialog.json to Korean,
src/renderer/src/i18n/ms-MY/traceDialog.json to Malay,
src/renderer/src/i18n/pl-PL/traceDialog.json to Polish,
src/renderer/src/i18n/pt-BR/traceDialog.json to Portuguese (Brazil), and
src/renderer/src/i18n/ru-RU/traceDialog.json to Russian. For each file, replace
all English string values (including tabs.request, tabs.view, tabs.entries,
tabs.budget, empty, emptyDesc, and all metadata field labels such as viewId,
policy, taskType, requestSeq, promptHash, etc.) with proper translations in the
target language while keeping the JSON keys unchanged.

In `@src/renderer/src/i18n/zh-HK/traceDialog.json`:
- Around line 17-51: The Traditional Chinese locale files contain simplified
Chinese strings which is a localization defect. In
src/renderer/src/i18n/zh-HK/traceDialog.json (lines 17-51), replace all
simplified Chinese strings with Traditional Chinese using Hong Kong phrasing
conventions (e.g., "请求" to "要求", "消息" to "訊息", "视图" to "檢視", etc.). In
src/renderer/src/i18n/zh-TW/traceDialog.json (lines 17-51), perform the same
conversion to Traditional Chinese but using Taiwan phrasing conventions where
applicable. Ensure all string values in the tabs, empty, requestUnavailable,
manifestUnavailable, and all other key-value pairs match proper Traditional
Chinese localization standards for each region.

In `@src/shared/contracts/routes.ts`:
- Line 459: The explicit type annotation on DEEPCHAT_ROUTE_CATALOG at line 459
uses `: Record<string, RouteContract>` which causes TypeScript to lose literal
type precision for the object keys. Since DeepchatRouteCatalog is derived from
typeof DEEPCHAT_ROUTE_CATALOG, this makes DeepchatRouteName (keyof
DeepchatRouteCatalog) resolve to string instead of the literal union of actual
route names, which weakens type inference in generic functions like
getDeepchatRouteContract. Replace the explicit type annotation with satisfies
Record<string, RouteContract> instead, which preserves the inferred literal
object type while maintaining the assignability constraint.

---

Outside diff comments:
In `@src/main/presenter/agentRuntimePresenter/index.ts`:
- Around line 3174-3221: After `resolveCompactionStateForResumeTurn` completes
(which can insert compaction messages and modify order sequences), the
`tapeReady.historyRecords` snapshot passed to `buildTapeResumeView` is stale.
Before calling `buildTapeResumeView`, refresh the history records from the tape
service to ensure the resume context uses the current ordering after compaction.
Retrieve the updated history records (using the appropriate method like
`this.tapeService.ensureSessionTapeReady`) and pass them to
`buildTapeResumeView` instead of the pre-compaction snapshot.
- Around line 2472-2488: The recoverContextPressure function creates a new
summary during context pressure recovery, but the recovery's resulting
summaryCursorOrderSeq cursor is not being captured and used when the manifest is
appended. Modify recoverContextPressure to return the summaryCursorOrderSeq
value from the recovery result, capture this returned cursor in the code block
where recoverContextPressure is called (lines 2472-2488), and then use this
recovered cursor value instead of the pre-recovery
viewContext.summaryCursorOrderSeq when recording the manifest to ensure replay
provenance matches the actual provider request.

In `@src/renderer/src/components/trace/TraceDialog.vue`:
- Around line 331-359: The selectedTrace and selectedManifest computed
properties have a logic issue where they fall back to returning the first item
from their respective lists even when a selectedRequestSeq is explicitly set but
not found. This causes mismatched data to be displayed. Modify both computed
properties so that the fallback to the first item (traceList.value[0] and
manifestList.value[0] respectively) only occurs when selectedRequestSeq.value is
null or undefined. When selectedRequestSeq.value is set but no matching item is
found in the list, return null instead of falling back to the first item,
ensuring that traces and manifests for the same request are always displayed
together or neither is displayed.

---

Nitpick comments:
In `@docs/architecture/deepchat-tape-view-assembler/spec.md`:
- Around line 22-28: The Non-Goals section has repetitive sentence structure
with three consecutive bullet points all beginning with "Changing" which reduces
readability. Reword the bullet points for "Changing context selection policy",
"Changing compaction policy", and "Changing provider preflight or
context-pressure recovery" to use varied phrasing and different sentence
structures instead of repeating the "Changing" pattern at the start of each
item.

In `@docs/architecture/deepchat-tape-view-manifest/plan.md`:
- Around line 143-150: The Rollout section contains repetitive sentence
structure with steps 2, 3, and 4 all starting with "Add". Vary the sentence
starters by rewording these steps with different verbs or phrases—for example,
replace "Add route/client and tests" with an alternative verb like "Implement",
replace "Add trace-dialog tabs" with "Extend" or "Integrate", and replace "Add
context parity coverage" with "Ensure" or "Establish"—to improve stylistic flow
while maintaining clarity of intent.

In `@src/main/presenter/agentRuntimePresenter/tapeViewManifest.ts`:
- Around line 263-270: The isCompactionRecord function in tapeViewManifest.ts is
duplicated from contextBuilder.ts. Remove the isCompactionRecord function
definition (lines 263-270) from tapeViewManifest.ts and instead import it from
contextBuilder.ts at the top of the file. This consolidates the single source of
truth for the function and reduces maintenance burden by eliminating the
duplicate code.
🪄 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

Run ID: 683ccce7-ff2d-426a-b9a0-7533c6a0a21e

📥 Commits

Reviewing files that changed from the base of the PR and between f6c5b94 and a32c029.

📒 Files selected for processing (64)
  • docs/architecture/deepchat-tape-policy-provenance/plan.md
  • docs/architecture/deepchat-tape-policy-provenance/spec.md
  • docs/architecture/deepchat-tape-policy-provenance/tasks.md
  • docs/architecture/deepchat-tape-policy-selector/plan.md
  • docs/architecture/deepchat-tape-policy-selector/spec.md
  • docs/architecture/deepchat-tape-policy-selector/tasks.md
  • docs/architecture/deepchat-tape-replay-contract/plan.md
  • docs/architecture/deepchat-tape-replay-contract/spec.md
  • docs/architecture/deepchat-tape-replay-contract/tasks.md
  • docs/architecture/deepchat-tape-view-assembler/plan.md
  • docs/architecture/deepchat-tape-view-assembler/spec.md
  • docs/architecture/deepchat-tape-view-assembler/tasks.md
  • docs/architecture/deepchat-tape-view-manifest/plan.md
  • docs/architecture/deepchat-tape-view-manifest/spec.md
  • docs/architecture/deepchat-tape-view-manifest/tasks.md
  • docs/architecture/deepchat-tape-view-policy/plan.md
  • docs/architecture/deepchat-tape-view-policy/spec.md
  • docs/architecture/deepchat-tape-view-policy/tasks.md
  • docs/architecture/deepchat_tape_spec_v1.md
  • src/main/presenter/agentRuntimePresenter/contextBuilder.ts
  • src/main/presenter/agentRuntimePresenter/index.ts
  • src/main/presenter/agentRuntimePresenter/tapeService.ts
  • src/main/presenter/agentRuntimePresenter/tapeViewAssembler.ts
  • src/main/presenter/agentRuntimePresenter/tapeViewManifest.ts
  • src/main/presenter/agentRuntimePresenter/tapeViewPolicy.ts
  • src/main/presenter/agentSessionPresenter/index.ts
  • src/main/routes/index.ts
  • src/renderer/api/SessionClient.ts
  • src/renderer/settings/components/ProviderConfigImportDialog.vue
  • src/renderer/src/components/mcp-config/AgentMcpSelector.vue
  • src/renderer/src/components/trace/TraceDialog.vue
  • src/renderer/src/i18n/da-DK/traceDialog.json
  • src/renderer/src/i18n/de-DE/traceDialog.json
  • src/renderer/src/i18n/en-US/traceDialog.json
  • src/renderer/src/i18n/es-ES/traceDialog.json
  • src/renderer/src/i18n/fa-IR/traceDialog.json
  • src/renderer/src/i18n/fr-FR/traceDialog.json
  • src/renderer/src/i18n/he-IL/traceDialog.json
  • src/renderer/src/i18n/id-ID/traceDialog.json
  • src/renderer/src/i18n/it-IT/traceDialog.json
  • src/renderer/src/i18n/ja-JP/traceDialog.json
  • src/renderer/src/i18n/ko-KR/traceDialog.json
  • src/renderer/src/i18n/ms-MY/traceDialog.json
  • src/renderer/src/i18n/pl-PL/traceDialog.json
  • src/renderer/src/i18n/pt-BR/traceDialog.json
  • src/renderer/src/i18n/ru-RU/traceDialog.json
  • src/renderer/src/i18n/tr-TR/traceDialog.json
  • src/renderer/src/i18n/vi-VN/traceDialog.json
  • src/renderer/src/i18n/zh-CN/traceDialog.json
  • src/renderer/src/i18n/zh-HK/traceDialog.json
  • src/renderer/src/i18n/zh-TW/traceDialog.json
  • src/shared/contracts/routes.ts
  • src/shared/contracts/routes/sessions.routes.ts
  • src/shared/types/agent-interface.d.ts
  • src/shared/types/presenters/agent-session.presenter.d.ts
  • src/shared/types/tape-replay.ts
  • src/shared/types/tape-view-manifest.ts
  • test/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.ts
  • test/main/presenter/agentRuntimePresenter/tapeService.test.ts
  • test/main/presenter/agentRuntimePresenter/tapeViewAssembler.test.ts
  • test/main/presenter/agentRuntimePresenter/tapeViewManifest.test.ts
  • test/main/presenter/agentRuntimePresenter/tapeViewPolicy.test.ts
  • test/main/presenter/presenterCallErrorHandler.test.ts
  • test/renderer/components/trace/TraceDialog.test.ts

Comment thread docs/architecture/deepchat_tape_spec_v1.md
Comment thread src/main/presenter/agentRuntimePresenter/contextBuilder.ts
Comment thread src/main/presenter/agentSessionPresenter/index.ts Outdated
Comment thread src/renderer/api/SessionClient.ts
Comment thread src/renderer/src/i18n/da-DK/traceDialog.json Outdated
Comment thread src/renderer/src/i18n/es-ES/traceDialog.json Outdated
Comment thread src/renderer/src/i18n/fa-IR/traceDialog.json Outdated
Comment thread src/renderer/src/i18n/ja-JP/traceDialog.json Outdated
Comment thread src/renderer/src/i18n/zh-HK/traceDialog.json Outdated
Comment thread src/shared/contracts/routes.ts Outdated
@zerob13 zerob13 merged commit a19e5d6 into dev Jun 15, 2026
3 checks passed
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