Commit Graph

55 Commits (4329d94de3a71803db177ee50af68eb75d7ea06b)

Author SHA1 Message Date
Peter Steinberger 6c0a01dc90 fix: bundle mac model catalog 10 months ago
Peter Steinberger 74f382f732 fix: default Anthropic API cache TTL to 1h 10 months ago
Michael Behr 003c6c9ae1
add patches/.gitkeep (#1104) 10 months ago
Peter Steinberger 548a32c8d4 chore: drop unused patches 10 months ago
Peter Steinberger 500c75b4f0 fix: align ZAI thinking toggles 10 months ago
Peter Steinberger b7ba94f0c1 fix: harden antigravity claude support (#968)
Co-authored-by: Max <rdev@users.noreply.github.com>
10 months ago
Peter Steinberger f87016a5fe fix: handle unsigned tool calls for gemini 3 10 months ago
Peter Steinberger 8f6e67553f chore: drop stale pi-ai patch 10 months ago
Peter Steinberger 0a8be132b9 chore: prep 2026.1.13 release 10 months ago
Peter Steinberger cb0f6cefa4 Deps: update Pi + Vitest and add Bedrock docs 10 months ago
Peter Steinberger ca8e2bccab chore: update deps 10 months ago
Peter Steinberger fb6a809f91 fix: refresh pnpm patch for pi-ai 10 months ago
Peter Steinberger d8feadb57a fix: strip gemini cli tool ids (#756) 10 months ago
Peter Steinberger f328cd5246 fix: preserve reasoning on tool-only turns 10 months ago
Peter Steinberger 55da6ca449 fix: keep reasoning for tool-only turns 10 months ago
Peter Steinberger 8dbf72099a fix: refresh pi-ai patch for pnpm lockfile 10 months ago
Peter Steinberger eec082e541 fix: update pi-ai reasoning replay patch 10 months ago
Peter Steinberger f00038b383 fix(testing): stabilize live model runs 10 months ago
Peter Steinberger eeae5ce7fd fix: stabilize notes and reasoning replay 10 months ago
Peter Steinberger 20b4e2b859 fix: stabilize live probes and docs 10 months ago
benithors 3853f632e5 fix: restore pi-ai patch hash 10 months ago
Peter Steinberger aa30995aa1 test(live): add provider filters + google skip rules 10 months ago
Peter Steinberger ab314a22e0 chore: refresh pi-ai patch repro note 10 months ago
Peter Steinberger d19972b317 fix(openai): drop reasoning replay for tool-only turns 10 months ago
Peter Steinberger d44bb41d27 fix: replay OpenAI reasoning for tool calls 10 months ago
Peter Steinberger c264e98c62 fix(deps): patch pi-ai tool calling 10 months ago
Shadow 0de3bb36d5
Deps: drop carbon patch 10 months ago
Peter Steinberger 53a0c966a5 refactor: unify configure auth choice 10 months ago
Peter Steinberger 8466e53b5d fix: restore Anthropic OAuth tool dispatch 10 months ago
Peter Steinberger 5b8f2911df chore: sync pnpm patches after pull 10 months ago
Peter Steinberger 28b7e87c99 fix(pnpm): regenerate patchedDependencies 10 months ago
Peter Steinberger a4ea47be37 fix: refresh @buape/carbon patch 10 months ago
Peter Steinberger cb10682d3e fix(openai): avoid invalid reasoning replay 10 months ago
Peter Steinberger a25922a21f fix: clarify sessions_send delivery semantics 10 months ago
Peter Steinberger 6156402c1a fix: scope 429 fast-fail to antigravity (#561) (thanks @mukhtharcm) 10 months ago
Muhammed Mukhthar CM d0450bb425 fix(antigravity): add fail-fast on 429 rate limit
When Antigravity returns 429, throw immediately instead of waiting for the
server-provided retry delay (which can be 10+ minutes). This lets clawdbot
quickly rotate to another account.

This patch was previously in PR #454 but was accidentally removed in 0dbb569
when bumping to pi-ai 0.40.0. The upstream release did NOT include this fix.

Context: Antigravity rate limits cause pi-ai to sleep for the full retry
delay inside the request, blocking the thread. Clawdbot's timeout would
eventually fire, but waiting 10+ minutes is unacceptable UX.

Bundled with the empty error message filter since both handle 429 recovery.
10 months ago
Muhammed Mukhthar CM 1cfe409a09 fix: filter empty error messages to prevent session corruption
When 429/500 errors occur during tool execution, empty assistant messages
with stopReason='error' and content=[] get persisted to the session file.

These break the tool_use -> tool_result chain that Claude/Gemini require:
- Claude expects every tool_use block to have a matching tool_result
- Empty error messages inserted mid-sequence violate this invariant
- Results in: 'tool_use ids were found without tool_result blocks'

This patch filters out empty error messages when building session context,
allowing sessions to recover gracefully from transient API errors.

Evidence from production:
- 113 of 170 sessions had empty error messages
- Session 30764430 demonstrated recovery: 429 at 14:30:11 IST,
  resumed successfully at 14:30:22, completed at 14:30:34

Sorry Peter, one more patch! 🙈
10 months ago
Jake 0dbb569187 chore: bump Pi to 0.40.0 and revert PR #454 pi-ai patch
- Upgrade @mariozechner/pi-* packages from 0.38.0 to 0.40.0
- Remove pi-ai patch (upstream 429 fix in 0.40.0 supersedes PR #454)
- Update CHANGELOG
10 months ago
mukhtharcm 80ca04af01 fix(antigravity): add CLIProxyAPI v6.6.89 compatibility to fix 429 errors
Port Antigravity payload enhancements from CLIProxyAPI v6.6.89:
- Add ANTIGRAVITY_SYSTEM_INSTRUCTION with agent identity/guidelines
- Inject systemInstruction with role 'user' for Antigravity requests
- Add requestType: 'agent' to wrapped request body
- Update userAgent to 'antigravity' for Antigravity requests

This fixes RESOURCE_EXHAUSTED (429) errors when using Antigravity.

Adapted from: https://github.com/NoeFabris/opencode-antigravity-auth/pull/137
Reference: https://github.com/router-for-me/CLIProxyAPI/commit/67985d8
10 months ago
Peter Steinberger 5d21e8c891 chore(deps): update dependencies 10 months ago
mneves75 f7b32195cb feat(agent): auto-enable GLM-4.7 thinking mode
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 <noreply@anthropic.com>
10 months ago
Muhammed Mukhthar CM eb5f758f6b fix(auth): improve multi-account round-robin rotation and 429 handling
This commit fixes several issues with multi-account OAuth rotation that
were causing slow responses and inefficient account cycling.

## Changes

### 1. Fix usageStats race condition (auth-profiles.ts)

The `markAuthProfileUsed`, `markAuthProfileCooldown`, `markAuthProfileGood`,
and `clearAuthProfileCooldown` functions were using a stale in-memory store
passed as a parameter. Long-running sessions would overwrite usageStats
updates from concurrent sessions when saving.

**Fix:** Re-read the store from disk before each update to get fresh
usageStats from other sessions, then merge the update.

### 2. Capture AbortError from waitForCompactionRetry (pi-embedded-runner.ts)

When a request timed out, `session.abort()` was called which throws an
`AbortError`. The code structure was:

```javascript
try {
  await session.prompt(params.prompt);
} catch (err) {
  promptError = err;  // Catches AbortError here
}
await waitForCompactionRetry();  // But THIS also throws AbortError!
```

The second `AbortError` from `waitForCompactionRetry()` escaped and
bypassed the rotation/fallback logic entirely.

**Fix:** Wrap `waitForCompactionRetry()` in its own try/catch to capture
the error as `promptError`, enabling proper timeout handling.

Root cause analysis and fix proposed by @erikpr1994 in #313.

Fixes #313

### 3. Fail fast on 429 rate limits (pi-ai patch)

The pi-ai library was retrying 429 errors up to 3 times with exponential
backoff before throwing. This meant a rate-limited account would waste
30+ seconds retrying before our rotation code could try the next account.

**Fix:** Patch google-gemini-cli.js to:
- Throw immediately on first 429 (no retries)
- Not catch and retry 429 errors in the network error handler

This allows the caller to rotate to the next account instantly on rate limit.

Note: We submitted this fix upstream (https://github.com/badlogic/pi-mono/pull/504)
but it was closed without merging. Keeping as a local patch for now.

## Testing

With 6 Antigravity accounts configured:
- Accounts rotate properly based on lastUsed (round-robin)
- 429s trigger immediate rotation to next account
- usageStats persist correctly across concurrent sessions
- Cooldown tracking works as expected

## Before/After

**Before:** Multiple 429 retries on same account, 30-90s delays
**After:** Instant rotation on 429, responses in seconds
11 months ago
Azade 16ce78233f fix(browser): patch playwright-core for Bun WebSocket compatibility
Bun's WebSocket implementation doesn't fully support Playwright's CDP
connection because Playwright bundles its own 'ws' module. This causes
connectOverCDP to timeout.

The patch makes Playwright use the native 'ws' module when running
under Bun, which works with Bun's WebSocket shim.

Fixes browser snapshot/act timeouts after PR #278 (tsx → bun migration).

Ref: https://github.com/oven-sh/bun/issues/9911
11 months ago
Asleep 8880128ebf
Format messages so they work with Gemini API (#266)
* fix: Gemini stops working after one message in a session

* fix: small issue in test file

* test: cover google role-merge behavior

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
11 months ago
Peter Steinberger 92ff3311ee chore: remove unused patch file 11 months ago
Peter Steinberger b85248bd07 fix: patch qrcode-terminal import for Node 22 11 months ago
Muhammed Mukhthar CM 9958283ced
fix: Antigravity API compatibility and Gemini thinking tag leakage (#167)
* fix: ensure type:object in sanitized tool schemas for Antigravity API

The sanitizeSchemaForGoogle function strips unsupported JSON Schema
keywords like anyOf, but this can leave schemas with 'properties' and
'required' fields without a 'type' field. Both Google's Gemini API and
Anthropic via Antigravity require 'type: object' when these fields exist.

This fix adds a post-sanitization check that ensures type is set to
'object' when properties or required fields are present.

Fixes errors like:
- Gemini: 'parameters.properties: only allowed for OBJECT type'
- Anthropic: 'tools.6.custom.input_schema.type: Field required'

* fix: regenerate pi-ai patch with proper pnpm format

The patch now correctly applies via pnpm patch-commit, fixing:
- Thinking blocks: skip for Gemini, send with signature for Claude
- Schema sanitization: ensure type:object after removing anyOf
- Remove strict:null for LM Studio/Antigravity compatibility

Tested with all Antigravity models (Gemini and Claude).

* fix: strip thinking tags from block streaming output to prevent Gemini tag leakage
11 months ago
Peter Steinberger d6f8b6ac51 fix: update pi-ai patch and tests 11 months ago
Peter Steinberger 72b34f7d03 fix: harden block stream dedupe 11 months ago
Peter Steinberger 6cda84432e fix: stabilize pi-ai patch + tests 11 months ago