Skip to content

Commit 9678d78

Browse files
UN-2946 [MISC] Fix empty Default tab in Prompt Studio Combined Output (#1956)
[MISC] [FIX] Fix empty Default tab in Prompt Studio Combined Output The DISTINCT-ON refactor in fetch_default_output_response built the outputs_index with str(o.prompt_id), but PromptStudioOutputManager names its FK field ``prompt_id`` (shadowing the PK column ``prompt_id_id``), so ``o.prompt_id`` returns the related ToolStudioPrompt instance, not a UUID. ``str()`` on the instance produces ``"ToolStudioPrompt object (<uuid>)"``, which never matches the canonical-UUID lookup keys — every prompt resolved to "" and the Default tab rendered as an empty payload. Use ``prompt_id_id`` for the index key. Side benefit: no N+1 from lazy loading the related instance per row, which was the perf intent of the original commit. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5214892 commit 9678d78

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

backend/prompt_studio/prompt_studio_output_manager_v2/output_manager_helper.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,10 @@ def _resolve(tool_prompt: ToolStudioPrompt) -> str | None:
323323
.order_by("prompt_id", "profile_manager_id", "-modified_at")
324324
.distinct("prompt_id", "profile_manager_id")
325325
)
326+
# ``prompt_id_id`` is the raw FK column; ``prompt_id`` returns the
327+
# related ToolStudioPrompt instance (FK field shadows the PK name).
326328
outputs_index = {
327-
(str(o.prompt_id), str(o.profile_manager_id)): o for o in outputs
329+
(str(o.prompt_id_id), str(o.profile_manager_id)): o for o in outputs
328330
}
329331

330332
enrichment_by_key: dict[str, Any] = {}

0 commit comments

Comments
 (0)