Skip to content

fix: enable thinking for zhipuai-coding-plan & prevent Korean IME truncation#22041

Merged
rekram1-node merged 5 commits intoanomalyco:devfrom
claudianus:fix-zhipuai-coding-plan-thinking
Apr 11, 2026
Merged

fix: enable thinking for zhipuai-coding-plan & prevent Korean IME truncation#22041
rekram1-node merged 5 commits intoanomalyco:devfrom
claudianus:fix-zhipuai-coding-plan-thinking

Conversation

@claudianus
Copy link
Copy Markdown
Contributor

@claudianus claudianus commented Apr 11, 2026

Issue for this PR

Closes #22042
Related: #8652, #14371

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Two fixes:

1. Enable thinking for zhipuai-coding-plan provider

When using the Z.AI Coding Plan (zhipuai-coding-plan provider) with reasoning models like GLM-5.1, the agent returns empty responses because the thinking configuration is not being properly applied in the provider transform logic. This PR uses some((id) => input.model.providerID.includes(id)) instead of strict includes so any provider ID containing "zai" or "zhipuai" gets the thinking config.

2. Prevent Korean IME last character truncation on submit

When typing Korean (hangul) in Kitty and other terminals, pressing Enter to submit truncates the last composed character. The onSubmit handler fires synchronously before the IME composition commit flushes to plainText.

Fix: double-defer the submit call via setTimeout(() => setTimeout(() => submit(), 0), 0) to give the event loop enough ticks for the IME composition to commit. Adds ~0-2ms latency to submit, imperceptible to users.

How did you verify your code works?

  • bun typecheck passes
  • Unit tests pass (bun run test)
  • Built and installed locally — Korean input in Kitty no longer truncates last character
  • zhipuai-coding-plan thinking config works with GLM-5.1

Screenshots / recordings

N/A (terminal behavior)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

rekram1-node and others added 2 commits April 11, 2026 13:55
Double-defer onSubmit with nested setTimeout to ensure the last
composed character (e.g. Korean hangul) is flushed to plainText
before submission. A single setTimeout(0) is insufficient because
the EditBuffer content change callback may not have fired yet.
@claudianus claudianus changed the title fix: enable thinking for zhipuai-coding-plan provider fix: enable thinking for zhipuai-coding-plan & prevent Korean IME truncation Apr 11, 2026
claudianus and others added 2 commits April 12, 2026 04:51
The double-defer workaround in onSubmit may fire before onContentChange

flushes the last IME-composed character to the store. Read input.plainText

directly and sync both the store and extmark positions before any

downstream reads in submit().

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@rekram1-node rekram1-node merged commit 63035f9 into anomalyco:dev Apr 11, 2026
6 of 8 checks passed
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.

Bug: Z.AI Coding Plan models return empty responses

2 participants