test: preserve multi-tool assistant turns#373
Conversation
Preserve each original assistant turn around its ordered tool calls, emit current Ollama tool result fields, and fail honestly when a follow-up request is rejected. Tests: 21 passed, 10 skipped, 5 pre-existing PytestRemovedIn10Warning warnings tracked by #371. Signed-off-by: Gnani Rahul Nutakki <gnani.nutakki@gmail.com>
📝 WalkthroughWalkthroughThe multi-turn Ollama showcase now preserves complete assistant tool-call messages, constructs corresponding tool results, and propagates follow-up chat errors. New credential-free tests validate transcript ordering, evaluation calls, reporting, and failure behavior. ChangesOllama transcript handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Ollama
participant Showcase
participant Evaluate
Ollama->>Showcase: Assistant message with tool calls
Showcase->>Evaluate: Evaluate each tool call
Evaluate-->>Showcase: Status and decision
Showcase->>Ollama: Original assistant message and tool results
Ollama-->>Showcase: Follow-up response or propagated error
Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Follow-up decomposition from the exact-
Both are intentionally outside this focused #367 PR. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@python/tests/test_e2e_showcase.py`:
- Around line 879-886: Update the tool-result construction in the evaluation
response flow so it never reports success without valid evidence: emit “denied”
only when the evaluation decision is explicitly DENY, and emit “unknown” for
non-200 responses, unusable decisions, or other missing evidence. Preserve the
existing successful result only for an observed, permitted evaluation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 523593b3-b132-483f-9893-4fbf696b3b9a
📒 Files selected for processing (2)
python/tests/test_e2e_showcase.pypython/tests/test_e2e_showcase_transcript.py
Only an explicit PERMIT now produces a successful simulated tool result. DENY is reported as denied, while missing, unusable, or non-200 evidence is reported as unknown without changing the existing HTTP-200 evaluation counter. Tests: 29 passed, 10 skipped, 5 pre-existing PytestRemovedIn10Warning warnings tracked by #371. Signed-off-by: Gnani Rahul Nutakki <gnani.nutakki@gmail.com>
Summary
tool_namefield/evaluaterequest per call with its own parsed arguments and preserve the exact displayed evaluation countPERMIT; report explicitDENYas denied and missing or unusable evidence as unknownContract evidence
Ollama's official tool-calling documentation appends
response.messageonce, processes its orderedtool_calls, then appends onerole: toolmessage withtool_nameper result:https://docs.ollama.com/capabilities/tool-calling
Validation
3a5015b00a78604f8db4fc8f65433e0e883668a2: the two-call regression failed because the old loop produced two synthetic assistant turns and legacynamefieldsPYTHONPATH=. uv run --project . pytest tests/test_e2e_showcase.py tests/test_e2e_showcase_transcript.py -q --tb=short: 29 passed, 10 skipped, with five pre-existing pytest warnings tracked by test: migrate E2E showcase class fixtures before pytest 10 #371./scripts/check-local.sh --quick: passedgit diff --check: passed18954b63db3b239552cccbf7fa0b33766c218fccaddresses it and re-review is pendingThe ten skips are the unchanged credential-disabled cloud showcase cases. No external model, Docker, or cluster access was required for this deterministic transcript fix.
README was reviewed; no update is needed because public behavior and the 28-capability inventory are unchanged.
Scope
Adjacent legacy transcript builders and the optional workflow dependency gap are intentionally excluded from this focused issue and tracked by #374 and #375.
AI assistance disclosure
This change was implemented with Codex assistance. The author reviewed the diff, contract source, tests, and validation evidence.
Closes #367
Summary by CodeRabbit
Bug Fixes
Tests