Skip to content

feat(agent): auto-enable GLM-4.7 thinking mode - #443

Closed
mneves75 wants to merge 1 commit into
openclaw:mainfrom
mneves75:feat/glm-4.7-thinking-mode
Closed

mneves75 wants to merge 1 commit into
openclaw:mainfrom
mneves75:feat/glm-4.7-thinking-mode

Conversation

@mneves75

@mneves75 mneves75 commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Auto-enables thinking mode for Z.AI GLM-4.x models via the Cloud API format
  • GLM-4.7: Preserved thinking (clear_thinking: false) - reasoning kept across turns
  • GLM-4.5/4.6: Interleaved thinking (clear_thinking: true) - reasoning cleared each turn
  • Respects user's --thinking off flag to disable auto-enable
  • Users can override via config: agent.models["zai/glm-4.7"].params.thinking

Changes

File Change
src/agents/pi-embedded-runner.ts Added resolveExtraParams() function
src/agents/pi-embedded-runner-extraparams.test.ts 23 test cases
src/config/types.ts Added params field to model config
src/config/zod-schema.ts Added params validation
patches/@mariozechner__pi-ai.patch Pass extraParams through stream pipeline
patches/@mariozechner__pi-agent-core.patch Agent class extraParams support
patches/@mariozechner__pi-coding-agent.patch createAgentSession extraParams support

Technical Details

Uses Z.AI Cloud API format verified from docs:

{ "thinking": { "type": "enabled", "clear_thinking": false } }

Architecture:

Config → resolveExtraParams() → createAgentSession() → Agent → streamSimple() → buildParams() → Z.AI API

Test plan

  • 23 unit tests covering all scenarios (GLM-4.5/4.6/4.7, config overrides, edge cases, thinkLevel)
  • Lint passes (702 files, 0 warnings)
  • Build passes (TypeScript)
  • All 1565 tests pass

🤖 Generated with Claude Code

Add automatic thinking mode support for Z.AI GLM-4.x models:
- GLM-4.7: Preserved thinking (clear_thinking: false)
- GLM-4.5/4.6: Interleaved thinking (clear_thinking: true)

Uses Z.AI Cloud API format: thinking: { type: "enabled", clear_thinking: boolean }

Includes patches for pi-ai, pi-agent-core, and pi-coding-agent to pass
extraParams through the stream pipeline. User can override via config
or disable via --thinking off.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@steipete steipete self-assigned this Jan 8, 2026
@steipete

steipete commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Landed on main via rebase onto main, added docs + changelog, ran pnpm lint/build/test. Commits: f7b3219 (feature), 857a14b (docs/changelog).

@steipete steipete closed this Jan 8, 2026
heatherstew44-maker pushed a commit to heatherstew44-maker/openclaw that referenced this pull request Mar 8, 2026
…openclaw#443)

* fix: prevent model auto-switch from interrupting active transcription

when a model download completes during an active recording/transcription,
the app now skips auto-switching to prevent data loss.

adds is_recording tauri command to check recording state before
auto-switching models on download or extraction completion.

fixes openclaw#418

* Update bindings.ts

---------

Co-authored-by: CJ Pais <[email protected]>
Fato07 pushed a commit to Fato07/elav that referenced this pull request Mar 26, 2026
…tributing-todo

docs: remove obsolete TODO for CONTRIBUTING.md
cryptolir pushed a commit to cryptolir/openclaw that referenced this pull request Sep 30, 2026
…wn docker.env

Compose fills ${NAME} from the shell that runs it before --env-file, so a
recreate from a shell with exported keys hands an agent a key it was never
given (dashboard plan agent-keys-own-file-only, HK3).

- D4: for every gateway container, openclaw or hermes, in any state, Compose
  renders the agent's own docker.env with an empty environment and every
  non-empty container value must equal the render. P1 if the file is not newer
  than the container, P2 'restart pending' if it is. Names only. It prints how
  many containers it compared.
- The hand-run fix lines use env -i.
- D3 accepts ANTHROPIC_API_KEY (in GLOBAL_KEYS since dashboard openclaw#443) without
  requiring it.
- provision-agent.sh reads its four Core APIs from the Global Host, not from
  a sibling agent's file, which may hold that agent's own key.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
cryptolir added a commit to cryptolir/openclaw that referenced this pull request Sep 30, 2026
…wn docker.env (#177)

* fix(ops): the daily scan checks every container value came from its own docker.env

Compose fills ${NAME} from the shell that runs it before --env-file, so a
recreate from a shell with exported keys hands an agent a key it was never
given (dashboard plan agent-keys-own-file-only, HK3).

- D4: for every gateway container, openclaw or hermes, in any state, Compose
  renders the agent's own docker.env with an empty environment and every
  non-empty container value must equal the render. P1 if the file is not newer
  than the container, P2 'restart pending' if it is. Names only. It prints how
  many containers it compared.
- The hand-run fix lines use env -i.
- D3 accepts ANTHROPIC_API_KEY (in GLOBAL_KEYS since dashboard openclaw#443) without
  requiring it.
- provision-agent.sh reads its four Core APIs from the Global Host, not from
  a sibling agent's file, which may hold that agent's own key.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* fix(ops): fold the code review of the env source check

One finding per container that cannot be compared, never a crash for the whole
host; a docker that does not answer is not a pass; only non-empty container
values are compared (a line added to the Compose file after a container was
made is not the agent losing a key); no file-date rule, which filed a real
leak as 'restart pending' whenever provisioning touched the file after the
recreate. The test runs in workflow-sanity. provision-agent.sh stops if the
Global Host file is missing.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* docs(status): claim fix/diagnostic-env-source (#177)

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* docs(status): format the table

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Liran Peretz <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
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.

2 participants