Skip to content

feat: drop legacy chat-template-pass-through kwargs (clear_thinking, preserve_thinking)#6

Merged
hallerite merged 2 commits intomainfrom
feat/drop-clear-thinking
May 7, 2026
Merged

feat: drop legacy chat-template-pass-through kwargs (clear_thinking, preserve_thinking)#6
hallerite merged 2 commits intomainfrom
feat/drop-clear-thinking

Conversation

@hallerite
Copy link
Copy Markdown
Member

Summary

`GLM5Renderer.init` no longer accepts `clear_thinking`, and `Qwen36Renderer.init` no longer accepts `preserve_thinking`. Both were chat-template-kwarg pass-throughs whose default values are now baked straight into the renderer.

Why

These kwargs hung over from when each renderer mirrored the model's Jinja chat-template signature kwarg-for-kwarg. The renderer-agnostic override layer landed in #3 / #5 (`preserve_all_thinking`, `preserve_thinking_between_tool_calls` — constructor-only attributes since #5) subsumes both, and they were the only "non-default" kwarg that the chat-template-pass-through ever needed:

Legacy kwarg Same as
`clear_thinking=False` (GLM-5) `preserve_all_thinking=True`
`preserve_thinking=True` (Qwen3.6) `preserve_all_thinking=True`

Their default values are kept by baking the chat-template behaviour straight in:

  • GLM-5: drop `` on past-cycle assistants, keep on in-flight cycle and trailing assistant. (What `clear_thinking=True` did before.) The render gate is now `msg_idx > last_user_index or preserve_thinking` — clean and consistent with the rest of the GLM/Qwen family.
  • Qwen3.6: identical to Qwen3.5 (`msg_idx > last_query_index` via the inherited `_should_render_thinking`). The class shrinks to just the `_render_arg_value` override, which is the only real template delta vs Qwen3.5.

Changes

  • `renderers/glm5.py`: drop `clear_thinking` constructor kwarg; bake the `True` semantics into the assistant-render gate.
  • `renderers/qwen36.py`: drop `preserve_thinking` constructor kwarg and the `_should_render_thinking` override (which existed only to consult `_preserve_thinking`). Class shrinks to `_render_arg_value` only. Module docstring rewritten to call out the simplification.
  • `tests/test_preserve_thinking.py`: two new regression tests pinning that the legacy kwargs raise `TypeError` if anyone tries to pass them.
  • README: untouched — §1 Preserving past reasoning (constructor-only overrides) (added in feat: bind preserve_*_thinking at construction (drop _bind_preserve_defaults) #5) already motivates the override path; §3.d already cross-links to it for compaction.
  • Bump 0.1.9 → 0.1.10.

Test plan

  • `pytest tests/` — 895 passed, 48 skipped, 1 xfailed locally (no parity regressions; +2 tests are the new regressions).
  • No verifiers / prime-rl downstream impact: neither package ever passed `clear_thinking` or `preserve_thinking` to any renderer constructor — verified by grep.
  • Pre-commit / ruff format clean.

🤖 Generated with Claude Code

hallerite and others added 2 commits May 7, 2026 13:46
``GLM5Renderer.__init__`` no longer accepts ``clear_thinking``, and
``Qwen36Renderer.__init__`` no longer accepts ``preserve_thinking``.
Both were chat-template-kwarg pass-throughs whose default values are
now baked straight into the renderer:

- GLM-5 default: drop ``<think>`` on past-cycle assistants, keep on
  in-flight cycle and trailing assistant. (What ``clear_thinking=True``
  did before.) The render gate is now ``msg_idx > last_user_index or
  preserve_thinking`` — clean and consistent with the rest of the
  family.
- Qwen3.6 default: identical to Qwen3.5 (``msg_idx > last_query_index``
  via the inherited ``_should_render_thinking``). The class shrinks to
  just the ``_render_arg_value`` override, which is the only real
  template delta vs Qwen3.5.

Callers who want the toggled-on behaviour pass
``preserve_all_thinking=True`` to ``create_renderer`` — the
renderer-agnostic spelling of the same intent landed in #3/#5. Two
regression tests pin the dropped kwargs (constructor must raise
``TypeError`` when either is passed).

The README's §1 "Preserving past reasoning" subsection (added in #5)
already motivates the override flags; no new prose needed here. §3.d
is unchanged (still cross-links to the override flag for compaction).

Bump 0.1.9 → 0.1.10. 895 tests pass locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PyPI's latest published renderers is 0.1.5 — the in-tree bumps in #3#5 → this PR (0.1.6 → 0.1.7 → 0.1.8 → 0.1.9 → 0.1.10) accumulated
against PyPI without ever publishing. Roll forward to 0.1.6 once for
the actual release; tag ``renderers-v0.1.6`` post-merge to fire the
publish workflow (.github/workflows/publish.yml asserts the tag's
``-vX.Y.Z`` suffix matches pyproject.toml).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hallerite hallerite merged commit 25546ee into main May 7, 2026
6 checks passed
@hallerite hallerite deleted the feat/drop-clear-thinking branch May 7, 2026 14:12
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