Skip to content

fix(responses): honor include on input item retrieval.#5605

Open
skamenan7 wants to merge 2 commits intoogx-ai:mainfrom
skamenan7:feat/5345-responses-input-items-include
Open

fix(responses): honor include on input item retrieval.#5605
skamenan7 wants to merge 2 commits intoogx-ai:mainfrom
skamenan7:feat/5345-responses-input-items-include

Conversation

@skamenan7
Copy link
Copy Markdown
Contributor

@skamenan7 skamenan7 commented Apr 22, 2026

What does this PR do?

Closes #5345

The GET /responses/{id}/input_items endpoint accepted the include query parameter but raised NotImplementedError when it was actually set. This wires up the filtering logic so gated fields (file_search_call.results, message.input_image.image_url, message.output_text.logprobs) are nulled out by default and only populated when the caller explicitly requests them via include, matching the OpenAI whitelist contract.

Include values whose backing models don't exist yet in Llama Stack (web_search_call.action.sources, reasoning.encrypted_content, computer_call_output.output.image_url, code_interpreter_call.outputs) are accepted silently as no-ops.

Changes:

  • src/llama_stack/providers/utils/responses/responses_store.py -- added _apply_include_filter() and _filter_message_include_fields() private functions, removed the NotImplementedError guard, and called the filter after pagination in list_response_input_items()
  • tests/unit/utils/responses/test_responses_store.py -- added 5 new tests covering all include filter branches plus a store round-trip test that verifies stored data is never mutated by filtering
  • tests/unit/providers/responses/builtin/test_openai_responses_core.py -- updated the delegation test to use a real ResponseItemInclude enum value instead of a bare string

Test Plan

uv run pytest tests/unit/utils/responses/test_responses_store.py -v --timeout=60

Also,

  • Ran focused live integration coverage for the Responses input-items listing path against a local minimal Llama Stack + Ollama setup.
  • Verified the new GET /v1/responses/{response_id}/input_items include behavior end to end using a deterministic stored response fixture.
  • Confirmed file_search_call.results is hidden by default and only returned when include=file_search_call.results is requested.
  • Confirmed message.output_text.logprobs is hidden by default and only returned when
    include=message.output_text.logprobs is requested.
  • Confirmed both include values work together, and that an unrelated no-op include value does not break the route.

Stored response input items should follow the same include contract as live responses so gated fields stay hidden unless callers explicitly request them.

Signed-off-by: skamenan7 <skamenan@redhat.com>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 22, 2026
@skamenan7 skamenan7 marked this pull request as ready for review April 22, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement include support for /responses/{id}/input_items in Responses API

1 participant