Commit Graph

50 Commits

Author SHA1 Message Date
Shadow
98a3321171 chore: bump carbon version
Closes #349
Closes #354
2026-01-07 02:58:40 -06:00
Muhammed Mukhthar CM
f3e5e04414 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
2026-01-07 00:56:32 +01:00
Peter Steinberger
5f2d886dea chore: make bun optional for source builds 2026-01-06 23:48:24 +00:00
Shadow
5b559080d1 feat(commands): unify chat commands (#275)
* Chat commands: registry, access groups, Carbon

* Chat commands: clear native commands on disable

* fix(commands): align command surface typing

* docs(changelog): note commands registry (PR #275)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-01-06 20:17:56 +00:00
Peter Steinberger
05d30fad2f fix(browser): sync lockfile for Playwright Bun patch (PR #307) 2026-01-06 19:27:09 +00:00
Ayaan Zaidi
757c19e6e7 refactor: replace tsx with bun for TypeScript execution (#278) 2026-01-06 07:14:08 +00:00
Asleep
8240ed1a04 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>
2026-01-06 04:45:40 +00:00
Peter Steinberger
981eead7ea fix: improve compaction queueing and oauth flows 2026-01-06 05:41:24 +01:00
Peter Steinberger
0e6b3e6a7e fix: patch qrcode-terminal import for Node 22 2026-01-06 02:23:55 +01:00
Peter Steinberger
33390d3a72 fix/heartbeat ok delivery filter (#246)
* cron: skip delivery for HEARTBEAT_OK responses

When an isolated cron job has deliver:true, skip message delivery if the
response is just HEARTBEAT_OK (or contains HEARTBEAT_OK at edges with
short remaining content <= 30 chars). This allows cron jobs to silently
ack when nothing to report but still deliver actual content when there
is something meaningful to say.

Media is still delivered even if text is HEARTBEAT_OK, since the
presence of media indicates there's something to share.

* fix(heartbeat): make ack padding configurable

* chore(deps): update to latest

---------

Co-authored-by: Josh Lehman <josh@martian.engineering>
2026-01-05 22:52:13 +00:00
Peter Steinberger
e4bfcde171 chore: update pi dependencies 2026-01-05 06:19:35 +01:00
Peter Steinberger
c5d12c2251 chore: update deps 2026-01-05 05:27:58 +01:00
Peter Steinberger
d81ff928f3 fix(ui): render markdown in chat 2026-01-04 21:51:26 +01:00
Peter Steinberger
82208a5078 fix: update lockfile and lint 2026-01-04 14:12:00 +01:00
Muhammed Mukhthar CM
84fb1123dc 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
2026-01-04 12:44:19 +01:00
Peter Steinberger
1be5aa5c1d fix: update pi-ai patch and tests 2026-01-04 12:24:01 +01:00
Shadow
33998f9570 Slack: add some fixes and connect it all up 2026-01-04 01:53:26 -06:00
Peter Steinberger
d751c5e40d refactor: remove bash pty mode 2026-01-03 20:15:10 +00:00
Peter Steinberger
888f943543 fix: harden block stream dedupe 2026-01-03 18:44:07 +01:00
Peter Steinberger
3ff4d4823d fix: stabilize pi-ai patch + tests 2026-01-03 05:22:09 +01:00
Peter Steinberger
0324aeaa61 chore: refresh pi-ai patch hash 2026-01-03 05:01:42 +01:00
mukhtharcm
a1fa3b6853 feat: add Google Antigravity authentication support
- Add 'antigravity' as new auth choice in onboard and configure wizards
- Implement Google Antigravity OAuth flow using loginAntigravity from pi-ai
- Update writeOAuthCredentials to accept any OAuthProvider (not just 'anthropic')
- Add schema sanitization for Google Cloud Code Assist API to fix tool call errors
- Default model set to google-antigravity/claude-opus-4-5 after successful auth

The schema sanitization removes unsupported JSON Schema keywords (patternProperties,
const, anyOf, etc.) that Google's Cloud Code Assist API doesn't understand.
2026-01-03 05:01:42 +01:00
Peter Steinberger
95e4408099 feat: add gateway TUI 2026-01-03 04:47:34 +01:00
Peter Steinberger
2754a6db24 sag skill: add chat voice response guidance
When Peter asks for voice replies, generate audio with sag and send via MEDIA:
2026-01-03 03:34:31 +00:00
Shadow
1aff389226 Discord: drop enableReactions config 2026-01-03 03:07:13 +01:00
Peter Steinberger
4a32edc1e3 templates: add qmd semantic memory recall to AGENTS.md 2026-01-03 01:33:10 +00:00
Peter Steinberger
4fb2fbb523 fix(mac): resolve camera type deprecation 2026-01-03 01:49:27 +01:00
Peter Steinberger
30f014d695 chore: sync lockfile and bundle hash 2026-01-03 00:40:39 +01:00
Peter Steinberger
3a283c51f7 chore: update deps and extend read tool tests 2026-01-02 23:47:28 +01:00
Peter Steinberger
f4ca88dc09 chore: upgrade pi-mono deps to 0.31.1 2026-01-02 23:37:08 +01:00
Peter Steinberger
4d9723e4a0 fix: detect bun relay assets 2026-01-01 18:30:16 +01:00
Peter Steinberger
0e44514bea feat: add onboarding wizard 2026-01-01 17:58:07 +01:00
Peter Steinberger
094c35868c fix: align tool schemas and health snapshot 2026-01-01 17:30:19 +01:00
Peter Steinberger
66665fef74 chore: update deps and add control ui routing tests 2025-12-30 14:30:46 +01:00
Peter Steinberger
1f3ddf8850 fix: enable lmstudio responses and drop think tags 2025-12-27 00:28:52 +00:00
Peter Steinberger
892a20a1ed fix(tests): align discord + queue changes 2025-12-26 14:32:57 +01:00
Peter Steinberger
bb7d41da10 chore: bump pi-mono deps 2025-12-26 10:20:21 +01:00
meaningfool
919d30fd3e fix: correctly define pnpm workspace and clean up vite build scripts
This change adds the missing 'packages' definition to pnpm-workspace.yaml, allowing pnpm to correctly install dependencies for the 'ui' sub-package. This resolves the 'vite: command not found' error during 'ui:build'. It also reverts the temporary 'pnpm dlx' workarounds in ui/package.json.
2025-12-26 09:13:17 +01:00
meaningfool
a9c0485e4b fix: correctly define pnpm workspace and clean up vite build scripts
This change adds the missing 'packages' definition to pnpm-workspace.yaml, allowing pnpm to correctly install dependencies for the 'ui' sub-package. This resolves the 'vite: command not found' error during 'ui:build'. It also reverts the temporary 'pnpm dlx' workarounds in ui/package.json.
2025-12-25 22:52:22 +01:00
Peter Steinberger
9030c09329 chore: bump pi-mono deps 2025-12-23 14:07:54 +00:00
Peter Steinberger
8486a9652b refactor: drop PAM auth and require password for funnel 2025-12-23 13:13:09 +00:00
Peter Steinberger
cd601f1934 chore: add oxlint type-aware lint 2025-12-23 00:28:55 +00:00
Peter Steinberger
3a31a55670 fix: bump pi deps and fix lint 2025-12-22 20:45:38 +00:00
Peter Steinberger
6dfa060f27 refactor: migrate embedded pi to sdk 2025-12-22 18:05:44 +01:00
Peter Steinberger
d57ca24d4b feat(gateway): add tailscale auth + pam 2025-12-21 00:44:39 +00:00
Peter Steinberger
1033b2e8b6 chore(deps): update lockfile 2025-12-20 23:00:31 +00:00
Peter Steinberger
412d7b65ba chore(deps): update dependencies 2025-12-20 22:45:15 +00:00
Peter Steinberger
bed37396ab chore(pi): bump deps, drop steerable transport 2025-12-20 22:38:12 +00:00
Peter Steinberger
9a747c78eb chore(deps): add chromium-bidi and long 2025-12-20 19:16:41 +00:00
Peter Steinberger
df2b6583b7 fix: use file-type for mime sniffing 2025-12-20 19:13:50 +01:00