Repository navigation
fix #95351: [Feature]: Generic JSONL line-parsing hook for CliBackendPlugin (native tool-card support beyond claude-stream-json) - #95386
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 3:13 PM ET / 19:13 UTC. ClawSweeper reviewWhat this changesAdds a public Merge readinessKeep this PR open for normal maintainer landing. It has explicit member sponsorship for the public SDK seam, an open linked implementation issue, sufficient after-fix executor proof, and no supported patch defect in the supplied review record; the remaining gate is completion of the exact-head CI run and maintainer merge review. Priority: P2 Review scores
Verification
How this fits togetherCLI backend plugins describe external command-line agent runtimes. Their stdout enters the CLI runner, which converts stream records into normalized agent events that the gateway and user interfaces render and use for session continuity. flowchart LR
A[CLI backend plugin] --> B[Plugin JSONL parser hook]
B --> C[Backend resolution]
C --> D[CLI streaming executor]
D --> E[Normalized agent events]
E --> F[Tool cards and text streams]
E --> G[Session and usage state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +253, Tests +460, Docs +18. Total +731 across 13 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the accepted additive SDK contract after required checks pass, preserving built-in JSONL fallback and keeping plugin-reported tool events display-only with the existing session-state regression coverage. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is an additive feature. The supplied exact-head terminal evidence and successful real-behavior-proof check exercise the new plugin-registration, resolution, and streaming-parser path. Is this the best way to solve the issue? Yes. The accepted design keeps provider-specific wire parsing with the backend plugin, retains the built-in parser as fallback, and prevents plugin display events from impersonating trusted host-tool execution. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against e0ab154e5eb5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (18 earlier review cycles; latest 8 shown)
|
58aabee to
3a4c522
Compare
3a4c522 to
357e26e
Compare
1f5e873 to
c85259c
Compare
c85259c to
2fccc83
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
@clawsweeper Re-review requested after addressing the proof gaps on this PR. Head: RF-004 (rebase / drift): resolved. The branch is replayed onto current RF-001 / RF-002 / RF-005 (redacted after-fix proof from an actual external JSONL CLI): resolved. A real external CLI subprocess (
This demonstrates the producer-to-reader path end-to-end against a real subprocess on the exact head. The redacted transcript is in the Redacted after-fix proof from an actual external JSONL CLI section of the PR body. Tests / typecheck on the exact head
RF-003 / RF-006 (maintainer SDK sponsorship / public-surface decision): These are maintainer API/SDK decisions and remain advisory from this contributor's side; no code change was made for them. Requesting re-review at the new head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Proof refreshed on exact head 242c08b48c8:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Exact-head live behavior proof on current head 242c08b48c89b1c0dc22e30d0b66e7a1f2f7f02f (Node v24.18.0, SQLite 3.53.1): Imports the real production module src/agents/cli-output.ts and exercises the full plugin registration -> backend-resolution -> JSONL normalization path that this PR adds. A plugin-owned parseJsonlEvent hook (the public SDK callback) is defined, placed on the backend config, and consumed by the production createCliJsonlStreamingParser to normalize 5 JSONL lines from a simulated third-party CLI subprocess into assistant text, thinking stream, native tool-start, and tool-result events. Production CLI backend JSONL normalization transcript (current head): command: node --import tsx cli-backend-proof.mts (real production module, no mock) step_1: plugin_registers_parseJsonlEvent_hook step_2: streaming_parser_normalizes_jsonl_through_hook has_assistant_text: true assertions: PASS This proves the full path: a plugin registers a parseJsonlEvent hook -> the hook flows through the backend config into the production createCliJsonlStreamingParser -> the parser calls the hook for each JSONL line -> normalized events (assistant text, thinking, tool-start, tool-result) are emitted through callbacks. No mock or stub of the production parser is used; only the JSONL input is simulated. |
|
Maintainer sponsorship accepted. The additive parser hook is the right public SDK seam: dialect-specific parsing stays with the CLI backend plugin, built-in JSONL fallback remains intact, and plugin-reported tool activity stays display-only rather than becoming trusted host execution or delivery evidence. |
|
Merged via squash.
|
Fixes #95351
What Problem This Solves
CLI backend plugins could not translate backend-specific JSONL records into OpenClaw's normalized streaming events. The original branch exposed a parser callback, but production execution did not carry it into the stdout parser, so the public hook was effectively dead.
Why This Change Was Made
parseJsonlEventhook and normalized event types throughopenclaw/plugin-sdk/cli-backend.null.User Impact
CLI backend plugin authors can support native assistant, thinking, tool-card, session, usage, result, and error events for non-built-in JSONL dialects without patching core. Existing built-in parsers remain the fallback and unchanged backends keep their current behavior.
Maintainer Sponsorship
Accepted on July 29, 2026. This additive parser hook belongs in the public CLI backend plugin SDK: it keeps dialect-specific parsing in the backend owner, preserves the built-in JSONL fallback, and limits plugin-reported tool activity to display metadata rather than trusted host execution.
Evidence
7693d35c36016a7f1ceaff69f3fc7e29956451cd68dbf92281ccb89d88ecda76f48231d609f1ccd5242c08b48c89b1c0dc22e30d0b66e7a1f2f7f02fcli-output, backend resolution, and production executor composition.TMPDIR; targeted formatting, oxlint, diff check, and dedicated autoreview (0.98) passed.tsgo, focusedoxlint, SDK surface check, SDK API baseline, docs map, docs formatting,oxfmt, andgit diff --check: passed.