[Compatibility]: Qwen3.6-27B emits numeric diff headers inside Codex apply_patch; supported editing path?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- ollama, typescript
- Domain
- developer-experience, tooling
Research direction
Read the OpenCodex openai-chat adapter and the model-catalog/tool configuration referenced by the maintainers; the report does not name specific source files or tests. First establish whether a supported, version-matched setting or editing route exists for Qwen3.6-27B, and whether any later fix has a commit or test. Done means a documented or tested end-to-end route, or a clear statement that this combination is unverified/degraded; do not weaken validation or rewrite patches.
Written by the indexing model from the issue text.
Description
Client or integration
Codex App through OpenCodex for the earlier observations; Direct HTTP/API client to Ollama for the smaller control below.
Area
Tools / MCP / web search
Summary
Seeking a supported editing configuration, not asserting an OpenCodex transport defect.
Local Qwen produces a real exec tool call containing tools.apply_patch(...), but the patch contents are invalid for Codex's native patch format. Two earlier Codex/OpenCodex trials reached the available tool and read the synthetic file successfully, then failed on patch construction: first a numeric unified-diff header, then an extra hunk with an unprefixed source line.
A subsequent one-request direct Ollama control also produced a numeric header despite explicit bare-@@ instructions. That control bypassed OpenCodex, so it is evidence against blaming the bridge alone. It does not identify the model's underlying cause or establish that another tool interface works.
This is distinct from storage issue #6314. Related #2111 concerns missing actual tool events; our latest response contains an actual tool event and fails later, at native patch validation.
Version
Earlier bridge: portable v2.69.0, source pin 3cc34e1181926b64331490fdcfee162ffb62fe73, embedded Bun 1.4.0. The local diagnostic build only added journal diagnostics; no claim of reproduction on the newest release.
Installed Ollama: 0.34.4.
Codex CLI version saved during prior investigation: 0.159.2; not the desktop build number. A current CLI version recheck could not launch its packaged executable, and the exact current desktop build was not re-established for this report.
Operating system
macOS 15.5, Apple Silicon.
Provider and model
Ollama / qwen3.6:27b-q4_K_M, 27.8B Q4_K_M.
Model config: family qwen35, renderer/parser qwen3.5.
Current manifest SHA-256: 3a40c32f1450b8380412898385b0e00df5d6d2d801dd192ca1acb7e735cd050e.
Reproduction
Observed sequence, not a claim that stochastic generation will reproduce on every call:
- Use the already-installed Ollama 0.34.4 and model above. Start a separate loopback-only Ollama runtime with cloud disabled, context 4096, one loaded model, one parallel request, f16 KV cache and flash attention enabled. Do not change Codex's shared connection. The model's remaining saved sampling defaults are top_k=20, min_p=0 and repeat_penalty=1.
- Prepare one disposable file, represented here as
/tmp/qwen-edit-repro/total.cjs, containing exactly:module.exports = function sum(values) { return 0; }; - POST the JSON below once to that runtime's
/v1/chat/completions. This is the complete synthetic request, with only the disposable absolute path replaced for publication. No project files, private prompts or credentials are involved. - Extract the single static patch-string argument from the returned
execcall without evaluating arbitrary generated JavaScript. - Pass that patch unchanged to Codex's native
apply_patchtool, against the same disposable file. This is notgit apply. Observe rejection; do not change the header to make it pass. - Stop the runtime. No automatic retry was made and no checker was run after the rejected edit.
{
"model": "qwen3.6:27b-q4_K_M",
"stream": false,
"temperature": 0.7,
"top_p": 0.8,
"presence_penalty": 1.5,
"reasoning_effort": "none",
"max_tokens": 1024,
"messages": [
{
"role": "system",
"content": "You are performing one bounded coding edit. Use one exec tool call with JavaScript input invoking await tools.apply_patch with one static string argument. tools.apply_patch accepts a native patch string, not JSON. Native syntax begins *** Begin Patch, then *** Update File: absolute-path, then a bare @@, then lines prefixed with space for context, - for removal or + for addition, and ends *** End Patch. Do not use numeric @@ line ranges. You may use text(result) to display the result. Do not read files, run commands, call other tools or retry. All source required is supplied. Do not add unnecessary hunks."
},
{
"role": "user",
"content": "Edit only /tmp/qwen-edit-repro/total.cjs so the exported sum(values) returns the sum of finite-number arrays, including zero for an empty array. Preserve CommonJS export. Current entire file:\n```js\nmodule.exports = function sum(values) {\n return 0;\n};\n```\nReturn the exec tool call for this edit, not an explanation."
}
],
"tools": [
{
"type": "function",
"function": {
"name": "exec",
"description": "Run JavaScript using tools.apply_patch(patch: string). Supply raw JavaScript source in input. This is the JSON function representation of the Codex exec freeform tool.",
"parameters": {
"type": "object",
"properties": {
"input": {
"type": "string"
}
},
"required": [
"input"
],
"additionalProperties": false
}
}
}
],
"tool_choice": "auto"
}
Logs or error output
Runtime sampler confirmed: temperature 0.700, top_p 0.800, presence_penalty 1.500, top_k 20, min_p 0.000, repeat_penalty 1.000. Request used reasoning_effort none; response had no reasoning text.
Direct control: HTTP 200; finish_reason tool_calls; one exec function call; 513 prompt tokens, 151 completion tokens, 0 cached; 16.96 seconds including loading. No bridge in this control. Request path-only redaction may change tokenization in a reproduction.
Returned JavaScript, path-only sanitized:
await tools.apply_patch(`*** Begin Patch
*** Update File: /tmp/qwen-edit-repro/total.cjs
@@ -1,4 +1,8 @@
module.exports = function sum(values) {
- return 0;
+ if (!Array.isArray(values)) throw new TypeError('Expected an array');
+ let total = 0;
+ for (const v of values) { if (Number.isFinite(v)) total += v; }
+ return total;
};
*** End Patch`);
Native rejection, path-only sanitized:
apply_patch verification failed: Failed to find context '-1,4 +1,8 @@' in /tmp/qwen-edit-repro/total.cjs
The target file was unchanged. This is not a missing-tool or provider-unreachable result.
Redacted configuration
Earlier Codex route: Responses through OpenCodex's openai-chat adapter to loopback Ollama; reasoning none -> none; retry controls disabled. No secrets or native-account configuration are needed for the direct control above.
Changing to a small context AND explicit sampling means this is not a controlled causal comparison of sampling alone. Full-chat input overhead is separate and is not claimed fixed.
Questions for maintainers
- Is this known for this Qwen model and Code Mode's nested apply_patch contract? Is there a documented, version-matched model-catalog/tool setting or tested example that fixes native edit formatting?
- Is there a supported alternative editing interface for this model while keeping Codex desktop chats, normal approval controls and loop workflow? Please distinguish real end-to-end evidence from schema/transport support.
- Is a relevant fix already in a later release, with a specific commit/test, or should this route be treated as degraded? We do not want to weaken patch validation, silently rewrite model output, patch Codex's application bundle, or run another expensive trial without a concrete hypothesis.
Checks
- I searched existing issues and documentation, including #2111 and Ollama issue 16383; neither is treated as the same failure.
- I removed secrets, tokens, account details, request credentials and personal data.
- Evidence uses synthetic code and a substituted disposable path only.
- No claim that the latest stable release was tested.
Additional Direct-Tool Control (2026-10-02)
One further isolated synthetic response used the same installed model, local Ollama version, coding task, context and sampling, but advertised a direct apply_patch function with an input string instead of exec containing JavaScript. It bypassed OpenCodex, so it is NOT an end-to-end test of codexToolMode shell in the desktop and cannot establish bridge fault.
The model returned one direct apply_patch tool call successfully, but the native patch again contained a numbered hunk header, @@ -1,4 +1,9 @@. Unmodified native application failed: Failed to find context '-1,4 +1,9 @@'. The disposable target remained unchanged and the code checker was not run. No patch correction or fallback write was used.
One inference, zero retries, 17.125 seconds including loading; 499 input and 158 output tokens (657 total). The isolated runtime was stopped. A preceding sandbox memory-check failure sent zero inference requests; the single response ran only after execution approval with memory protection retained.
Does a supported direct-tool/native-editing route address this grammar mismatch for Qwen3.6-27B, or is this model/tool combination currently unverified? We are not requesting relaxed validation or automatic rewriting of generated patches.
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.3k
- Avg merge
- 9h 39m
- Merged PRs (30d)
- 633
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lidge-jun/opencodex
-
catalog enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lidge-jun/opencodex#7704 · 1 comment ·
Maintainers usually reply within 1 day
-
bug streaming
Difficulty 4/5 3-5 days Newbie friendliness 35/100
lidge-jun/opencodex#7720 · 2 comments ·
Maintainers usually reply within 1 day
-
bug gui platform
Difficulty 4/5 3-5 days Newbie friendliness 45/100
lidge-jun/opencodex#7716 · 1 comment ·
Maintainers usually reply within 1 day
-
account-pool provider provider-compatibility
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
catalog enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
lidge-jun/opencodex#7705 · 1 comment ·
Maintainers usually reply within 1 day
All issues in lidge-jun/opencodex
Similar issues
-
freshness freshness:observed-only
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
thoroc/context-radar#282 ·
-
bug P2 rust
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area: web
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
gabe-santana/arkdraw#25 ·
-
bug require-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
expressjs/expressjs.com#2549 · 1 reaction ·
Maintainers usually reply within 1 day
-
bug good first issue hacktoberfest
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
codercops/discord-bot#101 · 1 comment ·
Maintainers usually reply within 1 day