Skip to content

fix: user feedback issues#1378

Merged
zerob13 merged 3 commits intodevfrom
bugfix/user-feedback-issues
Mar 23, 2026
Merged

fix: user feedback issues#1378
zerob13 merged 3 commits intodevfrom
bugfix/user-feedback-issues

Conversation

@zerob13
Copy link
Copy Markdown
Collaborator

@zerob13 zerob13 commented Mar 23, 2026

Summary by CodeRabbit

  • New Features

    • Tool output guardrails: fit multi-tool results into remaining context by preserving earlier results, downgrading tail results to a fixed failure message, cleaning up offloaded outputs, skipping persistence/search for downgraded items, and falling back if nothing fits.
    • Splash window display timing gating to avoid premature showing.
  • Bug Fixes

    • MCP server list now respects the global MCP enabled/disabled setting.
  • Localization

    • Added "Identifier" label translations across supported locales.
  • Tests

    • Added/updated tests covering batch-fitting, downgrades, offload cleanup, search suppression, and splash timing.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Implements batch-fitting guardrails for tool outputs: stage tool results, fit a batch against context budget, downgrade tail items to a fixed failure message and clean up offload files, and only commit persisted messages/hooks/search results after fitting; adds tests, i18n keys, splash gating, and MCP store change.

Changes

Cohort / File(s) Summary
Docs: Guardrail plan & spec
docs/specs/tool-output-guardrails/plan.md, docs/specs/tool-output-guardrails/spec.md
New plan and spec describing batch-fitting behavior: stage outputs, preserve prefix, downgrade tail items to a fixed "remaining context window is too small to continue this turn" message, skip persistence/hooks/search for downgraded items, and terminal-fallback if nothing fits.
Presenter: executeTools refactor
src/main/presenter/deepchatAgentPresenter/dispatch.ts
Refactors executeTools() to stage per-tool results instead of committing immediately, defer persistence, replace immediate guard short-circuits with staged handling, add finalization step that applies fitted results and runs hooks.
Presenter: batch-fit algorithm/API
src/main/presenter/deepchatAgentPresenter/toolOutputGuard.ts
Adds exported types for batch candidates and fitToolBatchOutputs() which attempts full-batch fit, progressively downgrades tail items to fixed failure text on overflow, clears offload paths for downgraded items, deletes offload files, and returns terminal_error if no fit is possible.
Tests: tool-output behavior
test/main/presenter/deepchatAgentPresenter/dispatch.test.ts, test/main/presenter/deepchatAgentPresenter/process.test.ts
Adds/updates tests to cover batch-fitting, tail downgrades, offload cleanup for downgraded items, absence of search blocks/persistence for downgraded search results, and regression for deferred single-tool resume; adjusts abort-related expectations and adds token estimation helpers.
Splash window gating & tests
src/main/presenter/lifecyclePresenter/SplashWindowManager.ts, test/main/presenter/lifecyclePresenter/SplashWindowManager.display.test.ts
Adds 200ms show-delay gating and suppression when main window is created; defers show until both ready-to-show and delay elapsed; adds tests validating timing and suppression.
MCP store change & test
src/renderer/src/stores/mcp.ts, test/renderer/stores/mcpStore.test.ts
enabledServers now returns an empty array when global MCP is disabled; adds test ensuring per-server enabled:true is ignored if MCP is globally disabled.
i18n: model ID label added
src/renderer/src/i18n/*/settings.json
da-DK,en-US,fa-IR,fr-FR,he-IL,ja-JP,ko-KR,pt-BR,ru-RU,zh-CN,zh-HK,zh-TW
Adds model.form.id.label translation key across 12 locales with locale-specific text for a model identifier field.
Window event payload update
src/main/presenter/windowPresenter/index.ts
Send WINDOW_EVENTS.WINDOW_CREATED payload as {windowId, isMainWindow} instead of only windowId.

Sequence Diagram(s)

sequenceDiagram
    participant Executor as executeTools
    participant Guard as ToolOutputGuard
    participant OffloadFS as OffloadFS
    participant MessageStore as MessageStore
    participant Conversation as Conversation/Model

    Executor->>Guard: prepareToolOutput(toolResult)
    Executor->>Executor: collect stagedResults[]
    Executor->>Guard: fitToolBatchOutputs(stagedResults, contextBudget)
    Guard->>OffloadFS: delete offload files for downgraded items (concurrent) rgba(200,100,50,0.5)
    Guard-->>Executor: FitResult (ok | terminal_error) with per-item downgraded flags
    alt FitResult.kind == 'ok'
        Executor->>Conversation: append tool messages for non-downgraded items
        Executor->>MessageStore: addSearchResult(...) for non-downgraded search items
        Executor->>Executor: run post-hooks for success items
    else FitResult.kind == 'terminal_error'
        Executor->>Conversation: append terminal failure message / end turn
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰
I nibbled tokens, one by one,
Kept the front snug, the tail undone,
If space ran out, I left a note—
“remaining context window is too small to continue this turn” wrote,
Offloads swept clean, the hop goes on.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'fix: user feedback issues' is vague and does not clearly describe the actual changes, which span tool output guardrails, splash window timing, MCP server filtering, and i18n translations. Provide a more specific title that captures the primary change, such as 'fix: implement tool output guardrails with batch fitting and context budget management' or break into multiple focused PRs.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 bugfix/user-feedback-issues

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/main/presenter/lifecyclePresenter/SplashWindowManager.display.test.ts (1)

104-120: Tighten this test to main-window-specific suppression

This case currently proves suppression on a generic WINDOW_CREATED emission, which can mask the non-main-window bug. Add/adjust assertions so suppression is tied to a main-window-specific event payload (and ideally keep a negative case for non-main windows).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/main/presenter/lifecyclePresenter/SplashWindowManager.display.test.ts`
around lines 104 - 120, The test currently treats any
WINDOW_EVENTS.WINDOW_CREATED as "main" and thus can hide non-main bugs; update
the emission to use a main-window-specific payload (e.g. call
eventBus.sendToMain(WINDOW_EVENTS.WINDOW_CREATED, { id: 1, isMain: true }) or,
if your codebase has it, emit WINDOW_EVENTS.MAIN_WINDOW_CREATED) so
SplashWindowManager suppression is exercised only for a true main window, and
add a short negative case that emits WINDOW_EVENTS.WINDOW_CREATED with isMain:
false (or a non-main id) and asserts the splashWindow.show was called and
manager.isVisible() is true; reference SplashWindowManager, eventBus.sendToMain,
and WINDOW_EVENTS.WINDOW_CREATED (or WINDOW_EVENTS.MAIN_WINDOW_CREATED) when
making these changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/presenter/lifecyclePresenter/SplashWindowManager.ts`:
- Around line 79-86: The current onMainWindowCreated handler unconditionally
suppresses the splash for any WINDOW_EVENTS.WINDOW_CREATED; update the handler
to only suppress when the created window is the main app window by checking a
main-window-specific signal in the event payload (e.g., payload.isMainWindow or
payload.windowType === 'main') before setting suppressSplashShow and calling
clearSplashShowDelayTimer. Modify the listener registration for
WINDOW_EVENTS.WINDOW_CREATED to pass the event payload into onMainWindowCreated
(or add a new handler e.g., onWindowCreatedForMain) and reference the existing
symbols onMainWindowCreated, WINDOW_EVENTS.WINDOW_CREATED, suppressSplashShow,
and clearSplashShowDelayTimer when making the change. Ensure the same gated
check is applied to the other suppression call at the lines around 104-105 as
well.

---

Nitpick comments:
In `@test/main/presenter/lifecyclePresenter/SplashWindowManager.display.test.ts`:
- Around line 104-120: The test currently treats any
WINDOW_EVENTS.WINDOW_CREATED as "main" and thus can hide non-main bugs; update
the emission to use a main-window-specific payload (e.g. call
eventBus.sendToMain(WINDOW_EVENTS.WINDOW_CREATED, { id: 1, isMain: true }) or,
if your codebase has it, emit WINDOW_EVENTS.MAIN_WINDOW_CREATED) so
SplashWindowManager suppression is exercised only for a true main window, and
add a short negative case that emits WINDOW_EVENTS.WINDOW_CREATED with isMain:
false (or a non-main id) and asserts the splashWindow.show was called and
manager.isVisible() is true; reference SplashWindowManager, eventBus.sendToMain,
and WINDOW_EVENTS.WINDOW_CREATED (or WINDOW_EVENTS.MAIN_WINDOW_CREATED) when
making these changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 03b15e76-1039-4998-be61-4abd4f8f569b

📥 Commits

Reviewing files that changed from the base of the PR and between d287563 and 7e81886.

📒 Files selected for processing (22)
  • docs/specs/tool-output-guardrails/plan.md
  • docs/specs/tool-output-guardrails/spec.md
  • src/main/presenter/deepchatAgentPresenter/dispatch.ts
  • src/main/presenter/deepchatAgentPresenter/toolOutputGuard.ts
  • src/main/presenter/lifecyclePresenter/SplashWindowManager.ts
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/stores/mcp.ts
  • test/main/presenter/deepchatAgentPresenter/dispatch.test.ts
  • test/main/presenter/deepchatAgentPresenter/process.test.ts
  • test/main/presenter/lifecyclePresenter/SplashWindowManager.display.test.ts
  • test/renderer/stores/mcpStore.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e81886972

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zerob13 zerob13 merged commit 18c8909 into dev Mar 23, 2026
2 of 3 checks passed
@zerob13 zerob13 deleted the bugfix/user-feedback-issues branch March 29, 2026 05:41
@coderabbitai coderabbitai bot mentioned this pull request Mar 31, 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.

1 participant