Repository navigation
fix(examples): ask LlmErc20 for single-brace JSON - #1798
Conversation
The response-format block lives in a plain (non f-) string, so the
doubled braces reached the LLM literally. A real model follows the
template and answers `{{...}}`, which json.loads rejects. This made
test_llm_erc20 fail whenever the mock did not apply and the call fell
through to the real provider (CI runs on #1784, 2026-09-10).
Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Delivery context
v0.123-dev. Studio-only; no cross-repository dependency.CI / test (pull_request_review)check on fix(fees): reserve parent appeal capacity in Studio message allocations #1784 (unrelated to that PR's change).What
examples/contracts/llm_erc20.py: the response-format block intaskused{{ ... }}.taskis a plain string (not an f-string), so the doubled braces reached the LLM literally. Now uses single braces, matching whatprompt_input(an f-string) already renders.Why
{{"transaction_success": true, ...}}, whichjson.loadsin the contract rejects (Expecting property name enclosed in double quotes: line 1 column 2).tests/integration/icontracts/tests/test_llm_erc20.pyfailed this way on the fix(fees): reserve parent appeal capacity in Studio message allocations #1784 review CI runs (run 39813769034, twice) and on 2026-09-10 (run 34472139849): the mock did not apply, all validators fell through to the real provider, computed the right balances (900/100) and returned them wrapped in double braces.Testing done
examples/contracts/*.pyandtests/integration/icontracts/contracts/*.py: no other plain (non f-) string contains{{; the originalllm_erc20.pyis flagged, the fixed one is not.transactions between users) is inprompt_input, unchanged.Decisions made
sim_replaceValidatorsinside the serializedmock_validatorsxdist group; suspect timing between that call and the consensus worker's validator snapshot). This PR only removes the double-brace failure mode.Checks
User facing release notes
The LLM ERC20 example contract now asks the model for valid JSON, so transfers no longer fail to parse when run against a real LLM.