Skip to content

feat(ai): warn once per worker when built-in ONNX inference is used - #769

Merged
johnstonmatt merged 2 commits into
mainfrom
FUNC-1090/log-onnx-model-calls-to-measure-feature-usage
Nov 13, 2026
Merged

johnstonmatt merged 2 commits into
mainfrom
FUNC-1090/log-onnx-model-calls-to-measure-feature-usage

Conversation

@johnstonmatt

@johnstonmatt johnstonmatt commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Built-in ONNX inference is being considered for deprecation, so this surfaces that in users' function logs. A warning is logged once per worker per entry point when a model is run, rather than on every invocation, for both Supabase.ai.Session("gte-small").run and onnxruntime's InferenceSession.run.

Creating a session doesn't warn. The ingress main worker creates a gte-small session at boot to warm the model cache, and that isn't user usage.

  • Add warnOnnxUsage in ext/ai/js/onnxruntime/onnx.js, which de-duplicates by entry point and logs via console.warn.
  • Call it from the ONNX path of Session.run in ext/ai/js/ai.js and from InferenceSession.run.
  • Add integration tests that capture worker log events and assert exactly one warning per entry point. The supabase-ai test case runs the model twice, and also creates a second gte-small session without running it, to check that neither repeats nor adds a warning.

Built-in ONNX inference is being considered for deprecation, so users should learn that from their function logs. Warn once per worker per entry point, for both Supabase.ai.Session("gte-small") and onnxruntime InferenceSession.create, rather than on every invocation.

- Add warnOnnxUsage in ext/ai/js/onnxruntime/onnx.js, which de-duplicates by entry point and logs via console.warn.
- Call it from the gte-small branch of the Session constructor in ext/ai/js/ai.js and from InferenceSession.fromBuffer.
- Add integration tests that capture worker log events and assert exactly one warning per entry point.
- Add a second gte-small session to the supabase-ai test case to check that repeated sessions in one worker do not repeat the warning.
@johnstonmatt
johnstonmatt requested a review from a team November 13, 2026 19:33
The ingress main worker creates a gte-small session at boot to warm the
model cache, which would have logged the deprecation warning on every
instance. Warning in Session.run and InferenceSession.run counts actual
model calls instead.
@johnstonmatt
johnstonmatt merged commit 9b9e554 into main Nov 13, 2026
4 checks passed
@johnstonmatt
johnstonmatt deleted the FUNC-1090/log-onnx-model-calls-to-measure-feature-usage branch November 13, 2026 19:57
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.

2 participants