Include usage_id in LLM log events to preserve per-usage_id folders #1161
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.
I'm OpenHands-GPT-5, proposing a focused fix to ensure LLM completion logs are routed to the correct client folders.
Summary
usage_id. On the client,RemoteConversationkeeps ausage_id -> foldermap, so missingusage_idforces a fallback to the first folder, breaking the intended per-usage_id directory layout.What this PR changes
usage_idtoLLMCompletionLogEventllm.usage_idwhen setting the telemetry callback and includes it in the emitted eventevent.usage_idto pick the correctlog_completions_folder, with a safe fallback for robustnessRationale
llm.usage_idinEventServicewhere callbacks are registered, so including it in the event is simple and reliablemodel_name(which is ambiguous when multiple LLMs share the same model string)usage_idBackward compatibility
LLMCompletionLogEventwas introduced in the base PR; adding a field is backward-compatible within this change set and only affects the new streaming pathImplementation notes
usage_idin_setup_llm_log_streamingviamake_log_callback(usage_id)keepsTelemetrygeneric and unchanged_create_llm_completion_log_callbacknow selects the folder byusage_idfirst, then falls back to the first configured directory if neededTests and quality
@enyst Could you please take a look? This should address the concern about identifying the correct log directory per
usage_idwhile keeping the streaming approach intact.@enyst can click here to continue refining the PR