Skip to content

fix: stream memory workers through composed custom APIs - #60

Open
SavvasMohito wants to merge 1 commit into
elpapi42:masterfrom
SavvasMohito:fix/composed-custom-api-stream
Open

fix: stream memory workers through composed custom APIs#60
SavvasMohito wants to merge 1 commit into
elpapi42:masterfrom
SavvasMohito:fix/composed-custom-api-stream

Conversation

@SavvasMohito

@SavvasMohito SavvasMohito commented Sep 3, 2026

Copy link
Copy Markdown

Summary

  • Fixes Bug: background consolidation crashes Pi with custom provider API #30: observer/reflector/dropper no longer hard-wire @earendil-works/pi-ai/compat streamSimple, which cannot dispatch pi.registerProvider APIs (cursor-sdk, CLIProxyAPI, commandcode, …).
  • Workers resolve a stream function in this order: explicit override, ModelRegistry.streamSimple when Pi exposes it (earendil-works/pi#8964), then getRegisteredProviderConfig(id).streamSimple matching model.api, then compat fallback.
  • Custom-provider-only setups can leave observational-memory.model unset. A second built-in provider (OpenAI/OpenRouter) is optional, not required.
  • Registry lookup is try/caught so incomplete host/test doubles still use compat (OAuth e2e stays green).

Test plan

  • npm test (263 tests)
  • npm run typecheck
  • Fresh Pi: install this branch (local path or git:github.com/SavvasMohito/pi-observational-memory@fix/composed-custom-api-stream)
  • Session model whose api comes from pi.registerProvider (not a built-in): no PI_OBSERVATIONAL_MEMORY_PASSIVE, no observational-memory.model override onto OpenAI/OpenRouter/etc. One successful prompt, exit 0, process stays up, no No API provider registered for api: <custom-api>
  • Interactive session: [redacted] turns, /om:status without process crash

Observer/reflector/dropper were hard-wired to pi-ai compat streamSimple, which cannot dispatch registerProvider APIs such as cursor-sdk. Resolve the host-composed handler (or matching provider config) so Cursor-only setups no longer crash after a successful turn. Fixes elpapi42#30.

Co-authored-by: Cursor <cursoragent@cursor.com>
@SavvasMohito

Copy link
Copy Markdown
Author

Confirmed on a live Pi 0.84.4 session after installing this branch (local checkout of fix/composed-custom-api-stream).

Setup:

  • Session model from pi.registerProvider (cursor-sdk), no observational-memory.model override
  • PI_OBSERVATIONAL_MEMORY_PASSIVE unset
  • No second built-in worker provider

Result:

  • Interactive turns completed; process stayed up
  • /om:status worked
  • No No API provider registered for api: cursor-sdk after a successful turn

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.

Bug: background consolidation crashes Pi with custom provider API

1 participant