openclaw - ✅(Solved) Fix [GPT 5.4 v3 — PR 6/6] Add Google Gemini execution guidance via prompt overlay [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#66352Fetched 2026-04-15 06:26:26
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
cross-referenced ×3referenced ×1

Fix Action

Fixed

PR fix notes

PR #66373: feat(agents): add tool_enforcement as first-class provider prompt section [v3 3/6]

Description (problem / solution / changelog)

GPT 5.4 Enhancement v3 — PR 3/6

Tracking: #66345 | Issue: #66348 Priority: P1 — MEDIUM | Type: Architecture

Problem

PR 1 (#66371) adds mandatory tool-use categories for GPT-5 via stablePrefix. This works but conflates two concerns:

  • execution_bias: how the agent executes (act first, don't plan)
  • tool_enforcement: when it must use tools (mandatory categories)

Providers should be able to override these independently.

Changes

  ┌─────────────────────────────────────────────────────────┐
  │        System Prompt Section Pipeline                    │
  │                                                          │
  │  ┌──────────────────┐  ┌──────────────────┐             │
  │  │ interaction_style │  │ tool_call_style   │             │
  │  │ (personality)     │  │ (narration rules) │             │
  │  └──────────────────┘  └──────────────────┘             │
  │                                                          │
  │  ┌──────────────────┐  ┌──────────────────┐             │
  │  │ execution_bias    │  │ tool_enforcement  │  ← NEW     │
  │  │ (act first,       │  │ (mandatory tool   │             │
  │  │  don't plan)      │  │  categories)      │             │
  │  └──────────────────┘  └──────────────────┘             │
  │                                                          │
  │  Each: provider overrides via sectionOverrides,          │
  │  or falls back to default                                │
  └─────────────────────────────────────────────────────────┘

4 files changed:

  1. src/agents/system-prompt-contribution.ts — Add "tool_enforcement" to ProviderSystemPromptSectionId union
  2. src/agents/system-prompt.ts — Add buildOverridablePromptSection call for tool_enforcement (after execution_bias, before stablePrefix)
  3. extensions/openai/prompt-overlay.ts — Add OPENAI_GPT5_TOOL_ENFORCEMENT constant, wire into sectionOverrides.tool_enforcement
  4. extensions/openai/index.test.ts — Update all 7 contribution assertions to include tool_enforcement in sectionOverrides, factor the shared stablePrefix expectation into an EXPECTED_GPT5_STABLE_PREFIX helper constant

Benefits

  • Separation of concerns: execution bias and tool enforcement are distinct prompt sections
  • Provider extensibility: Google Gemini (PR 6, #66379) uses tool_enforcement for its own operational directives
  • Testability: each section can be tested independently
  • Default empty: providers that don't need tool enforcement get an empty section (zero noise)

Changed files

  • extensions/openai/index.test.ts (modified, +25/-7)
  • extensions/openai/prompt-overlay.ts (modified, +25/-0)
  • src/agents/system-prompt-contribution.ts (modified, +2/-1)
  • src/agents/system-prompt.ts (modified, +4/-0)

PR #66379: feat(google): add Gemini execution guidance via prompt overlay [v3 6/6]

Description (problem / solution / changelog)

GPT 5.4 Enhancement v3 — PR 6/6

Tracking: #66345 | Issue: #66352 Priority: P2 — LOW | Type: Provider Support

Problem

Hermes Agent includes Gemini/Gemma-specific operational guidance that addresses known failure modes. OpenClaw's Google extension has no prompt overlay — Gemini models get only the generic execution bias. This was filed as part of the same v3 for GPT 5.4 given the 0/10 parity scoring gap for Gemini.

Changes

New: extensions/google/prompt-overlay.ts

  • GOOGLE_GEMINI_EXECUTION_GUIDANCE — 7 operational directives:
    • Absolute paths for all file operations
    • Verify-first: check file contents before modifying
    • Dependency checks: verify package availability
    • Conciseness: brief explanations, focus on actions
    • Parallel tool calls: batch independent operations
    • Non-interactive commands: use -y/--yes flags
    • Keep going: work autonomously until done
  • resolveGoogleSystemPromptContribution() → returns guidance via sectionOverrides.tool_enforcement

Modified: extensions/google/provider-registration.ts

  • Wire resolveSystemPromptContribution into Google provider

Modified: src/agents/system-prompt-contribution.ts + src/agents/system-prompt.ts

  • Add tool_enforcement section ID (shared with PR 3)

Architecture

  ┌────────────────────────────────────────────────────┐
  │  Provider Prompt Overlay Pattern                    │
  │                                                     │
  │  extensions/openai/prompt-overlay.ts  (existing)    │
  │  ├── GPT-5 execution bias                           │
  │  ├── GPT-5 tool enforcement                         │
  │  ├── GPT-5 output contract                          │
  │  └── Friendly personality overlay                   │
  │                                                     │
  │  extensions/google/prompt-overlay.ts  (this PR)     │
  │  └── Gemini operational directives                  │
  │      (absolute paths, verify first, parallel calls) │
  │                                                     │
  │  Both use: sectionOverrides.tool_enforcement        │
  └────────────────────────────────────────────────────┘

Hermes Reference

agent/prompt_builder.py lines 256-276 — GOOGLE_MODEL_OPERATIONAL_GUIDANCE.

Verification

  • Gemini models receive operational directives in system prompt
  • Non-Google models don't receive Gemini directives
  • File-manipulation tasks use absolute paths

Changed files

  • extensions/google/gemini-cli-provider.ts (modified, +6/-0)
  • extensions/google/prompt-overlay.ts (added, +53/-0)
  • extensions/google/provider-registration.ts (modified, +6/-0)
  • src/agents/system-prompt-contribution.ts (modified, +2/-1)
  • src/agents/system-prompt.ts (modified, +4/-0)

Code Example

GOOGLE_MODEL_OPERATIONAL_GUIDANCE = (
    "# Google model operational directives\n"
    "Follow these operational rules strictly:\n"
    "- **Absolute paths:** Always construct and use absolute file paths...\n"
    "- **Verify first:** Use read_file/search_files to check file contents...\n"
    "- **Dependency checks:** Never assume a library is available...\n"
    "- **Conciseness:** Keep explanatory text brief...\n"
    "- **Parallel tool calls:** When you need to perform multiple independent "
    "operations, make all the tool calls in a single response...\n"
    "- **Non-interactive commands:** Use flags like -y, --yes, --non-interactive...\n"
    "- **Keep going:** Work autonomously until the task is fully resolved...\n"
)

---

export const GOOGLE_GEMINI_EXECUTION_GUIDANCE = `## Gemini Operational Directives

Follow these operational rules strictly:
- **Absolute paths:** Always construct and use absolute file paths for all file system operations.
- **Verify first:** Use read or search tools to check file contents and project structure before making changes.
- **Dependency checks:** Never assume a library is available. Check package.json, requirements.txt, etc.
- **Parallel tool calls:** When performing multiple independent operations, make all tool calls in a single response.
- **Non-interactive commands:** Use flags like -y, --yes, --non-interactive to prevent CLI tools from hanging.
- **Keep going:** Work autonomously until the task is fully resolved.`;

export function resolveGoogleSystemPromptContribution(params) {
  // Returns { sectionOverrides: { tool_enforcement: GOOGLE_GEMINI_EXECUTION_GUIDANCE } }
  // Only for Google provider IDs
}

---

import { resolveGoogleSystemPromptContribution } from "./prompt-overlay.js";

// In registerGoogleProvider:
api.registerProvider({
  ...existingConfig,
  resolveSystemPromptContribution: (ctx) =>
    resolveGoogleSystemPromptContribution({
      modelProviderId: "google",
      modelId: ctx.modelId,
    }),
});

---

┌─────────────────────────────────────────────────────┐
Provider Prompt Overlay Pattern  │                                                      │
  │  extensions/openai/prompt-overlay.ts  (exists)  │  ├── GPT-5 execution bias                            │
  │  ├── GPT-5 tool enforcement                          │
  │  ├── GPT-5 output contract                           │
  │  └── Friendly personality overlay                    │
  │                                                      │
  │  extensions/google/prompt-overlay.ts  (NEW)  │  └── Gemini operational directives                   │
        (absolute paths, verify first, parallel calls)  │                                                      │
Both use: sectionOverrides.tool_enforcementfrom PR 3's first-class section  └─────────────────────────────────────────────────────┘
RAW_BUFFERClick to expand / collapse

Parent: #66345 — GPT 5.4 Enhancement v3: Hermes Parity Sprint

Priority: P2 — LOW Type: Feature / Provider Support

Problem

Hermes Agent includes Gemini/Gemma-specific operational guidance (GOOGLE_MODEL_OPERATIONAL_GUIDANCE in prompt_builder.py lines 256-276) that addresses known Gemini failure modes: relative paths, missing dependency checks, interactive CLI prompts hanging, and sequential-when-parallel tool calls.

OpenClaw's Google extension (extensions/google/) has no prompt-overlay.ts and doesn't use resolveSystemPromptContribution. Gemini models on OpenClaw get the generic execution bias only.

Hermes Reference

GOOGLE_MODEL_OPERATIONAL_GUIDANCE = (
    "# Google model operational directives\n"
    "Follow these operational rules strictly:\n"
    "- **Absolute paths:** Always construct and use absolute file paths...\n"
    "- **Verify first:** Use read_file/search_files to check file contents...\n"
    "- **Dependency checks:** Never assume a library is available...\n"
    "- **Conciseness:** Keep explanatory text brief...\n"
    "- **Parallel tool calls:** When you need to perform multiple independent "
    "operations, make all the tool calls in a single response...\n"
    "- **Non-interactive commands:** Use flags like -y, --yes, --non-interactive...\n"
    "- **Keep going:** Work autonomously until the task is fully resolved...\n"
)

Proposed Implementation

New File: extensions/google/prompt-overlay.ts

export const GOOGLE_GEMINI_EXECUTION_GUIDANCE = `## Gemini Operational Directives

Follow these operational rules strictly:
- **Absolute paths:** Always construct and use absolute file paths for all file system operations.
- **Verify first:** Use read or search tools to check file contents and project structure before making changes.
- **Dependency checks:** Never assume a library is available. Check package.json, requirements.txt, etc.
- **Parallel tool calls:** When performing multiple independent operations, make all tool calls in a single response.
- **Non-interactive commands:** Use flags like -y, --yes, --non-interactive to prevent CLI tools from hanging.
- **Keep going:** Work autonomously until the task is fully resolved.`;

export function resolveGoogleSystemPromptContribution(params) {
  // Returns { sectionOverrides: { tool_enforcement: GOOGLE_GEMINI_EXECUTION_GUIDANCE } }
  // Only for Google provider IDs
}

File: extensions/google/provider-registration.ts

Wire resolveSystemPromptContribution into the provider:

import { resolveGoogleSystemPromptContribution } from "./prompt-overlay.js";

// In registerGoogleProvider:
api.registerProvider({
  ...existingConfig,
  resolveSystemPromptContribution: (ctx) =>
    resolveGoogleSystemPromptContribution({
      modelProviderId: "google",
      modelId: ctx.modelId,
    }),
});

Architecture

  ┌─────────────────────────────────────────────────────┐
  │  Provider Prompt Overlay Pattern                     │
  │                                                      │
  │  extensions/openai/prompt-overlay.ts  (exists)       │
  │  ├── GPT-5 execution bias                            │
  │  ├── GPT-5 tool enforcement                          │
  │  ├── GPT-5 output contract                           │
  │  └── Friendly personality overlay                    │
  │                                                      │
  │  extensions/google/prompt-overlay.ts  (NEW)          │
  │  └── Gemini operational directives                   │
  │      (absolute paths, verify first, parallel calls)  │
  │                                                      │
  │  Both use: sectionOverrides.tool_enforcement         │
  │  from PR 3's first-class section                     │
  └─────────────────────────────────────────────────────┘

Dependencies

  • PR 3 (#66348): Requires tool_enforcement section ID to exist in ProviderSystemPromptSectionId

Verification

  • Test: Gemini models receive operational directives in system prompt
  • Test: Non-Google models don't receive Gemini directives
  • Manual: Run Gemini on a file-manipulation task, verify it uses absolute paths

extent analysis

TL;DR

To fix the issue, create a new file prompt-overlay.ts in the extensions/google directory and implement the resolveGoogleSystemPromptContribution function to provide Gemini operational directives.

Guidance

  • Create a new file extensions/google/prompt-overlay.ts with the proposed implementation to provide Gemini operational directives.
  • Wire the resolveGoogleSystemPromptContribution function into the Google provider in extensions/google/provider-registration.ts.
  • Verify that Gemini models receive the operational directives in the system prompt and that non-Google models do not.
  • Test the implementation by running Gemini on a file-manipulation task and verifying that it uses absolute paths.

Example

// extensions/google/prompt-overlay.ts
export const GOOGLE_GEMINI_EXECUTION_GUIDANCE = `## Gemini Operational Directives
...
`;

export function resolveGoogleSystemPromptContribution(params) {
  // Returns { sectionOverrides: { tool_enforcement: GOOGLE_GEMINI_EXECUTION_GUIDANCE } }
  // Only for Google provider IDs
}

Notes

The implementation requires PR 3 (#66348) to exist, which introduces the tool_enforcement section ID. The proposed solution assumes that the ProviderSystemPromptSectionId has been updated to include the tool_enforcement section.

Recommendation

Apply the proposed workaround by creating the prompt-overlay.ts file and implementing the resolveGoogleSystemPromptContribution function. This will provide Gemini operational directives to Google models and ensure that they follow the required operational rules.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING