julep icon indicating copy to clipboard operation
julep copied to clipboard

Fix multi-choice delta accumulation

Open creatorrr opened this issue 6 months ago โ€ข 3 comments
trafficstars

User description

Summary

  • ensure per-choice delta dicts are distinct during streaming
  • add regression test for multi-choice streaming
  • clean ruff lint issues

Testing

  • ruff format .
  • ruff check . (auto-fixed)
  • pytype --config pytype.toml (fails: command not found)
  • ward --version (fails: command not found)

PR Type

Bug fix, Tests


Description

  • Fix delta accumulation for multi-choice streaming responses

    • Use list comprehension to ensure independent delta dicts per choice
  • Add regression test for multi-choice streaming delta accumulation

    • Verifies deltas are accumulated separately for each choice
  • Minor code cleanup and removal of unused lint directive


Changes walkthrough ๐Ÿ“

Relevant files
Bug fix
chat.py
Fix multi-choice delta accumulation logic in streamingย  ย  ย 

agents-api/agents_api/routers/sessions/chat.py

  • Fixes delta accumulation by using list comprehension for per-choice
    deltas
  • Ensures each choice's delta dict is distinct during streaming
  • +1/-1ย  ย  ย 
    Tests
    test_chat_streaming.py
    Add test for independent multi-choice delta accumulationย 

    agents-api/tests/test_chat_streaming.py

  • Adds regression test for multi-choice streaming delta accumulation
  • Mocks streaming responses with multiple choices
  • Asserts deltas are accumulated independently for each choice
  • +102/-0ย 
    Formatting
    __init__.py
    Remove unused lint directive commentย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย 

    agents-api/agents_api/queries/projects/init.py

  • Removes unused ruff lint directive comment
  • No functional code changes
  • +0/-2ย  ย  ย 

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.

  • [!IMPORTANT] Fixes multi-choice delta accumulation in chat streaming and adds regression test for independent delta accumulation.

    • Behavior:
      • Fixes multi-choice delta accumulation in stream_chat_response() in chat.py by initializing collected_deltas with distinct dictionaries for each choice.
      • Adds regression test test_chat_streaming.py to ensure deltas for each choice are accumulated separately.
    • Testing:
      • ruff format . and ruff check . used for linting.
      • pytype and ward commands fail due to command not found.

    This description was created by Ellipsis for 2ca0506b62792bdac87110223eb3c624a0bf161b. You can customize this summary. It will automatically update as commits are pushed.

    creatorrr avatar May 17 '25 17:05 creatorrr

    CI Feedback ๐Ÿง

    (Feedback updated until commit https://github.com/julep-ai/julep/commit/2ca0506b62792bdac87110223eb3c624a0bf161b)

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: Test

    Failed stage: Run tests [โŒ]

    Failed test name: chat: Test multi-choice streaming accumulates deltas independently

    Failure summary:

    The action failed because the test "chat: Test multi-choice streaming accumulates deltas
    independently" failed at line 509 in tests/test_chat_streaming.py. The test expected that the final
    chunk's first choice delta content would be "Hello world", but it was actually just "world". This
    indicates an issue with how streaming chat responses are being accumulated or processed.

    Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    965:  prune-cache: true
    966:  ignore-nothing-to-cache: false
    967:  ##[endgroup]
    968:  Downloading uv from "https://github.com/astral-sh/uv/releases/download/0.7.5/uv-x86_64-unknown-linux-gnu.tar.gz" ...
    969:  [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/63ec95ee-8a5b-472b-98f1-f85a36529a5e -f /home/runner/work/_temp/d26f78e2-aff7-4856-ba06-40e9629cf3d3
    970:  Added /opt/hostedtoolcache/uv/0.7.5/x86_64 to the path
    971:  Added /home/runner/.local/bin to the path
    972:  Set UV_CACHE_DIR to /home/runner/work/_temp/setup-uv-cache
    973:  Successfully installed uv version 0.7.5
    974:  Searching files using cache dependency glob: **/uv.lock
    975:  /home/runner/work/julep/julep/agents-api/uv.lock
    976:  /home/runner/work/julep/julep/cli/uv.lock
    977:  /home/runner/work/julep/julep/integrations-service/uv.lock
    978:  Found 3 files to hash.
    979:  Trying to restore uv cache from GitHub Actions cache with key: setup-uv-1-x86_64-unknown-linux-gnu-0.7.5-d92603d25acef1c08e643c37cc2475e5e190deb9690356b084828d60043a591f
    980:  ##[warning]Failed to restore: Cache service responded with 422
    981:  No GitHub Actions cache found for key: setup-uv-1-x86_64-unknown-linux-gnu-0.7.5-d92603d25acef1c08e643c37cc2475e5e190deb9690356b084828d60043a591f
    ...
    
    1488:  sql                                               
    1489:  PASS  test_agent_queries:126 query: update agent sql                         4%
    1490:  PASS  test_agent_queries:153 query: update agent with project sql            4%
    1491:  PASS  test_agent_queries:177 query: update agent, project does not exist     4%
    1492:  PASS  test_agent_queries:201 query: patch agent sql                          5%
    1493:  PASS  test_agent_queries:225 query: patch agent with project sql             5%
    1494:  PASS  test_agent_queries:260 query: patch agent, project does not exist      5%
    1495:  PASS  test_agent_queries:283 query: get agent not exists sql                 5%
    1496:  PASS  test_agent_queries:294 query: get agent exists sql                     6%
    1497:  PASS  test_agent_queries:315 query: list agents sql                          6%
    1498:  PASS  test_agent_queries:326 query: list agents with project filter sql      6%
    1499:  PASS  test_agent_queries:352 query: list agents sql, invalid sort            6%
    1500:  direction                                         
    1501:  PASS  test_agent_queries:368 query: delete agent sql                         6%
    1502:  INFO:httpx:HTTP Request: POST http://testserver/agents "HTTP/1.1 403 Forbidden"
    1503:  PASS  test_agent_routes:9 route: unauthorized should fail                    7%
    1504:  INFO:httpx:HTTP Request: POST http://testserver/agents "HTTP/1.1 201 Created"
    ...
    
    1623:  PASS  test_docs_queries:445 query: delete user doc                          22%
    1624:  PASS  test_docs_queries:482 query: delete agent doc                         22%
    1625:  PASS  test_docs_queries:519 query: search docs by text                      22%
    1626:  PASS  test_docs_queries:556 query: search docs by text with technical       22%
    1627:  terms and phrases                                  
    1628:  PASS  test_docs_queries:619 query: search docs by embedding                 22%
    1629:  PASS  test_docs_queries:647 query: search docs by hybrid                    23%
    1630:  INFO:httpx:HTTP Request: POST http://testserver/users/06828ca3-6201-7747-8000-100873d1b9a2/docs "HTTP/1.1 201 Created"
    1631:  PASS  test_docs_routes:15 route: create user doc                            23%
    1632:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca3-6b24-78e4-8000-04789c2e4e78/docs "HTTP/1.1 201 Created"
    1633:  PASS  test_docs_routes:32 route: create agent doc                           23%
    1634:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca3-73f2-7c22-8000-557870a1039d/docs "HTTP/1.1 201 Created"
    1635:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca3-73f2-7c22-8000-557870a1039d/docs "HTTP/1.1 409 Conflict"
    1636:  INFO:httpx:HTTP Request: POST http://testserver/users/06828ca3-7775-74d6-8000-a721dcd961f5/docs "HTTP/1.1 201 Created"
    1637:  PASS  test_docs_routes:49 route: create agent doc with duplicate title      23%
    1638:  should fail                                          
    1639:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca3-806c-761a-8000-e725f12351d7/docs "HTTP/1.1 201 Created"
    ...
    
    1718:  PASS  test_execution_queries:136 query: list executions, invalid offset     31%
    1719:  PASS  test_execution_queries:157 query: list executions, invalid sort by    31%
    1720:  PASS  test_execution_queries:178 query: list executions, invalid sort       31%
    1721:  direction                                     
    1722:  PASS  test_execution_queries:199 query: count executions                    31%
    1723:  PASS  test_execution_queries:217 query: create execution transition         31%
    1724:  PASS  test_execution_queries:238 query: create execution transition -       32%
    1725:  validate transition targets                   
    1726:  PASS  test_execution_queries:283 query: create execution transition with    32%
    1727:  execution update                              
    1728:  PASS  test_execution_queries:310 query: get execution with transitions      32%
    1729:  count                                         
    1730:  PASS  test_execution_queries:325 query: list executions with                32%
    1731:  latest_executions view                        
    1732:  PASS  test_execution_queries:348 query: execution with finish transition    33%
    1733:  PASS  test_execution_queries:382 query: execution with error transition     33%
    1734:  SKIP  test_execution_workflowโ€ฆ workflow: evaluate step   needs to be fixed  33%
    1735:  single                                          
    1736:  SKIP  test_execution_workflowโ€ฆ workflow: evaluate step   needs to be fixed  33%
    1737:  multiple                                        
    1738:  SKIP  test_execution_workfloโ€ฆ workflow: variable access  needs to be fixed  33%
    1739:  in expressions                                   
    1740:  SKIP  test_execution_workfloโ€ฆ workflow: yield step       needs to be fixed  34%
    1741:  SKIP  test_execution_workfloโ€ฆ workflow: sleep step       needs to be fixed  34%
    1742:  SKIP  test_execution_workfloโ€ฆ workflow: return step      needs to be fixed  34%
    1743:  direct                                           
    1744:  SKIP  test_execution_workfloโ€ฆ workflow: return step      needs to be fixed  34%
    1745:  nested                                           
    1746:  SKIP  test_execution_workfloโ€ฆ workflow: log step         needs to be fixed  35%
    1747:  SKIP  test_execution_workfloโ€ฆ workflow: log step         needs to be fixed  35%
    1748:  expression fail                                  
    1749:  SKIP  test_execution_workfโ€ฆ workflow: system call   workflow: thread race   35%
    ...
    
    1884:  INFO:httpx:HTTP Request: PUT http://testserver/test-paid-methods/put "HTTP/1.1 200 OK"
    1885:  INFO:httpx:HTTP Request: DELETE http://testserver/test-paid-methods/delete "HTTP/1.1 200 OK"
    1886:  PASS  test_middleware:176 middleware: paid tag bypasses cost limit check    51%
    1887:  INFO:httpx:HTTP Request: GET http://testserver/test-get-with-cost-limit "HTTP/1.1 200 OK"
    1888:  PASS  test_middleware:238 middleware: GET request with cost limit exceeded  51%
    1889:  passes through                                       
    1890:  INFO:httpx:HTTP Request: POST http://testserver/test-none-cost "HTTP/1.1 403 Forbidden"
    1891:  PASS  test_middleware:270 middleware: cost is None treats as exceeded       52%
    1892:  limit                                                
    1893:  INFO:httpx:HTTP Request: POST http://testserver/test-null-tags "HTTP/1.1 403 Forbidden"
    1894:  PASS  test_middleware:305 middleware: null tags field handled properly      52%
    1895:  INFO:httpx:HTTP Request: GET http://testserver/test-no-developer-id "HTTP/1.1 200 OK"
    1896:  PASS  test_middleware:340 middleware: no developer_id header passes         52%
    1897:  through                                              
    1898:  INFO:httpx:HTTP Request: GET http://testserver/test-user-not-found "HTTP/1.1 403 Forbidden"
    1899:  INFO:httpx:HTTP Request: GET http://testserver/test-404-error "HTTP/1.1 403 Forbidden"
    1900:  PASS  test_middleware:357 middleware: forbidden, if user is not found       52%
    1901:  INFO:httpx:HTTP Request: GET http://testserver/test-500-error "HTTP/1.1 500 Internal Server Error"
    1902:  PASS  test_middleware:397 middleware: hand over all the http errors except  53%
    1903:  of 404                                               
    ...
    
    1906:  INFO:httpx:HTTP Request: GET http://testserver/test-valid-user "HTTP/1.1 200 OK"
    1907:  PASS  test_middleware:442 middleware: valid user passes through             53%
    1908:  INFO:httpx:HTTP Request: POST http://testserver/sessions "HTTP/1.1 403 Forbidden"
    1909:  PASS  test_middleware:472 middleware: can't create session when cost limit  53%
    1910:  is reached                                           
    1911:  INFO:httpx:HTTP Request: POST http://testserver/sessions "HTTP/1.1 201 Created"
    1912:  INFO:httpx:HTTP Request: DELETE http://testserver/sessions/06828ca6-7c69-7d47-8000-f5d5030e28cb "HTTP/1.1 403 Forbidden"
    1913:  INFO:httpx:HTTP Request: GET http://testserver/sessions/06828ca6-7c69-7d47-8000-f5d5030e28cb "HTTP/1.1 200 OK"
    1914:  PASS  test_middleware:515 middleware: can't delete session when cost limit  53%
    1915:  is reached                                           
    1916:  PASS  test_mmr:24 utility: test to apply_mmr_to_docs                        54%
    1917:  PASS  test_mmr:61 utility: test mmr with different mmr_strength values      54%
    1918:  PASS  test_mmr:101 utility: test mmr with empty docs list                   54%
    1919:  PASS  test_model_validation:10 validate_model: succeeds when model is       54%
    1920:  available in model list                         
    1921:  PASS  test_model_validation:19 validate_model: fails when model is          55%
    1922:  unavailable in model list                       
    1923:  PASS  test_model_validation:31 validate_model: fails when model is None     55%
    1924:  PASS  test_nlp_utilities:6 utility: clean_keyword                           55%
    ...
    
    1938:  PASS  test_prepare_for_step:107 utility: prepare_for_step - global state    57%
    1939:  PASS  test_prepare_for_step:144 utility: get_workflow_name                  58%
    1940:  PASS  test_prepare_for_step:202 utility: get_workflow_name - raises         58%
    1941:  PASS  test_prepare_for_step:240 utility: get_inputs - 2 parallel            58%
    1942:  subworkflows                                   
    1943:  PASS  test_query_utils:5 utility: sanitize_string - strings                 58%
    1944:  PASS  test_query_utils:15 utility: sanitize_string - nested data            58%
    1945:  structures                                           
    1946:  PASS  test_query_utils:41 utility: sanitize_string - non-string types       59%
    1947:  PASS  test_secrets_queries:17 query: create secret                          59%
    1948:  PASS  test_secrets_queries:44 query: list secrets                           59%
    1949:  PASS  test_secrets_queries:95 query: get secret by name                     59%
    1950:  PASS  test_secrets_queries:122 query: update secret                         60%
    1951:  PASS  test_secrets_queries:177 query: delete secret                         60%
    1952:  INFO:httpx:HTTP Request: GET http://testserver/secrets "HTTP/1.1 403 Forbidden"
    1953:  PASS  test_secrets_routes:10 route: unauthorized secrets route should fail  60%
    1954:  INFO:httpx:HTTP Request: POST http://testserver/secrets "HTTP/1.1 201 Created"
    1955:  PASS  test_secrets_routes:27 route: create secret                           60%
    1956:  INFO:httpx:HTTP Request: POST http://testserver/secrets "HTTP/1.1 201 Created"
    1957:  INFO:httpx:HTTP Request: GET http://testserver/secrets "HTTP/1.1 200 OK"
    1958:  PASS  test_secrets_routes:52 route: list secrets                            61%
    1959:  INFO:httpx:HTTP Request: POST http://testserver/secrets "HTTP/1.1 201 Created"
    1960:  INFO:httpx:HTTP Request: PUT http://testserver/secrets/06828ca6-a087-7c09-8000-c851e9f1e1ae "HTTP/1.1 200 OK"
    1961:  PASS  test_secrets_routes:85 route: update secret                           61%
    1962:  INFO:httpx:HTTP Request: POST http://testserver/secrets "HTTP/1.1 201 Created"
    1963:  INFO:httpx:HTTP Request: DELETE http://testserver/secrets/06828ca6-a0ac-7720-8000-b4b0e9a5d99c "HTTP/1.1 202 Accepted"
    1964:  INFO:httpx:HTTP Request: GET http://testserver/secrets "HTTP/1.1 200 OK"
    1965:  PASS  test_secrets_routes:130 route: delete secret                          61%
    1966:  INFO:httpx:HTTP Request: POST http://testserver/secrets "HTTP/1.1 201 Created"
    1967:  INFO:httpx:HTTP Request: POST http://testserver/secrets "HTTP/1.1 409 Conflict"
    1968:  PASS  test_secrets_routes:171 route: create duplicate secret name fails     61%
    1969:  SKIP  test_secrets_usage:27 render:                    Skipping secrets     61%
    ...
    
    1976:  SKIP  test_secrets_usage:2โ€ฆ tasks:                     Skipping secrets     62%
    1977:  list_secrets_query in         usage tests          
    1978:  StepContext.tools                                  
    1979:  method                                             
    1980:  PASS  test_session_queries:37 query: create session sql                     62%
    1981:  PASS  test_session_queries:60 query: create or update session sql           62%
    1982:  PASS  test_session_queries:84 query: get session exists                     63%
    1983:  PASS  test_session_queries:100 query: get session does not exist            63%
    1984:  PASS  test_session_queries:114 query: list sessions                         63%
    1985:  PASS  test_session_queries:131 query: list sessions with filters            63%
    1986:  PASS  test_session_queries:150 query: count sessions                        64%
    1987:  PASS  test_session_queries:164 query: update session sql                    64%
    1988:  PASS  test_session_queries:199 query: patch session sql                     64%
    1989:  PASS  test_session_queries:226 query: delete session sql                    64%
    1990:  INFO:httpx:HTTP Request: GET http://testserver/sessions "HTTP/1.1 403 Forbidden"
    1991:  PASS  test_session_routes:7 route: unauthorized should fail                 64%
    1992:  INFO:httpx:HTTP Request: POST http://testserver/sessions "HTTP/1.1 201 Created"
    ...
    
    2086:  PASS  test_task_queries:70 query: get task sql - exists                     74%
    2087:  PASS  test_task_queries:89 query: get task sql - not exists                 74%
    2088:  PASS  test_task_queries:107 query: delete task sql - exists                 74%
    2089:  PASS  test_task_queries:143 query: delete task sql - not exists             75%
    2090:  PASS  test_task_queries:162 query: list tasks sql - with filters            75%
    2091:  PASS  test_task_queries:183 query: list tasks sql - no filters              75%
    2092:  PASS  test_task_queries:201 query: list tasks sql, invalid limit            75%
    2093:  PASS  test_task_queries:227 query: list tasks sql, invalid offset           75%
    2094:  PASS  test_task_queries:243 query: list tasks sql, invalid sort by          76%
    2095:  PASS  test_task_queries:259 query: list tasks sql, invalid sort direction   76%
    2096:  PASS  test_task_queries:275 query: update task sql - exists                 76%
    2097:  PASS  test_task_queries:311 query: update task sql - not exists             76%
    2098:  PASS  test_task_queries:338 query: patch task sql - exists                  77%
    2099:  PASS  test_task_queries:386 query: patch task sql - not exists              77%
    2100:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca8-7a6c-7e6f-8000-dd757ce8331c/tasks "HTTP/1.1 403 Forbidden"
    2101:  PASS  test_task_routes:27 route: unauthorized should fail                   77%
    2102:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca8-8169-7926-8000-3f41d28b4d55/tasks "HTTP/1.1 201 Created"
    ...
    
    2112:  INFO:httpx:HTTP Request: GET http://testserver/tasks/06828ca8-991b-71a6-8000-0376d5e65d1a "HTTP/1.1 200 OK"
    2113:  PASS  test_task_routes:124 route: get task exists                           78%
    2114:  INFO:httpx:HTTP Request: GET http://testserver/executions/06828ca8-a72b-72af-8000-6649f54dd352/transitions "HTTP/1.1 200 OK"
    2115:  PASS  test_task_routes:134 route: list all execution transition             79%
    2116:  INFO:httpx:HTTP Request: GET http://testserver/executions/06828ca8-b55b-7a08-8000-4836874f9399/transitions/06828ca8-b8e2-7286-8000-8fece612af30 "HTTP/1.1 200 OK"
    2117:  PASS  test_task_routes:149 route: list a single execution transition        79%
    2118:  INFO:httpx:HTTP Request: GET http://testserver/tasks/06828ca4-5160-70b0-8000-186732534dfa/executions "HTTP/1.1 200 OK"
    2119:  PASS  test_task_routes:190 route: list task executions                      79%
    2120:  INFO:httpx:HTTP Request: GET http://testserver/agents/06828ca8-c018-7d6b-8000-713e427d9cb5/tasks "HTTP/1.1 200 OK"
    2121:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca8-c018-7d6b-8000-713e427d9cb5/tasks "HTTP/1.1 201 Created"
    2122:  INFO:httpx:HTTP Request: GET http://testserver/agents/06828ca8-c018-7d6b-8000-713e427d9cb5/tasks "HTTP/1.1 200 OK"
    2123:  PASS  test_task_routes:205 route: list tasks                                79%
    2124:  SKIP  test_task_routes:248 route: update execution   Temporal connection    80%
    2125:  issue              
    2126:  PASS  test_task_validation:7 task_validation: Python expression validator   80%
    2127:  detects syntax errors                             
    2128:  PASS  test_task_validation:16 task_validation: Python expression validator  80%
    2129:  detects undefined names                          
    2130:  PASS  test_task_validation:25 task_validation: Python expression validator  80%
    2131:  allows steps variable access                     
    2132:  PASS  test_task_validation:33 task_validation: Python expression validator  81%
    2133:  detects unsafe operations                        
    2134:  PASS  test_task_validation:42 task_validation: Python expression validator  81%
    2135:  detects unsafe dunder attributes                 
    2136:  PASS  test_task_validation:63 task_validation: Python expression validator  81%
    2137:  detects potential runtime errors                 
    2138:  PASS  test_task_validation:72 task_validation: Python expression            81%
    ...
    
    2211:  PASS  test_user_queries:156 query: update user with project sql             91%
    2212:  PASS  test_user_queries:193 query: update user, project does not exist      91%
    2213:  PASS  test_user_queries:214 query: get user not exists sql                  91%
    2214:  PASS  test_user_queries:230 query: get user exists sql                      92%
    2215:  PASS  test_user_queries:245 query: list users sql                           92%
    2216:  PASS  test_user_queries:260 query: list users with project filter sql       92%
    2217:  PASS  test_user_queries:287 query: list users sql, invalid limit            92%
    2218:  PASS  test_user_queries:313 query: list users sql, invalid offset           92%
    2219:  PASS  test_user_queries:328 query: list users sql, invalid sort by          93%
    2220:  PASS  test_user_queries:344 query: list users sql, invalid sort direction   93%
    2221:  PASS  test_user_queries:361 query: patch user sql                           93%
    2222:  PASS  test_user_queries:381 query: patch user with project sql              93%
    2223:  PASS  test_user_queries:419 query: patch user, project does not exist       94%
    2224:  PASS  test_user_queries:441 query: delete user sql                          94%
    2225:  INFO:httpx:HTTP Request: POST http://testserver/users "HTTP/1.1 403 Forbidden"
    2226:  PASS  test_user_routes:9 route: unauthorized should fail                    94%
    2227:  INFO:httpx:HTTP Request: POST http://testserver/users "HTTP/1.1 201 Created"
    ...
    
    2243:  INFO:httpx:HTTP Request: GET http://testserver/users/06828ca9-bdb9-7ef6-8000-ca0d2158beb2 "HTTP/1.1 200 OK"
    2244:  PASS  test_user_routes:142 route: update user with project                  96%
    2245:  INFO:httpx:HTTP Request: PATCH http://testserver/users/06828ca9-c53b-7177-8000-cf612c5241f8 "HTTP/1.1 200 OK"
    2246:  INFO:httpx:HTTP Request: GET http://testserver/users/06828ca9-c53b-7177-8000-cf612c5241f8 "HTTP/1.1 200 OK"
    2247:  PASS  test_user_routes:174 query: patch user                                96%
    2248:  INFO:httpx:HTTP Request: PATCH http://testserver/users/06828ca9-c903-78bf-8000-9e94a4399a4e "HTTP/1.1 200 OK"
    2249:  INFO:httpx:HTTP Request: GET http://testserver/users/06828ca9-c903-78bf-8000-9e94a4399a4e "HTTP/1.1 200 OK"
    2250:  PASS  test_user_routes:205 query: patch user with project                   96%
    2251:  INFO:httpx:HTTP Request: GET http://testserver/users "HTTP/1.1 200 OK"
    2252:  PASS  test_user_routes:238 query: list users                                96%
    2253:  INFO:httpx:HTTP Request: POST http://testserver/users "HTTP/1.1 201 Created"
    2254:  INFO:httpx:HTTP Request: GET http://testserver/users?project=weathered_redshift_xl4 "HTTP/1.1 200 OK"
    2255:  PASS  test_user_routes:253 query: list users with project filter            97%
    2256:  INFO:httpx:HTTP Request: GET http://testserver/users?metadata_filter=%7B%27test%27%3A+%27test%27%7D "HTTP/1.1 200 OK"
    2257:  PASS  test_user_routes:286 query: list users with right metadata filter     97%
    2258:  PASS  test_validation_errors:9 format_location: formats error location      97%
    2259:  paths correctly                                 
    2260:  PASS  test_validation_errors:31 get_error_suggestions: generates helpful    97%
    2261:  suggestions for missing fields                 
    2262:  PASS  test_validation_errors:42 get_error_suggestions: generates helpful    97%
    2263:  suggestions for type errors                    
    2264:  PASS  test_validation_errors:64 get_error_suggestions: generates helpful    98%
    2265:  suggestions for string length errors           
    2266:  PASS  test_validation_errors:85 get_error_suggestions: generates helpful    98%
    2267:  suggestions for number range errors            
    2268:  WARNING:agents_api.web:Validation error: [{'type': 'dict_type', 'msg': 'Input should be a valid dictionary', 'loc': 'metadata', 'received': 'not-an-object'}, {'type': 'missing', 'msg': 'Field required', 'loc': 'name', 'fix': 'Add this required field to your request', 'example': '{ "field_name": "value" }', 'received': "{'about': 'Test agent description', 'model': 'invalid-model-id', 'metadata': 'not-an-object'}"}]
    2269:  INFO:httpx:HTTP Request: POST http://testserver/agents "HTTP/1.1 422 Unprocessable Entity"
    2270:  PASS  test_validation_errors:107 validation_error_handler: returns          98%
    2271:  formatted error response for validation       
    2272:  errors                                        
    2273:  PASS  test_validation_errors:148 validation_error_suggestions: function     98%
    2274:  generates helpful suggestions for all         
    2275:  error types                                   
    2276:  PASS  test_workflow_helpers:25 execute_map_reduce_step_parallel:            99%
    ...
    
    2283:  INFO:httpx:HTTP Request: POST http://testserver/tasks/06828ca9-db66-76ef-8000-1fa6faf65429/executions "HTTP/1.1 201 Created"
    2284:  PASS  test_workflow_routes:10 workflow route: evaluate step single          99%
    2285:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca9-e49c-75db-8000-9b8e84dc9e3f/tasks "HTTP/1.1 201 Created"
    2286:  INFO:httpx:HTTP Request: POST http://testserver/tasks/06828ca9-e687-7931-8000-f79e9a16e8c5/executions "HTTP/1.1 201 Created"
    2287:  PASS  test_workflow_routes:41 workflow route: evaluate step single with    100%
    2288:  yaml                                             
    2289:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca9-edc1-7569-8000-b699bc276737/tasks "HTTP/1.1 201 Created"
    2290:  INFO:httpx:HTTP Request: POST http://testserver/tasks/06828ca9-efc2-71da-8000-70c9d4c0358c/executions "HTTP/1.1 201 Created"
    2291:  PASS  test_workflow_routes:83 workflow route: evaluate step single with    100%
    2292:  yaml - nested                                    
    2293:  INFO:httpx:HTTP Request: POST http://testserver/agents/06828ca9-f701-7138-8000-f386292b8ab3/tasks/06828ca9-f710-7b24-8000-f42be42e059d "HTTP/1.1 201 Created"
    2294:  INFO:httpx:HTTP Request: POST http://testserver/tasks/06828ca9-f710-7b24-8000-f42be42e059d/executions "HTTP/1.1 201 Created"
    2295:  PASS  test_workflow_routes:128 workflow route: create or update: evaluate  100%
    2296:  step single with yaml                           
    2297:  โ”€โ”€โ”€โ”€โ”€โ”€ chat: Test multi-choice streaming accumulates deltas independently โ”€โ”€โ”€โ”€โ”€โ”€
    2298:  Failed at tests/test_chat_streaming.py:509                                    
    2299:  411 @test("chat: Test multi-choice streaming accumulates deltas independen
    ...
    
    2395:  507                                                                       
    2396:  508         final_chunk = parsed_chunks[-1]                               
    2397:  โฑ 509         assert final_chunk["choices"][0]["delta"]["content"] == "Hello
    2398:  510         assert final_chunk["choices"][1]["delta"]["content"] == "Foo b
    2399:  511                                                                       
    2400:  โ•ญโ”€ Difference (LHS vs RHS) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
    2401:  โ”‚                                                                            โ”‚
    2402:  โ”‚  world                                                                     โ”‚
    2403:  โ”‚ Hello world                                                                โ”‚
    2404:  โ”‚                                                                            โ”‚
    2405:  โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
    2406:  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    2407:  โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Results โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
    2408:  โ”‚  436  Tests Encountered           โ”‚
    2409:  โ”‚  402  Passes             (92.2%)  โ”‚
    2410:  โ”‚    1  Failures           (0.2%)   โ”‚
    2411:  โ”‚   33  Skips              (7.6%)   โ”‚
    2412:  โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
    2413:  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ FAILED in 232.09 seconds โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    2414:  ##[error]Process completed with exit code 1.
    2415:  Post job cleanup.
    
    

    PR Reviewer Guide ๐Ÿ”

    Here are some key observations to aid the review process:

    โฑ๏ธย Estimated effort to review: 2 ๐Ÿ”ต๐Ÿ”ตโšชโšชโšช
    ๐Ÿงชย PR contains tests
    ๐Ÿ”’ย No security concerns identified
    โšกย Recommended focus areas for review

    Bug Fix Validation

    Verify that the list comprehension initialization correctly creates independent dictionaries for each choice, unlike the previous implementation which created references to the same dictionary.

    collected_deltas = [{} for _ in range(len(chunk.choices or []))]
    
    

    PR Code Suggestions โœจ

    Explore these optional code suggestions:

    CategorySuggestionย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  Impact
    General
    Handle empty choices case

    The current implementation creates empty dictionaries for each choice, but if
    chunk.choices is empty, it will create an empty list. Consider handling the
    empty choices case more explicitly to avoid potential issues with subsequent zip
    operation.

    agents-api/agents_api/routers/sessions/chat.py [91]

    -collected_deltas = [{} for _ in range(len(chunk.choices or []))]
    +collected_deltas = [{} for _ in range(len(chunk.choices or []))] if chunk.choices else []
    
    • [ ] Apply / Chat
    Suggestion importance[1-10]: 5

    __

    Why: The suggestion adds a safeguard for when chunk.choices is empty, preventing potential issues with the zip operation. This is a minor but useful improvement for robustness, though the impact is moderate since the code already defaults to an empty list if chunk.choices is empty.

    Low
    • [ ] More