AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Core: Responses File-URL Test Overwrites Its Expected Result Without Asserting It

In langchain-core's test_convert_to_openai_data_block, the Responses API file/url case sets up test data but never calls the conversion function or asserts the result, leaving the branch untested. The fix adds the missing call and assertion.

mediumConfidence 95%LangchainMemoryVector StoresChainsAffected V1.6.3

Origin Analysis

The test case assigns `block` and `expected` for the Responses file/url branch, but immediately overwrites them with the base64 case values without invoking `convert_to_openai_data_block` or asserting the result. This is a test structure defect where variable reuse masks the missing verification.
1. Checkout langchain-core source at commit eba445b7563d1709427bd8072892975a6ea59fdc. 2. Run the provided reproduction script that patches convert_to_openai_data_block to return a corrupted file_url for the Responses file/url case. 3. Observe that test_convert_to_openai_data_block still passes, indicating the corrupted branch is not being tested.

Fixing Code Block

result = convert_to_openai_data_block(block, api="responses") assert result == expected
Insert the two lines immediately after setting `block` and `expected` in the Responses file/url case, mirroring the pattern used by other cases in the test. This ensures the conversion result is actually checked.

Edge Case Audit

This is a test-only change with no impact on production code. However, it may cause CI failures if the underlying conversion logic is intentionally changed in the future; such failures should be reviewed. Rolling back this test change is trivial but would reintroduce the coverage gap. It is recommended to refactor the test into parameterized cases to avoid similar variable overwrite issues.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state