Skip to content

feat(core): experimental in-progress steering hints#18973

Closed
joshualitt wants to merge 1 commit into
mainfrom
jl/model-steering
Closed

feat(core): experimental in-progress steering hints#18973
joshualitt wants to merge 1 commit into
mainfrom
jl/model-steering

Conversation

@joshualitt

Copy link
Copy Markdown
Contributor

This is a rebase / refactor of:
#18783

Fixes #18782

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @joshualitt, 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 introduces an experimental feature that significantly enhances user interaction with the Gemini CLI by allowing real-time steering of the model's in-progress tasks. It provides the foundational infrastructure for capturing and processing user hints, ensuring the model can dynamically adapt its plan based on immediate feedback. This capability is supported by new robust testing utilities and dedicated model configurations, making the CLI more responsive and user-centric.

Highlights

  • Experimental In-Progress Steering Hints: Introduced a new feature allowing users to provide real-time hints to the model while it is executing a task. These hints can be corrective (changing the model's current action) or suggestive (guiding future actions).
  • New Testing Utilities and Evals: Added a comprehensive AppRig utility for behavioral and integration testing of the CLI application, enabling simulation of user interactions, tool policies, and breakpoint injection. New evaluation tests (model_steering.eval.ts) and integration tests (modelSteering.test.tsx) were added to validate the steering hint functionality.
  • Model Configuration and Prompt Updates: A new flash-lite-helper model configuration was added to efficiently process and generate acknowledgements for user hints. The core system prompts were updated to explicitly instruct the model on how to interpret and respond to user steering hints.
  • UI and Core Logic Integration: Integrated hint handling into the AppContainer and useGeminiStream hooks, allowing hints to be captured from user input during active model responses and injected into the model's context. A new HintMessage UI component was added to display these hints distinctly.
Changelog
  • docs/get-started/configuration.md
    • Added 'flash-lite-helper' model configuration.
  • evals/app-test-helper.ts
    • Added 'appEvalTest' helper for behavioral evaluations using 'AppRig'.
  • evals/model_steering.eval.ts
    • Added new evaluation tests for model steering, including corrective and suggestive hints.
  • evals/vitest.config.ts
    • Updated Vitest configuration to support new evaluation tests with 'node' environment, 'globals', 'react' alias, 'setupFiles', and inline dependencies.
  • packages/cli/src/integration-tests/modelSteering.test.tsx
    • Added new integration tests for model steering during tool turns.
  • packages/cli/src/test-utils/AppRig.test.tsx
    • Added new tests for 'AppRig' functionality, including breakpoints and simple message handling.
  • packages/cli/src/test-utils/AppRig.tsx
    • Added a new 'AppRig' utility for testing CLI application behavior, including user input simulation, tool policy management, breakpoints, and user hint injection.
  • packages/cli/src/test-utils/MockShellExecutionService.ts
    • Added a new mock for 'ShellExecutionService' to enable controlled testing of shell commands.
  • packages/cli/src/test-utils/fixtures/simple.responses
    • Added a new fixture file for simple model responses.
  • packages/cli/src/test-utils/fixtures/steering.responses
    • Added a new fixture file for model responses in steering scenarios.
  • packages/cli/src/test-utils/render.tsx
    • Updated rendering utilities to include 'SessionStatsProvider'.
    • Added 'hintMode' and 'hintBuffer' to 'mockUiState'.
    • Added hint-related actions to 'UIActions'.
  • packages/cli/src/ui/AppContainer.tsx
    • Integrated user hint processing with 'consumePendingHints' and 'handleHintSubmit'.
    • Updated 'useGeminiStream' to incorporate hint processing.
    • Imported 'buildUserSteeringHintPrompt' and 'generateSteeringAckMessage'.
  • packages/cli/src/ui/components/DialogManager.tsx
    • Applied minor formatting changes.
  • packages/cli/src/ui/components/Footer.tsx
    • Updated debug profiler visibility logic based on 'settings.merged.general.devtools'.
  • packages/cli/src/ui/components/Header.test.tsx
    • Updated mock theme to include 'hintMode' background color.
  • packages/cli/src/ui/components/HistoryItemDisplay.test.tsx
    • Added a test case for rendering 'HintMessage'.
  • packages/cli/src/ui/components/HistoryItemDisplay.tsx
    • Added rendering for 'HintMessage' component.
    • Passed 'marginBottom' prop to 'InfoMessage'.
  • packages/cli/src/ui/components/InputPrompt.tsx
    • Updated 'useShellHistory' to include 'config.storage'.
  • packages/cli/src/ui/components/messages/HintMessage.tsx
    • Added a new 'HintMessage' component for displaying user hints.
  • packages/cli/src/ui/components/messages/InfoMessage.tsx
    • Added 'marginBottom' prop to 'InfoMessage'.
  • packages/cli/src/ui/contexts/UIActionsContext.tsx
    • Added new actions for hint input and submission.
  • packages/cli/src/ui/contexts/UIStateContext.tsx
    • Added 'hintMode' and 'hintBuffer' to the UI state interface.
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx
    • Updated mock 'GeminiClient' to include 'generateContent'.
    • Added a test for injecting steering hints for continuation.
  • packages/cli/src/ui/hooks/useGeminiStream.ts
    • Modified 'useGeminiStream' to integrate user hints into the model's conversation flow and generate acknowledgement messages.
  • packages/cli/src/ui/hooks/useShellHistory.ts
    • Added 'isMounted' flag and error handling to prevent issues with unmounted components during history loading.
  • packages/cli/src/ui/themes/no-color.ts
    • Added 'hintMode' to the background colors.
  • packages/cli/src/ui/themes/semantic-tokens.ts
    • Added 'hintMode' to 'SemanticColors' interface and theme definitions.
  • packages/cli/src/ui/themes/theme.ts
    • Updated 'Theme' class and 'createCustomTheme' to include 'hintMode' background color.
  • packages/cli/src/ui/types.ts
    • Added 'HistoryItemHint' type and 'HINT' to 'MessageType' enum.
    • Added 'marginBottom' to 'HistoryItemInfo'.
  • packages/core/src/agents/local-executor.ts
    • Modified 'LocalAgentExecutor' to integrate user hints into the agent's prompt, both initially and during subsequent turns.
  • packages/core/src/agents/subagent-tool.ts
    • Modified 'SubagentTool' to pass user hints to sub-agent invocations.
  • packages/core/src/config/config.test.ts
    • Updated 'Config' initialization test to deduplicate multiple calls.
    • Added tests for user hint storage and retrieval.
  • packages/core/src/config/config.ts
    • Modified 'Config' class to manage user hints (add, get, get latest index, get last timestamp).
    • Updated 'initialize' method to handle multiple calls gracefully.
  • packages/core/src/config/defaultModelConfigs.ts
    • Added a new model configuration for 'flash-lite-helper'.
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Updated system prompt snapshots to include the new 'User Hints' mandate.
  • packages/core/src/core/prompts.test.ts
    • Updated prompt tests to expect the 'User Hints' mandate.
  • packages/core/src/index.ts
    • Exported 'baseLlmClient.js' and 'flashLiteHelper.js'.
  • packages/core/src/prompts/snippets.legacy.ts
    • Added 'User Hints' mandate to the legacy core mandates.
  • packages/core/src/prompts/snippets.ts
    • Added 'User Hints' mandate to the core mandates.
  • packages/core/src/services/test-data/resolved-aliases-retry.golden.json
    • Updated golden file to include 'flash-lite-helper' model config.
  • packages/core/src/services/test-data/resolved-aliases.golden.json
    • Updated golden file to include 'flash-lite-helper' model config.
  • packages/core/src/telemetry/startupProfiler.ts
    • Added a 'clear' method to 'StartupProfiler' for test resets.
  • packages/core/src/utils/flashLiteHelper.test.ts
    • Added new tests for 'flashLiteHelper' functions, including truncation and steering acknowledgement generation.
  • packages/core/src/utils/flashLiteHelper.ts
    • Added new utility functions for handling 'flash-lite-helper' model interactions, including input truncation, building steering hint prompts, formatting hints for the model, and generating steering acknowledgement messages.
  • schemas/settings.schema.json
    • Updated schema to include the new 'flash-lite-helper' model configuration.
Activity
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-code-assist gemini-code-assist 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.

Code Review

This pull request introduces an experimental feature for in-progress model steering, allowing users to provide hints to guide the model's behavior during a task. The implementation is comprehensive, touching the core agent execution logic, the UI container, and the main streaming hook to correctly capture and inject these hints. A significant and impressive part of this change is the new testing infrastructure, including the AppRig utility and extensive behavioral evaluation tests, which ensures the new interactive capabilities are robust. The code quality is high, with notable improvements to existing components like making Config.initialize() idempotent. I have reviewed the changes and found no high or critical issues. This is a well-executed and well-tested feature addition.

@gemini-cli gemini-cli Bot added area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 13, 2026
joshualitt added a commit that referenced this pull request Feb 13, 2026
Roll-up PR here:
#18973

This is a rebase / refactor of:
#18783

Part of a series to address issue #18782
joshualitt added a commit that referenced this pull request Feb 13, 2026
Roll-up PR here:
#18973

This is a rebase / refactor of:
#18783

Part of a series to address issue #18782
joshualitt added a commit that referenced this pull request Feb 13, 2026
Roll-up PR here:
#18973

This is a rebase / refactor of:
#18783

Part of a series to address issue #18782
joshualitt added a commit that referenced this pull request Feb 13, 2026
Roll-up PR here:
#18973

This is a rebase / refactor of:
#18783

Part of a series to address issue #18782
joshualitt added a commit that referenced this pull request Feb 13, 2026
Roll-up PR here:
#18973

This is a rebase / refactor of:
#18783

Part of a series to address issue #18782
export const DEFAULT_FLASH_LITE_MAX_OUTPUT_CHARS = 180;
const INPUT_TRUNCATION_SUFFIX = '\n...[truncated]';

export const USER_STEERING_INSTRUCTION =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: the file is called flash-lite helper but this prompt seems rather model specific. Perhaps we should either rename the file or bifurcate this into flash specific and task specific files?

return responseText;
} catch (error) {
debugLogger.debug(
`[FlashLiteHelper] Generation failed: ${error instanceof Error ? error.message : String(error)}`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we use getErrorMessage() here?

'Classify it as ADD_TASK, MODIFY_TASK, CANCEL_TASK, or EXTRA_CONTEXT. ' +
'Apply minimal-diff changes only to affected tasks and keep unaffected tasks active. ' +
'Do not cancel/skip tasks unless the user explicitly cancels them. ' +
'Acknowledge the steering briefly and state the course correction.';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this purely for driving the UX of the feature? Have we tried or considered prompt the agent to do this in its thoughts instead?

The one thing I'd worry is that the flash model might ACK the message and then the real user model ignores it, leading to a confusing experience where GLCI says one thing and does another.

- **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
- **Comments:** Add code comments sparingly. Focus on *why* something is done, especially for complex logic, rather than *what* is done. Only add high-value comments if necessary for clarity or if requested by the user. Do not edit comments that are separate from the code you are changing. *NEVER* talk to the user or describe your changes through comments.
- **Proactiveness:** Fulfill the user's request thoroughly. When adding features or fixing bugs, this includes adding tests to ensure quality. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.${mandateConflictResolution(options.hasHierarchicalMemory)}
- **User Hints:** During execution, the user may provide real-time hints (marked as "User hint:" or "User hints:"). Treat these as high-priority but scope-preserving course corrections: apply the minimal plan change needed, keep unaffected user tasks active, and never cancel/skip tasks unless cancellation is explicit for those tasks. Hints may add new tasks, modify one or more tasks, cancel specific tasks, or provide extra context only. If scope is ambiguous, ask for clarification before dropping work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

meta q: do we ever decide features like this are not coming to older models?

modelConfig: {
model: 'gemini-2.5-flash-lite',
generateContentConfig: {
temperature: 0.2,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How did we choose the temperature value?

color: 'gray',
marginBottom: 1,
text: ackText,
} as Omit<HistoryItem, 'id'>);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there an alternative to using this cast?

Comment thread packages/cli/src/integration-tests/modelSteering.test.tsx
Comment thread evals/model_steering.eval.ts
Comment thread evals/app-test-helper.ts
joshualitt added a commit that referenced this pull request Feb 17, 2026
Roll-up PR here:
#18973

This is a rebase / refactor of:
#18783

Part of a series to address issue #18782
@joshualitt joshualitt closed this Feb 18, 2026
@sripasg sripasg added the size/xl An extra large PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. size/xl An extra large PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Experimental: support user steering hints during in-progress agent turns

3 participants