fix(acp): guard vim.NIL in tool-call message builder#263
Conversation
- providers send JSON null for tool-call fields - vim.NIL is truthy userdata, broke ipairs/index - restore session no longer crashes
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR tightens ACPClient:__build_tool_call_message to only treat update.content, update.rawInput, and update.locations as iterables or fallback sources when they are explicitly tables. It also adds ACPTransport.decode_line — a wrapper around vim.json.decode using luanil so JSON null maps to Lua nil — replaces inline decoding in the stdout loop with this helper, and adds tests and docs verifying null→nil decoding and malformed JSON handling. Sequence Diagram(s)sequenceDiagram
participant StdoutReader
participant ACPTransport
participant vim_json_decode
participant Callbacks
StdoutReader->>ACPTransport: send non-empty line
ACPTransport->>vim_json_decode: decode(line, { luanil = { object = true, array = true } })
vim_json_decode-->>ACPTransport: (ok, decoded) Note right of ACPTransport: JSON null -> Lua nil
ACPTransport->>Callbacks: callbacks.on_message(ok, decoded)
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Uh oh!
There was an error while loading. Please reload this page.