Skip to content

feat: multi-account, quota, panel + reliability hardening - #13

Merged
makeittech merged 10 commits into
mainfrom
feat/host-transcript-divergence-and-meta-effort-3405
Aug 24, 2026
Merged

makeittech merged 10 commits into
mainfrom
feat/host-transcript-divergence-and-meta-effort-3405

Conversation

@makeittech

@makeittech makeittech commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Comprehensive reliability + PR #11 ideas reimplemented on post-#12 CLI-owned architecture.

Prior fixes (already in branch)

PR #11 ideas — reimplemented better (no plugin-side OAuth/tokens)

PR #11 idea Post-#12 implementation
Quota from anthropic-ratelimit-unified-* headers SDK control channel plan usage + rate_limit_event merge (zero token cost)
Account identity via OAuth profile API accountInfo from idle CLI probe control channel
Per-account subscriptions CLAUDE_CONFIG_DIR registry (accounts.ts), threaded through SDK spawn
Control panel Self-contained HTML at / and /panel (panel.ts)
Management tools claude_accounts, claude_account_manage (tools.ts)
Reliability fixes Unknown account 404, binding reconciliation, missing transcript detection, $0 rate limit, local meta fallback, per-account rate-limit gate

Deliberately NOT ported: loopback OAuth callback, plugin-side token exchange — violates CLI-owned auth model from #12.

Anthropic reliability hardening

  • 529 overloaded → proper 529 + Retry-After (not generic 500)
  • Per-account rate-limit gate (not global)
  • Single-flight quota probes with cooldown/backoff
  • Meta title/summary local fallback when rate-limited (200, not 429)
  • Defensive effort drop when thinking disabled

New configuration

  • OPENCODE_CLAUDE_ACCOUNTS, OPENCODE_CLAUDE_MODEL_QUOTA=0, OPENCODE_CLAUDE_PANEL=0, OPENCODE_CLAUDE_PANEL_HOST, OPENCODE_CLAUDE_TOOLS=0
  • Endpoints: /accounts, /quota, /usage, /sessions, panel routes
  • Model suffix: sonnet@work, header x-opencode-claude-account

Test plan

  • bun install
  • npm run build
  • bun test/smoke.ts — multi-account E2E, quota stores, 529/$0 taxonomy, panel + tools, divergence detection
Open in Web Open in Cursor 

Meta requests (session title, context summary) force-disable thinking but
still forwarded the selected effort level, and the API rejects that
combination: 400 output_config.effort 'max' is not supported when thinking
is disabled.

The proxy no longer sends effort on meta requests, and startClaudeQuery
drops effort defensively whenever the caller disables thinking, so no
future call site can reintroduce the 400.

Fixes #4

Co-authored-by: serkraser <serkraser@gmail.com>
On resumed turns the proxy ignored the host's prior messages entirely —
history came from the Claude-side session transcript that resume points
at, so plugins rewriting conversation history via
experimental.chat.messages.transform (e.g. @tarquinen/opencode-dcp) had
no effect on claude-code/* models after turn 2.

The proxy now fingerprints the non-system messages of every turn (chain
hash, persisted next to the session binding). When the incoming array is
no longer an extension of what the host sent last turn — messages
dropped, replaced, or edited — it logs a warning, abandons the Claude
session, and rebuilds from the transformed host array via history
transfer, so the transform actually reaches Claude.

System messages stay excluded from the fingerprint: the proxy drops them
deliberately (the Claude Code preset supplies the agent system prompt)
and hosts vary them between turns.

Knobs:
- OPENCODE_CLAUDE_DIVERGENCE_REBUILD=0 downgrades divergence handling to
  warn-only (previous behavior: the Claude transcript wins).
- OPENCODE_CLAUDE_HOST_TRANSCRIPT=1 opts into host-owned transcripts:
  never resume, rebuild from the host array every turn.

Co-authored-by: serkraser <serkraser@gmail.com>
Document the divergence-rebuild behavior and the two new knobs
(OPENCODE_CLAUDE_HOST_TRANSCRIPT, OPENCODE_CLAUDE_DIVERGENCE_REBUILD) in
the README, and add changelog entries for both fixes.

Co-authored-by: serkraser <serkraser@gmail.com>
…l title heuristic

Co-authored-by: serkraser <serkraser@gmail.com>
… quota, identity and usage stores

Co-authored-by: serkraser <serkraser@gmail.com>
…annel, meta local fallback

Co-authored-by: serkraser <serkraser@gmail.com>
…ODE_CLAUDE_TOOLS=0 disables)

Co-authored-by: serkraser <serkraser@gmail.com>
Co-authored-by: serkraser <serkraser@gmail.com>
… 529/$0 taxonomy, panel and tools

Co-authored-by: serkraser <serkraser@gmail.com>
…axonomy

Co-authored-by: serkraser <serkraser@gmail.com>
@cursor cursor Bot changed the title fix: host history transforms on resume + meta effort 400 feat: multi-account, quota, panel + reliability hardening Aug 24, 2026
@makeittech
makeittech marked this pull request as ready for review August 24, 2026 12:35
@makeittech
makeittech merged commit 53bd70e into main Aug 24, 2026
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