Skip to content

Keep oversized write_file generation recoverable - #795

Draft
Y1fe1Zh0u wants to merge 1 commit into
dataelement:mainfrom
Y1fe1Zh0u:fix/qwen-write-file-truncation
Draft

Keep oversized write_file generation recoverable#795
Y1fe1Zh0u wants to merge 1 commit into
dataelement:mainfrom
Y1fe1Zh0u:fix/qwen-write-file-truncation

Conversation

@Y1fe1Zh0u

Copy link
Copy Markdown
Collaborator

What changed

  • Limit each write_file content payload to 6000 characters in both the model schema and server-side execution.
  • Add an explicit overwrite/append mode so long HTML, CSS, JavaScript, and Markdown can be generated across sequential tool turns.
  • Preserve workspace version checks while appending and record the complete before/after revision.
  • Strengthen the existing bounded repair prompt from Retry truncated write_file calls before failing runs #771 so a truncated call retries with one small first chunk and continues with append only after success.

Root cause

Large generated files can be truncated inside provider function.arguments before JSON parsing and before write_file executes. Retrying the same whole-file payload repeats the transport failure.

User impact

Long generated files can make bounded forward progress through small native tool calls instead of repeatedly ending in model_tool_protocol_violation. Oversized or invalid calls fail before mutating workspace data.

Validation

Known gaps

Related: #771 #793

Bound write_file payloads to 6000 characters and expose an explicit overwrite/append contract so models recover from truncated tool arguments with small sequential writes. Preserve the existing write_file-specific retry identity and optimistic workspace concurrency while appending.

Constraint: Provider tool arguments can truncate before JSON parsing or tool execution

Rejected: Retry the same oversized whole-file call | repeats the transport failure without progress

Confidence: high

Scope-risk: moderate

Reversibility: clean

Directive: Keep each append call independently bounded and preserve workspace version checks

Tested: 128 focused backend tests; scoped Ruff; git diff --check

Not-tested: Real Qwen 3.6 Plus provider run; full backend suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant