feat: Unified Provider Interface — lifecycle hooks + context injection API#529
Merged
Conversation
- Adds programmatic E2E test covering full provider lifecycle - Discovery → loading → bridge → hooks → cleanup - Tests: sorting, deduplication, error isolation, 3-strikes disable, lifecycle hooks - 13 tests; all pass with bun test
- New customization/providers.mdx covering the full provider system: concept, quick start, interface, capabilities, config, bridge behavior, examples, troubleshooting - Add sidebar entry in astro.config.mjs under Customization - Cross-reference from features/providers-and-models.mdx to avoid confusion between AI model providers and ExtensionProviders
Server: - proxyTunnelRequestViaRelay: safe stream closure with closeStream() guard — prevents double-close and stream errors after response starts - On late relay error during streaming: close body instead of erroring the stream (avoids Bun write-after-end crashes) - Added test for clean streaming error handling - Tunnel upgrade: guard against null wss, add logging for connections, errors, and upgrades with remote addr and user-agent Tunnel client: - Enhanced disconnect/error logging with structured metadata (code, reason, uptime, active connections, failure count) - Track connection wall-clock start time for uptime reporting Tunnel relay (server): - Clear timer once response headers arrive — prevents killing long-lived SSE/streaming responses (fixes false timeout for EventSource, dev servers) - Tests: timeout when runner never responds, no timeout for long streams after headers arrive Server index: - Guard res.end() against writableEnded/destroyed on 404 and 500 paths (prevents ERR_STREAM_WRITE_AFTER_END crashes) Health endpoint: - Debounce health status log to avoid log spam on every /health poll
- Add optional model field to SessionStartEvent (providers/types.ts) - Populate model from ctx.model in providers/extension.ts - Add SessionStart hook to HooksConfig and config/io.ts - Handle SessionStart hook in hooks/extension.ts with model in payload - Update Claude Code plugin adapter to include model in session_start stdin - Add SessionStart to hook-summary.ts entry keys - Add tests for SessionStart hook and model payload
… in runner services skill
…ix vacuous E2E assertions
…event resource leak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR currently collects the unified provider-interface work plus follow-up hardening that landed while stabilizing the branch.
Main provider API work
ExtensionProvidertypes, capability guards, and config schema for provider services.ProviderBridgeaggregation with deterministic ordering, per-prompt dedupe, error isolation, and provider disable-on-repeat-failure behavior.Follow-up hardening included on the branch
Key design decisions
orderandproviderIdfor deterministic prompt placement.dedupeKeydeduplication is scoped per prompt and resets on prompt boundaries.Verification
Fresh local verification on this branch:
bun run typecheck— passedbun run test— 988 pass, 1 skip, 0 failbun run build— passedgit diff --check origin/main...HEAD— passedgit pull --rebaseandgit pushboth reported up-to-dateNotes