Skip to content

Render file change rows in thread conversation#9

Open
SHAREN wants to merge 3 commits intofriuns2:mainfrom
SHAREN:codex/bug-010-file-change-rows
Open

Render file change rows in thread conversation#9
SHAREN wants to merge 3 commits intofriuns2:mainfrom
SHAREN:codex/bug-010-file-change-rows

Conversation

@SHAREN
Copy link

@SHAREN SHAREN commented Mar 23, 2026

Summary

  • render persisted fileChange items from thread/read as inline expandable rows in ThreadConversation
  • preserve live fileChange updates in the shared live system-message pipeline so active edits show up inside the thread during a running turn
  • keep the PR scoped to the original BUG-010 fix stack with no codex-web-local history mixed in

Testing

  • npm run build
  • node output/playwright/verify-file-change.mjs
  • node output/playwright/verify-file-change-live.mjs

@qodo-code-review
Copy link

Review Summary by Qodo

Render file change rows in thread conversation

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Render persisted file change items from thread/read as inline expandable rows
• Parse and normalize file change data with diff statistics extraction
• Preserve live file change updates in shared system-message pipeline
• Display file change summaries with verb, path, and line statistics
Diagram
flowchart LR
  ThreadItem["ThreadItem fileChange"] -->|normalizeThreadItemV2| UiMessage["UiMessage with fileChange"]
  UiMessage -->|live updates| LiveCommand["Live command pipeline"]
  LiveCommand -->|upsertLiveCommand| ThreadConversation["ThreadConversation component"]
  ThreadConversation -->|render| FileChangeRow["Expandable file change row"]
  FileChangeRow -->|display| DiffView["Diff viewer with stats"]
Loading

Grey Divider

File Changes

1. src/types/codex.ts ✨ Enhancement +12/-0

Add file change data types to UiMessage

• Added UiFileChangeData type with file change metadata and diff statistics
• Extended UiMessage type with optional fileChange field
• Includes path, kind, status, diff, movePath, linesAdded, linesRemoved, openLine

src/types/codex.ts


2. src/api/normalizers/v2.ts ✨ Enhancement +132/-1

Normalize file change items with diff statistics

• Added import of UiFileChangeData type
• Implemented toUiMessages handler for fileChange items with per-change message generation
• Added normalizeFileChangeStatus to validate file change status values
• Added readFileChangeKind to parse file change kind and move_path
• Added readFileChangeDiffStats to extract line counts and opening line from unified diff format
• Exported new normalizeThreadItemV2 function for live item normalization

src/api/normalizers/v2.ts


3. src/composables/useDesktopState.ts ✨ Enhancement +54/-0

Handle live file change notifications and equality checks

• Added imports for ThreadItem and normalizeThreadItemV2
• Added UiFileChangeData type import
• Implemented areFileAttachmentsEqual comparison function
• Implemented areFileChangeDataEqual comparison function for live updates
• Updated areMessageFieldsEqual to compare fileAttachments and fileChange fields
• Added readFileChangeMessages to extract file change notifications from RPC events
• Added upsertLiveCommand calls for file change messages in notification handler

src/composables/useDesktopState.ts


View more (1)
4. src/components/content/ThreadConversation.vue ✨ Enhancement +183/-1

Render expandable file change rows in conversation

• Added file change message rendering with expandable row UI
• Implemented file change expansion state management with expandedFileChangeIds
• Added helper functions for file change display: verb, path, stats, diff text
• Added styling for file change rows with chevron, verb, path, and line statistics
• Added file change metadata display with browse link and move path info
• Reset file change expansion state when switching threads

src/components/content/ThreadConversation.vue


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 23, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. FileChange status mis-normalized🐞 Bug ✓ Correctness
Description
normalizeFileChangeStatus silently maps any unrecognized status (including potential snake_case
'in_progress') to 'completed', causing the UI to show the wrong verb/state for file changes. This is
inconsistent with normalizeCommandStatus, which explicitly normalizes 'in_progress' to 'inProgress'.
Code

src/api/normalizers/v2.ts[R209-214]

+function normalizeFileChangeStatus(value: unknown): UiFileChangeData['status'] {
+  if (value === 'inProgress' || value === 'completed' || value === 'failed' || value === 'declined') {
+    return value
+  }
+  return 'completed'
+}
Evidence
In src/api/normalizers/v2.ts, normalizeCommandStatus already handles both 'inProgress' and
'in_progress', proving the client expects snake_case status values in some responses. The new
normalizeFileChangeStatus lacks that mapping and defaults unknown values to 'completed', which will
mislabel any fileChange item that arrives with 'in_progress'. The schema for fileChange status is
PatchApplyStatus (inProgress/completed/failed/declined), so the intended in-progress state is
well-defined and should be preserved when encountered in snake_case.

src/api/normalizers/v2.ts[203-206]
src/api/normalizers/v2.ts[209-214]
documentation/app-server-schemas/typescript/v2/PatchApplyStatus.ts[1-5]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`normalizeFileChangeStatus` currently accepts only camelCase status values and defaults everything else to `'completed'`. Elsewhere (`normalizeCommandStatus`) the client normalizes `'in_progress'` -> `'inProgress'`, so fileChange should be consistent to avoid mis-rendering live/persisted fileChange items if snake_case appears.
### Issue Context
- `fileChange.status` comes from app-server `PatchApplyStatus`.
- Client already anticipates snake_case for status in `normalizeCommandStatus`.
### Fix Focus Areas
- src/api/normalizers/v2.ts[203-214]
### Suggested change
- Update `normalizeFileChangeStatus` to accept `'in_progress'` and map it to `'inProgress'` (mirroring `normalizeCommandStatus`).
- Consider logging/telemetry on unknown statuses rather than silently coercing to `'completed'`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@friuns2
Copy link
Owner

friuns2 commented Mar 23, 2026

IMG_20260323_191208_524
На мобиле поплыло) гляну когда дома буду

@SHAREN
Copy link
Author

SHAREN commented Mar 23, 2026

@friuns2 короче я "навайбкодил" у себя в локальном проекте, но там маленько порядок у меня нарушился, но короче говоря еще несколько фич добавил. fast speed mode, drag-n-drop, вставку изображекний из буфера обмена, отображения хода сжатия контекста, частичную поддержку с codex app. Ну и сейчас понял короче что теперь тяжело мне будет разбираться чтобы сделать правильно PR чтобы ничего не забыть как сейчас 🤯

я постараюсь аккуратно теперь с этим разобраться

@friuns2
Copy link
Owner

friuns2 commented Mar 23, 2026

ну мне мерджить или подождать?

@SHAREN
Copy link
Author

SHAREN commented Mar 23, 2026

ну мне мерджить или подождать?

подождать, но я позже разберусь

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