Skip to content

plan.txt triggers Azure OpenAI content filter #17968

@intelljames

Description

@intelljames

Problem

The default plan agent prompt in packages/opencode/src/session/prompt/plan.txt triggers Azure OpenAI's content safety policy filter.

The specific phrase that triggers the filter is:

Plan mode ACTIVE - you are in READ-ONLY phase

After testing, the combination of ACTIVE. You are in (uppercase ACTIVE followed by "You are in") causes Azure OpenAI to reject the request with:

{"error":{"message":"The response was filtered due to the prompt triggering Azure OpenAI's content management policy.","type":"invalid_request_error","code":"content_filter"}}

Test Results

Content Result
ACTIVE. You are in ❌ content_filter
active. You are in (lowercase) ✅ passes
ACTIVE. You are currently in ✅ passes
Plan mode is active. You are currently in ✅ passes

Suggested Fix

Either:

  1. Change the wording in plan.txt from:

    CRITICAL: Plan mode ACTIVE - you are in READ-ONLY phase.
    

    to:

    CRITICAL: Plan mode is active. You are currently in READ-ONLY phase.
    
  2. Make the plan prompt configurable via opencode.json:

    {
      "agent": {
        "plan": {
          "prompt": "custom plan prompt..."
        }
      }
    }

Currently, the plan prompt is hardcoded and injected directly in session/prompt.ts, ignoring the agent.plan.prompt config option.

Impact

This prevents users using Azure OpenAI (or similar providers with content safety policies) from using the plan agent.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions