Skip to content

refactor: use CoreToolCallStatus in the the history data model#19033

Merged
jerop merged 1 commit intomainfrom
refactor/tool-call-status-to-core
Feb 13, 2026
Merged

refactor: use CoreToolCallStatus in the the history data model#19033
jerop merged 1 commit intomainfrom
refactor/tool-call-status-to-core

Conversation

@jerop
Copy link
Contributor

@jerop jerop commented Feb 13, 2026

This refactor updates the CLI to store the high-fidelity CoreToolCallStatus in the history data model (ToolCallEvent and IndividualToolCallDisplay) instead of the simplified ToolCallStatus.

The mapping to the display-oriented ToolCallStatus is now deferred to the view layer (React components), ensuring that internal logic and hooks have access to the precise state of tool execution.

Follow-up to #18998
Related to #18918


Mapping from CoreToolCallStatus to ToolCallStatus:

export function mapCoreStatusToDisplayStatus(
coreStatus: CoreStatus,
): ToolCallStatus {
switch (coreStatus) {
case CoreToolCallStatus.Validating:
return ToolCallStatus.Pending;
case CoreToolCallStatus.AwaitingApproval:
return ToolCallStatus.Confirming;
case CoreToolCallStatus.Executing:
return ToolCallStatus.Executing;
case CoreToolCallStatus.Success:
return ToolCallStatus.Success;
case CoreToolCallStatus.Cancelled:
return ToolCallStatus.Canceled;
case CoreToolCallStatus.Error:
return ToolCallStatus.Error;
case CoreToolCallStatus.Scheduled:
return ToolCallStatus.Pending;
default:
return checkExhaustive(coreStatus);
}
}

@jerop jerop requested a review from a team as a code owner February 13, 2026 21:44
@jerop jerop changed the title refactor: use CoreToolCallStatus in the the history data model refactor: use CoreToolCallStatus in the the history data model Feb 13, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jerop, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the CLI's internal handling of tool call statuses. Instead of storing a simplified ToolCallStatus in the history data model, it now persists the more detailed CoreToolCallStatus. This change centralizes the logic for translating core statuses to display-specific statuses within the UI layer, providing a clearer separation of concerns and allowing internal components to operate with a richer understanding of tool execution states.

Highlights

  • History Data Model Update: The CLI's history data model (ToolCallEvent and IndividualToolCallDisplay) now stores the high-fidelity CoreToolCallStatus instead of the simplified ToolCallStatus.
  • Deferred Status Mapping: The mapping from CoreToolCallStatus to the display-oriented ToolCallStatus is now explicitly handled in the UI layer (React components), ensuring internal logic has access to precise tool execution states.
  • Type Safety and Consistency: Numerous files across the CLI were updated to import and utilize CoreToolCallStatus directly, improving type safety and consistency in how tool execution statuses are managed.
Changelog
  • packages/cli/src/nonInteractiveCli.test.ts
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/App.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.AwaitingApproval.
  • packages/cli/src/ui/AppContainer.test.tsx
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.Executing.
  • packages/cli/src/ui/AppContainer.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated status comparisons in isToolExecuting and isToolAwaitingConfirmation to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/components/AlternateBufferQuittingDisplay.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/components/Composer.test.tsx
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.AwaitingApproval.
  • packages/cli/src/ui/components/Composer.tsx
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated status comparison for isToolAwaitingConfirmation to use CoreToolCallStatus.AwaitingApproval.
  • packages/cli/src/ui/components/HistoryItemDisplay.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.AwaitingApproval.
  • packages/cli/src/ui/components/MainContent.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.Executing.
  • packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus.AwaitingApproval.
  • packages/cli/src/ui/components/messages/ShellToolMessage.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses and updateStatus type to use CoreToolCallStatus.
  • packages/cli/src/ui/components/messages/ShellToolMessage.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated getShellMaxLines function to use CoreToolCallStatus enum values for status checks.
  • packages/cli/src/ui/components/messages/Todo.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.Success.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus enum values.
    • Updated snapshot names to reflect lowercase status values.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
    • Imported CoreToolCallStatus and mapCoreStatusToDisplayStatus.
    • Updated tool filtering logic to use the mapped display status for shouldHideAskUserTool and visibleToolCalls.
    • Updated hasPending check to use CoreToolCallStatus.Success.
  • packages/cli/src/ui/components/messages/ToolMessage.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses in ToolStatusIndicator rendering tests to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/components/messages/ToolMessageFocusHint.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.Executing.
  • packages/cli/src/ui/components/messages/ToolMessageRawMarkdown.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.Success.
  • packages/cli/src/ui/components/messages/ToolResultDisplayOverflow.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated a mock tool call status to CoreToolCallStatus.Success.
  • packages/cli/src/ui/components/messages/ToolShared.tsx
    • Imported CoreToolCallStatus and mapCoreStatusToDisplayStatus.
    • Updated isThisShellFocusable, isThisShellFocused, ToolStatusIndicator, and ToolInfo to use CoreToolCallStatus and the status mapping function.
  • packages/cli/src/ui/components/messages/ToolStickyHeaderRegression.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to CoreToolCallStatus.Success.
  • packages/cli/src/ui/components/messages/snapshots/ToolGroupMessage.test.tsx.snap
    • Updated snapshot content to reflect lowercase status values for 'Error' and 'Success'.
  • packages/cli/src/ui/contexts/ToolActionsContext.test.tsx
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to CoreToolCallStatus.AwaitingApproval.
  • packages/cli/src/ui/hooks/atCommandProcessor.test.ts
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/hooks/atCommandProcessor.ts
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated tool call statuses to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/hooks/shellCommandProcessor.test.tsx
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/hooks/shellCommandProcessor.ts
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated tool call statuses to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/hooks/slashCommandProcessor.test.tsx
    • Updated a mock status to use SlashCommandStatus.ERROR.
  • packages/cli/src/ui/hooks/slashCommandProcessor.ts
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
  • packages/cli/src/ui/hooks/toolMapping.test.ts
    • Removed mapCoreStatusToDisplayStatus import from toolMapping.js.
    • Imported mapCoreStatusToDisplayStatus from ../types.js.
    • Updated assertions to expect CoreToolCallStatus values for tool statuses.
  • packages/cli/src/ui/hooks/toolMapping.ts
    • Removed mapCoreStatusToDisplayStatus function and related imports.
    • Updated mapToDisplay to directly use call.status (which is CoreToolCallStatus) instead of mapping it, as the mapping is now in ../types.js.
  • packages/cli/src/ui/hooks/useConfirmingTool.ts
    • Removed ToolCallStatus import.
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated status comparison to CoreToolCallStatus.AwaitingApproval.
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx
    • Removed ToolCallStatus import.
    • Updated mock tool call statuses to CoreToolCallStatus.Success.
  • packages/cli/src/ui/hooks/useGeminiStream.ts
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated status comparisons in calculateStreamingState and cancelPendingTools to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/hooks/useSessionBrowser.test.ts
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to CoreToolCallStatus.Success.
  • packages/cli/src/ui/hooks/useToolScheduler.test.ts
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus enum values.
  • packages/cli/src/ui/hooks/useTurnActivityMonitor.test.ts
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to CoreToolCallStatus.Executing.
  • packages/cli/src/ui/types.ts
    • Imported CoreToolCallStatus and checkExhaustive.
    • Defined mapCoreStatusToDisplayStatus function to translate CoreToolCallStatus to ToolCallStatus.
    • Updated ToolCallEvent and IndividualToolCallDisplay interfaces to use CoreToolCallStatus for their status property.
  • packages/cli/src/utils/sessionUtils.ts
    • Imported CoreToolCallStatus.
    • Removed ToolCallStatus import.
    • Updated status mapping logic in convertSessionToHistoryFormats to use CoreToolCallStatus.
  • packages/cli/src/zed-integration/acpResume.test.ts
    • Imported CoreToolCallStatus from @google/gemini-cli-core.
    • Updated mock tool call statuses to use CoreToolCallStatus enum values.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 13, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI to replace the UI-specific ToolCallStatus and various string literals with the centralized CoreToolCallStatus enum from @google/gemini-cli-core, updating the history data model, hooks, and components. This significantly improves type safety and aligns the CLI's internal state with the core library. A thorough security audit confirmed that no vulnerabilities were introduced, and existing security controls remain intact.

@github-actions
Copy link

github-actions bot commented Feb 13, 2026

Size Change: +643 B (0%)

Total Size: 24.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.4 MB +643 B (0%)
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

…allDisplay

This refactor updates the CLI to store the high-fidelity 'CoreToolCallStatus' in the history data model (ToolCallEvent and IndividualToolCallDisplay) instead of the simplified 'ToolCallStatus'. The mapping to the display-oriented 'ToolCallStatus' is now deferred to the view layer (React components), ensuring that internal logic and hooks have access to the precise state of tool execution.

Follow-up to #18998

Related to #18918
@jerop jerop force-pushed the refactor/tool-call-status-to-core branch from f353e4c to 9d91f8f Compare February 13, 2026 21:51
@jerop jerop enabled auto-merge February 13, 2026 21:52
@jerop jerop added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit f87468c Feb 13, 2026
26 of 27 checks passed
@jerop jerop deleted the refactor/tool-call-status-to-core branch February 13, 2026 22:31
@jerop jerop linked an issue Feb 14, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI] Hide plan write and edit operations from UI in plan mode

2 participants