Skip to content

Fix: post-review cleanup — restore --model, drop dead code & debug logs#470

Closed
daotian-smartnews wants to merge 13 commits into
winfunc:mainfrom
zdt90:fix/post-review-cleanup
Closed

Fix: post-review cleanup — restore --model, drop dead code & debug logs#470
daotian-smartnews wants to merge 13 commits into
winfunc:mainfrom
zdt90:fix/post-review-cleanup

Conversation

@daotian-smartnews

Copy link
Copy Markdown

Summary

Follow-up cleanup after reviewing the merged changes in c0be1b8..fb44390.
Fixes one functional regression and removes unused / leftover code; no
feature behavior is intentionally changed beyond the model fix.

  • fix: execute_claude_code lost its --model argument during the
    switch to --print/stream-json mode, so newly started sessions silently
    ignored the user-selected model and fell back to Claude's default.
    continue/resume already kept --model; restored it for new sessions.
  • fix: mid-turn injected messages (inject_claude_message) sent the
    user content as a bare string while the initial prompt used an array of
    typed content blocks — aligned both to the same array shape.
  • refactor: removed the unused get_setting Tauri command (it always
    returned None and was never invoked; api.getSetting reads from
    localStorage / app_settings directly), plus its registration and the
    apiAdapter endpoint mapping.
  • chore: removed leftover debug logging in Sidebar.tsx (module-level
    "BUILD v1" log, the per-poll running-sessions JSON dump every 5s, and a
    noisy polling-error log).
  • chore: removed a stale TODO.md that had leaked into the tree and
    was already out of date, and git-ignored it to keep future notes local.

Test plan

  • cargo check passes (verified locally).
  • Frontend has no new lint errors (verified locally).
  • Start a new session with a non-default model and confirm the
    selected model is actually used.
  • Continue / resume a session and confirm model selection still works.
  • Send a message mid-turn and confirm it is injected and processed.
  • Open the sidebar and confirm the console no longer prints the
    per-5s running-sessions dump.

Notes / out of scope

  • Session list sort change (now by file mtime via get_project_sessions)
    was left as-is — likely intended, but affects all session lists, not just
    the sidebar. Flagging for confirmation.
  • open_devtools triggers a never used warning for the web binary
    (the dev-only "Inspect Element" menu); not addressed here.

zdt90 and others added 13 commits June 11, 2026 20:07
#2)

- Switch from require() to ESM import for @tauri-apps/api/event listen()
  (require is not available in Vite ESM bundles, causing silent fallback to DOM events)
- Enable withGlobalTauri in tauri.conf.json so window.__TAURI_INTERNALS__
  is injected and the Tauri event bridge works correctly

Co-authored-by: Daotian Zhang <daotian.zhang@smartnews.com>
- Switch claude CLI execution to --print --input-format=stream-json mode
  so stdin stays open during execution
- Add inject_claude_message Tauri command to write user messages into the
  running claude process stdin mid-turn (matching Claude TUI behavior)
- Close stdin automatically on "result" message so the process exits
  cleanly and the loading spinner clears
- Add ~/.local/bin to PATH so claude binary is always found

Co-authored-by: Daotian Zhang <daotian.zhang@smartnews.com>
- Display send (left) and stop (right) buttons at the same time
  instead of toggling between them
- Stop button dims when Claude is not executing; send button remains
  always accessible for mid-turn message injection
…nu, resizable width, and session management (#5)

- Add collapsible sidebar showing projects and sessions with expand/collapse per project
- Left-click opens session in current tab, right-click shows native macOS context menu
- Context menu: Open in New Tab, Rename Session, Delete Session, Refresh Sessions
- Right-click on project: Add New Session
- Inline rename or via context menu; delete confirmation dialog
- Green dot indicator for running sessions
- Compact timestamps (<1m, 3m, 13hr, 2d) right-aligned on session row
- Custom session names stored in ~/.claude/opcode-metadata.json
- Tab title format: ProjectName - SessionName
- Resizable sidebar (drag right edge, min 180px / max 480px)
- Sidebar-wide native context menu (Refresh Sessions) when not clicking a session
- New Session button per project
- Open URLs in system default browser instead of in-app webview
- Fix user message newlines not rendering
- Sidebar visible by default

Co-authored-by: zdt90 <zhdt90@gmail.com>
Add a Tauri nav-guard plugin that intercepts all navigation events and
opens external http(s):// URLs in the system default browser instead of
loading them inside the app webview.

Also refactor duplicate markdownComponents inline definitions in
StreamMessage.tsx into a shared function.

Co-authored-by: zdt90 <zhdt90@gmail.com>
* fix(ui): remove abnormally large gaps between chat messages

The virtualized message list rendered very large vertical gaps between
messages due to two separate issues:

1. measureElement was attached to a framer-motion element wrapped in
   AnimatePresence, which made dynamic height measurement unreliable and
   frequently fell back to the 150px estimate. Move measurement and
   absolute positioning to a stable native div, and keep only the enter
   animation on an inner motion.div.

2. displayableMessages did not filter opcode-internal metadata messages
   (last-prompt, ai-title, mode, queue-operation, attachment). These
   render as null in StreamMessage but still left empty placeholder rows
   (~16px each) that piled up into large blank areas. Restrict the list
   to message types StreamMessage actually renders.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(dev): enable Vite dev server with HMR for tauri dev

Set beforeDevCommand and devUrl so `tauri dev` runs the Vite dev server
with hot module reload instead of loading the prebuilt dist/. Frontend
changes now reflect immediately during development without a manual
rebuild and app restart.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: zdt90 <zhdt90@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Fenced code blocks in chat messages now render with a hover-revealed
copy-to-clipboard button. Clicking copies the full snippet and briefly
shows a confirmation check. Inline code is intentionally left unchanged.

Co-authored-by: zdt90 <zhdt90@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The switch to --print/stream-json mode in execute_claude_code
accidentally dropped the --model argument, so newly started sessions
silently ignored the user-selected model and fell back to Claude's
default. continue/resume already kept --model; this restores it for
new sessions to match.

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the module-level "BUILD v1 - loaded" log and the per-poll
running-sessions JSON dump (printed every 5s), and silence the
non-fatal polling-error log. These were development-time aids that
only added console noise in production.

Co-authored-by: Cursor <cursoragent@cursor.com>
This was a development scratch note that leaked into the tree. Its
contents are already out of date (e.g. it lists the resizable sidebar
as "currently fixed at 260px" even though resizing was implemented in
the same change set), so it is misleading rather than useful.

Co-authored-by: Cursor <cursoragent@cursor.com>
The get_setting Tauri command always returned None and was never
invoked: the frontend api.getSetting reads from localStorage and the
app_settings table directly, never through this command. Remove the
command, its registration, and the apiAdapter endpoint mapping (the
comment claiming StartupIntro used it was inaccurate).

Co-authored-by: Cursor <cursoragent@cursor.com>
inject_claude_message sent the user content as a bare string while the
initial prompt sent it as an array of typed content blocks. Use the
same array shape in both paths so mid-turn injected messages match the
structure Claude already receives for the first prompt.

Co-authored-by: Cursor <cursoragent@cursor.com>
TODO.md is a local development scratch pad and should not be tracked
(an earlier stale copy had leaked into the repo). Ignore it so future
notes stay local.

Co-authored-by: Cursor <cursoragent@cursor.com>
@daotian-smartnews daotian-smartnews deleted the fix/post-review-cleanup branch June 11, 2026 14:23
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