Skip to content

prompt/tool mismatch: gpt-6-astra preset demands apply_patch for prefixed ids (codex/gpt-6-astra) but tool gate returns wireMode none - editing deadlocks #1891

Description

@brianmok888

Summary

Two senpi built-ins disagree about how to match GPT model ids, which can deadlock editing on gateway-prefixed ids.

  • The prompt-preset resolver recognizes prefixed ids like codex/gpt-6-astra (boundary-aware regex), selects the gpt-6-astra preset, and injects: "Use apply_patch for ALL file edits and creations."
  • The gpt-apply-patch tool gate uses a literal prefix check model.id.startsWith("gpt-"), so the same prefixed id gets wireMode: "none" → the tool is registered but never activated, and lazy activation is refused.

Result: the generated developer instructions exclusively require a tool that the runtime reports as Tool apply_patch is registered but inactive — sessions refuse to edit via write/edit and stall.

Environment

  • @code-yeongyu/senpi 2026.9.19-2 (bun global install)
  • Provider: OpenAI-compatible gateway exposing codex/gpt-6-astra with api: "openai-completions"
  • Baseline session model glm/glm-5.3, switched mid-session to codex/gpt-6-astra
  • promptPreset: "auto"

Repro

Runtime repro against installed resolvePreset / getApplyPatchWireMode (selected tools read, edit, write):

Model ID API Selected preset Contains patch-only instruction Patch wire mode
glm/glm-5.3 openai-completions glm-5.3 No none
codex/gpt-6-astra openai-completions gpt-6-astra Yes none
gpt-6-astra openai-completions gpt-6-astra Yes json

Extension-API mock (session_start with GLM → model_select with the prefixed astra id):

Registered:      apply_patch
Active:          read, edit, write
Lazy activation: false

Live symptom: calling the tool raises Tool apply_patch is registered but inactive. Active tools: read, edit, write, ...

Source references (installed 2026.9.19-2)

  • dist/core/extensions/builtin/prompt-preset/presets.js:36-40 — boundary-aware hasGpt6AstraSignal regex; :213-214 selects the preset
  • dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js:259 — calls buildFileOperationsTuning()
  • dist/core/extensions/builtin/prompt-preset/file-operations.js:23 — "Use apply_patch for ALL file edits and creations."
  • dist/core/extensions/builtin/gpt-apply-patch/extension.js:9-20isGptId literal startsWith("gpt-"); :75-84 refuses lazy activation when wireMode === "none"
  • dist/core/agent-session.js:2223-2225 — emits inactive_tool / "registered but inactive"

Suggested direction

  1. Make the two matchers consistent (e.g. boundary-aware isGptId, mirroring the preset matcher, for prefixed gateway ids).
  2. Or make the file-operations tuning conditional on the tool actually being activatable for the current model+API.
  3. Preserve correct patch serialization for the selected API; merely force-enabling a registered variant does not establish correct format selection.
  4. Add regression coverage: bare vs prefixed GPT ids, supported vs unsupported APIs, non-GPT models, model switches in both directions.
  5. Assert the integration contract: a generated prompt must not exclusively require apply_patch when it is inactive and edit/write are the available editing surface.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions