Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
61d582f
feat: auto-compact and retry on context window errors
TheArchitectit Apr 23, 2026
3e8e83f
Merge pull request #2 from TheArchitectit/feat/auto-compact-on-contex…
TheArchitectit Apr 23, 2026
fb62764
Add support referral links
TheArchitectit Apr 25, 2026
3b63012
Update referral links: add codes, remove stale details
TheArchitectit Apr 25, 2026
3f23a86
Fix bold formatting in referral links
TheArchitectit Apr 25, 2026
4b8048e
feat: auto-compact and retry on context window errors
TheArchitectit Apr 23, 2026
8a117ac
feat: add interactive provider wizard with /setup, claw setup, and Ct…
TheArchitectit Apr 26, 2026
99351d4
fix: Ctrl+P provider swap with visual feedback + clippy cleanup
TheArchitectit Apr 26, 2026
9b1593c
fix: /resume latest finds sessions across all workspaces
TheArchitectit Apr 27, 2026
7b35024
fix: scan project-local .claw/sessions/ as well as global root
TheArchitectit Apr 27, 2026
9d0b65f
Merge fix/resume-latest into feat/provider-wizard
TheArchitectit Apr 27, 2026
9085083
fix: /resume latest skips current empty session
TheArchitectit Apr 27, 2026
d61a1d1
Merge branch 'feat/auto-compact-upstream'
TheArchitectit Apr 27, 2026
856409d
feat: full LSP (Language Server Protocol) integration
TheArchitectit Apr 27, 2026
757ca1a
fix: LSP discovery finds rust-analyzer via rustup proxy
TheArchitectit Apr 27, 2026
e1a98c6
feat: auto-LSP integration with didOpen/didChange and diagnostic enri…
TheArchitectit Apr 27, 2026
872a78a
refactor: split LSP modules under 500 lines each
TheArchitectit Apr 27, 2026
a6bd2d7
feat(lsp): add lspAutoStart config, remove unused LSP client/process/…
TheArchitectit Apr 27, 2026
e958203
feat: full LSP (Language Server Protocol) integration
TheArchitectit Apr 27, 2026
4943c1b
fix: LSP discovery finds rust-analyzer via rustup proxy
TheArchitectit Apr 27, 2026
73cc827
feat: auto-LSP integration with didOpen/didChange and diagnostic enri…
TheArchitectit Apr 27, 2026
94b0c27
refactor: split LSP modules under 500 lines each
TheArchitectit Apr 27, 2026
ab3550e
feat(lsp): add lspAutoStart config, remove unused LSP client/process/…
TheArchitectit Apr 27, 2026
0b227b6
fix: resolve cherry-pick conflicts and remove non-LSP artifacts
TheArchitectit Apr 27, 2026
6a6b80b
merge: combine all feature branches (auto-compact, provider wizard, L…
TheArchitectit Apr 27, 2026
5e19cf1
feat: Trident compaction pipeline (supersede + collapse + cluster)
TheArchitectit Apr 27, 2026
88c0212
fix: write model at top-level in settings.json, not nested under prov…
TheArchitectit Apr 27, 2026
07ce5ae
feat: API timeout config, Retry-After header support, and configurabl…
TheArchitectit Apr 27, 2026
b40a26a
fix: retry 400 responses with transient gateway error bodies
TheArchitectit Apr 27, 2026
1ff5617
fix: sync all bug fixes to combined branch
TheArchitectit Apr 27, 2026
353da08
feat(lsp): install prompts, new servers, and advanced LSP features
TheArchitectit Apr 28, 2026
80b614d
merge: LSP install prompts + advanced features into combined branch
TheArchitectit Apr 28, 2026
bcf21d8
feat(lsp): add TCP transport for GDScript/Godot LSP (port 6008)
TheArchitectit Apr 28, 2026
061130e
fix(lsp): suppress Node.js deprecation warnings from JS-based LSP ser…
TheArchitectit Apr 28, 2026
e7c7ac2
feat(lsp): show "Loading LSP servers..." with start/stop hints
TheArchitectit Apr 28, 2026
22f948b
feat: project rules with .claw/rules/ and multi-framework auto-import
TheArchitectit Apr 28, 2026
d438b47
merge: project rules into combined branch
TheArchitectit Apr 28, 2026
2b661d3
feat: add git-aware context tools (GitStatus, GitDiff, GitLog, GitSho…
TheArchitectit Apr 28, 2026
a978afd
Merge branch 'feat/git-aware-tools' into feat/all-prs-combined
TheArchitectit Apr 28, 2026
410c761
feat: parallel tool execution for read-only tools
TheArchitectit Apr 28, 2026
7e7baea
feat: SubAgent tool for fast sub-agent delegation
TheArchitectit Apr 28, 2026
d2d4015
merge: multi-tool-exec into combined branch
TheArchitectit Apr 28, 2026
74cd967
feat: add fast model option to setup wizard
TheArchitectit Apr 28, 2026
87d6f95
fix: add subagentModel to config field validation
TheArchitectit Apr 28, 2026
d867c6d
fix: improve SubAgent/Agent descriptions to steer model toward SubAge…
TheArchitectit Apr 28, 2026
6b0af2b
refactor: remove SubAgent tool, make Agent use subagentModel config
TheArchitectit Apr 28, 2026
9c8ae50
feat: agent teams with inter-agent messaging and parallel execution
TheArchitectit Apr 28, 2026
584fd7f
fix: add AgentMessage dispatch entry, allowed_tools, and debug logging
TheArchitectit Apr 28, 2026
caa45db
feat: team mode presets (2x/4x/6x) for TeamCreate
TheArchitectit Apr 28, 2026
74cd450
fix: default to 2x team mode when no mode or tasks provided
TheArchitectit Apr 28, 2026
0152c49
fix: restore setup_wizard fast model prompt from feat/provider-wizard
TheArchitectit Apr 29, 2026
c45e789
fix: restore fast model prompt in setup wizard
TheArchitectit Apr 29, 2026
9f89957
feat: TeamStatus tool and background team watcher
TheArchitectit Apr 29, 2026
81fa342
fix: update TeamCreate description to mention TeamStatus, restore sub…
TheArchitectit Apr 29, 2026
2906ff1
feat: validate config on startup, prompt setup wizard if fields missing
TheArchitectit Apr 29, 2026
c2b8016
feat: inbox-based team monitoring
TheArchitectit Apr 29, 2026
7ab899c
feat: agent teams with task claiming, context management, and team mo…
TheArchitectit Apr 29, 2026
2f6a225
fix: make id field optional in OpenAI response parsing
TheArchitectit Apr 30, 2026
6294916
chore: add install script for rebuild and link
TheArchitectit Apr 30, 2026
5ddb1cd
fix: detect HTML responses in streaming path
TheArchitectit Apr 30, 2026
4081981
fix: detect raw JSON errors in streaming path
TheArchitectit Apr 30, 2026
e6b3327
fix: support reasoning_content and thinking fields in streaming
TheArchitectit Apr 30, 2026
d1c25ad
fix: make delta field optional in ChunkChoice
TheArchitectit Apr 30, 2026
ad1b036
fix: bounds check in compact boundary loop
TheArchitectit Apr 30, 2026
8d9270a
refactor(cli): extract parsing logic into cli module
TheArchitectit Apr 30, 2026
5809bde
refactor(cli): extract doctor/diagnostics module
TheArchitectit Apr 30, 2026
11e73e9
chore: remove dead code from tools and runtime
TheArchitectit Apr 30, 2026
5f79357
refactor: extract formatting functions to cli/format.rs
TheArchitectit Apr 30, 2026
99bb5f7
refactor: extract permission handling to cli/permission.rs
TheArchitectit Apr 30, 2026
32d8c77
refactor: extract web search module to tools/src/search.rs
TheArchitectit Apr 30, 2026
d61e792
refactor: extract team coordination module to tools/src/team.rs
TheArchitectit Apr 30, 2026
911dc88
refactor: extract agent utility module to tools/src/agent.rs
TheArchitectit Apr 30, 2026
1817ada
fix: handle reasoning/thinking content from models
TheArchitectit May 3, 2026
9bd34a6
fix(main.rs): emit ThinkingDelta events in AnthropicRuntimeClient
TheArchitectit May 3, 2026
8c11d95
fix: reduce max_tokens for non-opus models to prevent context window …
TheArchitectit May 3, 2026
c0aa6f7
feat: dynamic max_tokens based on input size to prevent context overflow
TheArchitectit May 3, 2026
11c9029
feat(tools): dynamic max_tokens for ProviderRuntimeClient
TheArchitectit May 3, 2026
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
56 changes: 56 additions & 0 deletions PR_DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Fix: Handle reasoning/thinking content from models

## Problem
When using reasoning-capable models (e.g., Claude with extended thinking, Grok 3, OpenAI o3/o4), the application fails with:
```
❌ Request failed
[error-kind: unknown]
error: assistant stream produced no content
```

This occurs when the model returns **only** thinking/reasoning blocks without regular text content.

## Root Cause
The SSE stream parser and event converter were explicitly ignoring `Thinking` and `RedactedThinking` content blocks:

```rust
// In rust/crates/tools/src/lib.rs
OutputContentBlock::Thinking { .. } | OutputContentBlock::RedactedThinking { .. } => {}

ContentBlockDelta::ThinkingDelta { .. } | ContentBlockDelta::SignatureDelta { .. } => {}
```

When a model returned only thinking content, zero `AssistantEvent` content events were produced. The `build_assistant_message` function then correctly rejected this as "no content".

## Solution
1. **Added `ThinkingDelta` event variant** (`rust/crates/runtime/src/conversation.rs`)
- New `AssistantEvent::ThinkingDelta { thinking, signature }` variant
- Accumulates thinking content and flushes it as text blocks wrapped in `<thinking>` tags
- Updated "no content" check to consider thinking as valid content

2. **Emit thinking events from stream** (`rust/crates/tools/src/lib.rs`)
- `push_output_block` now emits `ThinkingDelta` for thinking blocks
- `ContentBlockDelta` handler processes `ThinkingDelta` and `SignatureDelta`
- Synthetic `MessageStop` check includes thinking as valid content

## Changes Checklist

| File | Change | Why |
|------|--------|-----|
| `runtime/src/conversation.rs` | Added `ThinkingDelta` variant to `AssistantEvent` | Allow thinking content to flow through the runtime |
| `runtime/src/conversation.rs` | Added `flush_thinking_block()` helper | Convert accumulated thinking to displayable text blocks |
| `runtime/src/conversation.rs` | Updated `build_assistant_message()` | Accept thinking as valid content; prevent false "no content" errors |
| `runtime/src/conversation.rs` | Added tests for thinking content | Verify fix works for thinking-only and thinking+signature cases |
| `tools/src/lib.rs` | Updated `push_output_block()` | Emit thinking events instead of ignoring |
| `tools/src/lib.rs` | Updated `ContentBlockDelta` handler | Process thinking deltas and signatures |
| `tools/src/lib.rs` | Updated synthetic stop check | Treat thinking as valid content for stream completion |

## Testing
- Added `build_assistant_message_accepts_thinking_content` test
- Added `build_assistant_message_accepts_thinking_with_signature` test
- All 23 conversation tests pass

## Impact
- Enables use of reasoning models that return thinking content
- Backward compatible: regular text/tool content flows unchanged
- Redacted thinking is intentionally skipped (no useful content to display)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,14 @@ Claw Code is built in the open alongside the broader UltraWorkers toolchain:

- This repository does **not** claim ownership of the original Claude Code source material.
- This repository is **not affiliated with, endorsed by, or maintained by Anthropic**.

---

### ☕ Support This Project

Help keep this project going — use a referral link below and both of us get credits!

| Service | Your Bonus | Details | Referral Code |
|---------|-----------|---------|---------------|
| [**Neuralwatt**](https://portal.neuralwatt.com/auth/register?ref=NW-ROGER-ET3Y) | $10 in credits | Spend $10+ → you get $10, we get $20 | `NW-ROGER-ET3Y` |
| [**Synthetic**](https://synthetic.new/?referral=UAWqkKQQLFkzMkY) | $10 in credits | Subscribe → both get $10 credit | `UAWqkKQQLFkzMkY` |
19 changes: 19 additions & 0 deletions rust/crates/api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const CONTEXT_WINDOW_ERROR_MARKERS: &[&str] = &[
"prompt is too long",
"input is too long",
"request is too large",
"no parseable body",
];

#[derive(Debug)]
Expand Down Expand Up @@ -55,6 +56,9 @@ pub enum ApiError {
retryable: bool,
/// Suggested user action based on error type (e.g., "Reduce prompt size" for 413)
suggested_action: Option<String>,
/// Parsed Retry-After header value (seconds) for 429 responses.
/// When present, overrides the exponential backoff delay.
retry_after: Option<Duration>,
},
RetriesExhausted {
attempts: u32,
Expand Down Expand Up @@ -123,6 +127,18 @@ impl ApiError {
}

#[must_use]
/// Return the `Retry-After` delay if this error came from a 429 response
/// that included a `retry-after` header. Callers should prefer this value
/// over the computed backoff delay when it exists.
#[must_use]
pub fn retry_after(&self) -> Option<Duration> {
match self {
Self::Api { retry_after, .. } => *retry_after,
Self::RetriesExhausted { last_error, .. } => last_error.retry_after(),
_ => None,
}
}

pub fn is_retryable(&self) -> bool {
match self {
Self::Http(error) => error.is_connect() || error.is_timeout() || error.is_request(),
Expand Down Expand Up @@ -491,6 +507,7 @@ mod tests {
body: String::new(),
retryable: true,
suggested_action: None,
retry_after: None,
};

assert!(error.is_generic_fatal_wrapper());
Expand All @@ -514,6 +531,7 @@ mod tests {
body: String::new(),
retryable: true,
suggested_action: None,
retry_after: None,
}),
};

Expand All @@ -535,6 +553,7 @@ mod tests {
body: String::new(),
retryable: false,
suggested_action: None,
retry_after: None,
};

assert!(error.is_context_window_failure());
Expand Down
Loading