[Improve] Require explicit LLM usage source attribution - #1573
Draft
roomote-roomote[bot] wants to merge 2 commits into
Draft
[Improve] Require explicit LLM usage source attribution#1573roomote-roomote[bot] wants to merge 2 commits into
roomote-roomote[bot] wants to merge 2 commits into
Conversation
Contributor
Contributor
Author
|
Fixed blank and whitespace LLM usage source handling in |
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.
What changed
llmUsage.recordentry point, including the SDK wrapper, worker SDK usage, harness code, and generated sandbox plugin scripts.sourcerequired by the in-reposdk.llmUsage.record()helper so future callers must identify their usage surface.input.source ?? 'opencode'for backward compatibility with deployed clients that omit the field.The audit found no current in-repo caller of
llmUsage.record, so there were no existing missing callers to assign new source strings. Active recording paths already attribute usage explicitly: task inference usesopencode, the inference gateway usesinference-gateway, and non-task inference uses semantic values fromNON_TASK_INFERENCE_SURFACES.Why this change was made
The endpoint fallback can silently collapse newly added SDK callers into the generic
opencodebucket, while explicit blank strings can create a separate unattributed bucket. Requiring attribution in the SDK and validating explicit values at the RPC boundary prevents both cases without breaking older deployed clients that still need the server fallback.Impact
New TypeScript callers of the SDK helper must provide a source. Explicit blank sources are rejected, padded sources are normalized, and direct or older tRPC clients that omit
sourceremain compatible.