singularity-forge/packages/pi-coding-agent/src/core
Lex Christopherson ca8697ae26 feat: use server-requested retry delay for Anthropic rate limits
Anthropic's 429 responses include retry-after and x-ratelimit-reset-*
headers that tell us exactly when to retry. Previously we ignored these
and used exponential backoff (2s, 4s, 8s), which is both wrong and
misleading in the UI countdown.

- Add retryAfterMs to AssistantMessage as the structured carrier
- Extract retry-after / x-ratelimit-reset-requests / x-ratelimit-reset-tokens
  from Anthropic SDK APIError.headers in the provider catch block
- Session uses retryAfterMs when present (capped by maxDelayMs=60s),
  falls back to exponential backoff for errors with no timing hint

The UI countdown now shows the actual Anthropic reset time. No UI changes needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:51:17 -06:00
..
compaction feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
export-html fix: add missing export-html vendor files 2026-03-13 10:38:13 +01:00
extensions fix: handle undefined result from custom() in RPC mode for ask_user_questions (#156, #165, #171) (#199) 2026-03-13 10:24:57 -06:00
lsp fix: eliminate command injection and unhandled JSON.parse in LSP tool 2026-03-13 11:45:04 -06:00
tools feat: native Rust xxHash32 for hashline (#272) 2026-03-13 16:46:08 -06:00
agent-session.ts feat: use server-requested retry delay for Anthropic rate limits 2026-03-13 16:51:17 -06:00
artifact-manager.ts feat: TTSR + blob/artifact storage (ported from oh-my-pi) 2026-03-13 08:43:56 -06:00
auth-storage.test.ts fix: add tests and clarify edge cases for multi-credential auth storage 2026-03-13 15:49:44 -06:00
auth-storage.ts fix: add tests and clarify edge cases for multi-credential auth storage 2026-03-13 15:49:44 -06:00
bash-executor.ts feat: native Rust bash stream processor for single-pass chunk processing (#271) 2026-03-13 16:34:17 -06:00
blob-store.ts feat: TTSR + blob/artifact storage (ported from oh-my-pi) 2026-03-13 08:43:56 -06:00
defaults.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
diagnostics.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
event-bus.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
exec.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
footer-data-provider.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
index.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
keybindings.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
messages.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
model-registry.ts feat: multi-credential round-robin with rate-limit fallback 2026-03-13 14:45:35 -06:00
model-resolver.ts feat: add claude-opus-4-6[1m] model with 1M context window (#288) 2026-03-13 16:25:45 -06:00
package-manager.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
prompt-templates.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
resolve-config-value.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
resource-loader.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
sdk.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
session-manager.ts feat: TTSR + blob/artifact storage (ported from oh-my-pi) 2026-03-13 08:43:56 -06:00
settings-manager.ts feat: memory extraction pipeline (#261) 2026-03-13 16:41:13 -06:00
skills.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
slash-commands.ts feat: add /thinking slash command for toggling thinking level (#129) 2026-03-13 10:52:53 -06:00
system-prompt.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
timings.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00