Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- **A slow plain-English rewrite no longer hides the reply.** Claude Code
cancels a `MessageDisplay` hook after 10 seconds whatever `hooks.json` asks
for, and then shows only the last chunk's original text. The rewrite waited
up to 20 seconds for Cerebras after up to 2 seconds of chunk assembly, so a
long reply lost everything but its last chunk. The rewrite now gives up
after 6 seconds and shows the whole original reply, and `hooks.json`
registers `MessageDisplay` with the 10-second timeout Claude Code enforces.
- **The plain-English rewrite answers in about half a second.** Cerebras'
`qwen-3.8-27b` reasons by default, and on a 2,300-character reply it spent
a median 6,300 reasoning tokens for about 520 output tokens. That made a
rewrite take 4.4s at p50, and 3 of 20 hit the 6-second cap and showed the
original. The rewrite now sends `reasoning_effort: "none"` through spawnllm
0.14.0's `OpenAiEndpointBackend`, which brings the same 20 rewrites to
0.52s at p50 and 0.98s at p95 with none falling back.

## [12.56.0] - 2026-09-24

### Added
Expand Down Expand Up @@ -63,13 +80,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`additionalContext` envelope a warn rendered failed schema validation. A warn,
context, or allow message now prints as plain text, and a block renders
`{"decision": "block"}`, which cancels the compaction.
- **A slow plain-English rewrite no longer hides the reply.** Claude Code
cancels a `MessageDisplay` hook after 10 seconds whatever `hooks.json` asks
for, and then shows only the last chunk's original text. The rewrite waited
up to 20 seconds for Cerebras after up to 2 seconds of chunk assembly, so a
long reply lost everything but its last chunk. The rewrite now gives up
after 6 seconds and shows the whole original reply, and `hooks.json`
registers `MessageDisplay` with the 10-second timeout Claude Code enforces.

### Removed

Expand Down
4 changes: 3 additions & 1 deletion captain_hook/builtin_packs/general/hooks/plain_english.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def plain_english(evt: MessageDisplayEvent, text: str, api_key: str) -> str:
contextvars.copy_context().run,
evt.ctx.call_llm,
rewrite_prompt(evt, text),
backend=OpenAiEndpointBackend("https://api.cerebras.ai/v1", "qwen-3.8-27b", api_key=api_key),
backend=OpenAiEndpointBackend(
"https://api.cerebras.ai/v1", "qwen-3.8-27b", api_key=api_key, reasoning_effort="none"
),
timeout=max(1, int(budget)),
)
try:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies = [
"filelock>=3",
"pathspec>=0.12",
"loguru>=0.7.3",
"spawnllm[sdk]>=0.13.4,<0.14",
"spawnllm[sdk]>=0.14.0,<0.15",
"mcp>=2.0,<3",
]

Expand Down
3 changes: 2 additions & 1 deletion tests/test_plain_english.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ def test_streamed_message_is_rewritten_once(ctx: CerebrasStub) -> None:
)
backend = kwargs["backend"]
assert isinstance(backend, OpenAiEndpointBackend)
assert (backend.base_url, backend.model, backend.api_key) == (
assert (backend.base_url, backend.model, backend.api_key, backend.reasoning_effort) == (
"https://api.cerebras.ai/v1",
"qwen-3.8-27b",
"test-key",
"none",
)
assert kwargs["timeout"] == 6
assert ctx.session.load(plain_english.PlainEnglishBuffer).messages == {}
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading