Skip to content

Conversation

matdev83
Copy link
Owner

@matdev83 matdev83 commented Oct 9, 2025

Summary

  • strengthen the tool-call integration test to parse the emitted JSON object
  • assert that the tool call contains an id, function metadata, and arguments payload

Testing

  • python - <<'PY'
    import asyncio
    from collections.abc import AsyncGenerator
    from src.core.domain.streaming_response_processor import StreamingContent
    from src.core.services.json_repair_service import JsonRepairService
    from src.core.services.streaming.content_accumulation_processor import ContentAccumulationProcessor
    from src.core.services.streaming.json_repair_processor import JsonRepairProcessor
    from src.core.services.streaming.stream_normalizer import StreamNormalizer
    from src.core.services.streaming.tool_call_repair_processor import ToolCallRepairProcessor
    from src.core.services.tool_call_repair_service import ToolCallRepairService
    import json

async def main():
json_proc = JsonRepairProcessor(
repair_service=JsonRepairService(),
buffer_cap_bytes=4096,
strict_mode=False,
)
tool_proc = ToolCallRepairProcessor(ToolCallRepairService())
normalizer = StreamNormalizer([json_proc, tool_proc, ContentAccumulationProcessor()])

async def stream() -> AsyncGenerator[object, None]:
    yield "prefix "
    yield "{'a': 1,}"
    yield ' and TOOL CALL: myfunc {"x":1}'
    yield b"data: [DONE]\n\n"

results: list[StreamingContent] = []
async for item in normalizer.process_stream(stream(), output_format="objects"):
    results.append(item)

non_empty = [r for r in results if r.content or r.is_done]
combined = "".join(r.content for r in non_empty if r.content)
tool_call = json.loads(combined)
assert tool_call["type"] == "function"
assert "id" in tool_call and tool_call["id"].startswith("call_")
assert tool_call["function"]["name"] == "myfunc"
assert json.loads(tool_call["function"]["arguments"]) == {"x": 1}

asyncio.run(main())
PY


https://chatgpt.com/codex/tasks/task_e_68e7cf14aa408333afaee14057a21d8a

@matdev83
Copy link
Owner Author

APPROVED - Safe to merge

Review Summary:

  • Base branch: ✅ dev (safe target)
  • CI Status: ✅ All checks passing
  • Test Results: ✅ JSON repair integration tests passing
  • Changes: Strengthened test assertions for better validation

Why Safe:

  • Changes are isolated to test improvements only
  • Enhanced assertions provide better tool call validation
  • All related tests pass, including the provided test code
  • No production code changes

Next: Proceeding with merge to dev.

@matdev83 matdev83 merged commit f7a100b into dev Oct 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant