Skip to content

fix(qa): defer partial Crabline recorder rows#99649

Merged
RomneyDa merged 1 commit into
mainfrom
dallin/fix-native-command-json-flake
Jul 3, 2026
Merged

fix(qa): defer partial Crabline recorder rows#99649
RomneyDa merged 1 commit into
mainfrom
dallin/fix-native-command-json-flake

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Jul 3, 2026

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes #99648.

QA Lab polls Crabline's JSONL recorder while the provider is actively appending records. A read can end inside the final record, and the transport previously passed that fragment directly to JSON.parse. The observed failure was Unterminated string in JSON at position 191 in native-command-session-target.

Why This Change Was Made

  • Defer only a non-newline-terminated trailing record during normal polling and reset.
  • Parse the deferred record after Crabline finishes writing it.
  • Close Crabline before a strict final recorder sync so permanently truncated output still fails.
  • Keep newline-terminated malformed JSON visible as a parse failure.
  • Use one recorder-line policy for polling, reset cursor accounting, and terminal validation.

User Impact

Crabline-backed QA scenarios no longer fail when a recorder read overlaps a valid append. Corrupt completed records remain failures rather than being ignored.

Evidence

@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 6:18 PM ET / 22:18 UTC.

Summary
The PR updates QA Lab Crabline recorder sync to defer incomplete final JSONL rows during polling/reset, enforce strict final parsing after close, and add regression tests.

PR surface: Source +15, Tests +77. Total +92 across 2 files.

Reproducibility: yes. Current main source parses every non-empty active recorder fragment, and the linked issue plus PR tests provide a concrete split-write/reset path that reaches the reported JSON.parse failure.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: extensions/qa-lab/src/crabline-transport.test.ts, serialized state: extensions/qa-lab/src/crabline-transport.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #99648
Summary: This PR is the candidate fix for the canonical QA Lab bug about partially appended Crabline JSONL recorder rows.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • No automated repair job is needed because the PR is focused, has no actionable findings, and remains maintainer-labeled for human merge decision.

Security
Cleared: The diff is limited to QA Lab local recorder parsing and tests, with no workflow, dependency, permission, secret, publishing, or code-download surface change.

Review details

Best possible solution:

Land the focused recorder-tail fix after normal maintainer review; the linked bug can close after this PR merges.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main source parses every non-empty active recorder fragment, and the linked issue plus PR tests provide a concrete split-write/reset path that reaches the reported JSON.parse failure.

Is this the best way to solve the issue?

Yes. Using newline as the live completed-record boundary while keeping final cleanup strict is narrower and safer than catching or ignoring JSON.parse failures broadly.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 525c4c7ce1b8.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: The PR fixes an intermittent QA Lab Crabline smoke failure with limited product-runtime blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes focused terminal/Testbox evidence, and live PR-head CI shows QA Smoke CI and relevant checks passing for the reviewed head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes focused terminal/Testbox evidence, and live PR-head CI shows QA Smoke CI and relevant checks passing for the reviewed head.
Evidence reviewed

PR surface:

Source +15, Tests +77. Total +92 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 50 35 +15
Tests 1 77 0 +77
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 127 35 +92

What I checked:

  • Repository policy read: Root AGENTS.md and the scoped extensions guide were read fully; their deep-review, protected maintainer-label, extension-boundary, and dependency-contract guidance shaped this review. (AGENTS.md:36, 525c4c7ce1b8)
  • Current-main failure path: Current main still splits every non-empty recorder fragment and passes each new fragment to JSON.parse, so a read ending inside the active final row can throw before Crabline appends the newline. (extensions/qa-lab/src/crabline-transport.ts:233, 525c4c7ce1b8)
  • PR line policy: PR head adds readRecorderLines, which drops only a non-newline-terminated tail when incomplete tails are allowed and leaves newline-terminated malformed rows visible to JSON.parse. (extensions/qa-lab/src/crabline-transport.ts:55, d3d41d487bf1)
  • Strict final validation: PR head closes the adapter, waits for any in-flight sync, then performs a strict recorder snapshot so a permanently truncated final tail still fails instead of being silently ignored. (extensions/qa-lab/src/crabline-transport.ts:326, d3d41d487bf1)
  • Regression coverage: PR head adds focused tests for deferring a split JSONL tail, rejecting a newline-terminated malformed row, and rejecting a permanently truncated cleanup tail. (extensions/qa-lab/src/crabline-transport.test.ts:106, d3d41d487bf1)
  • Crabline dependency contract: @openclaw/[email protected] server implementations append recorder events as JSON.stringify(event) plus a newline, matching the PR's newline-as-completed-record boundary. (@openclaw/[email protected]/dist/src/servers/telegram.js:117)

Likely related people:

  • RomneyDa: GitHub history shows this account introduced the Crabline channel driver and made the latest substantive QA Lab Crabline transport/test changes before this PR. (role: feature owner and recent area contributor; confidence: high; commits: 63b13ea837fe, e701dc76b060, 8604dbdc93fb; files: extensions/qa-lab/src/crabline-transport.ts, extensions/qa-lab/src/crabline-transport.test.ts)
  • vincentkoc: Recent commits on the same Crabline QA transport path adjusted scoped package integration and retained delivery targets. (role: adjacent area contributor; confidence: medium; commits: c313642ae271, 009d6b261aad; files: extensions/qa-lab/src/crabline-transport.ts, extensions/qa-lab/src/crabline-transport.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@harjothkhara

Copy link
Copy Markdown
Contributor

Non-maintainer review pass on d3d41d487bf111fe345ac8dc4d13724cb868f1fe.

What I checked:

  • Read the applicable scoped guide, extensions/AGENTS.md; there is no narrower extensions/qa-lab/AGENTS.md.
  • Compared full extensions/qa-lab/src/crabline-transport.ts on current main against this PR head, not just the diff. The changed behavior is localized to recorder line splitting, syncRecorderSnapshot, reset cursor accounting, and final cleanup sync.
  • Checked linked issue [Bug]: QA Lab can parse partially appended Crabline JSONL records #99648 and duplicate/root-cause PR searches for 99648, partial recorder tail, Crabline recorder, and native-command-session-target; I only found this PR as the live fix for the exact issue.

Result:

  • I did not find a source-level blocker in this narrow pass. The fix defers only a non-newline-terminated JSONL tail during polling/reset, still lets newline-terminated malformed records reach JSON.parse, and does a strict sync after adapter.close() so a permanently truncated final tail still fails instead of being silently dropped.
  • Focused PR-head proof passed locally with Node v24.14.0:
/Users/harjothk/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin/node scripts/run-vitest.mjs extensions/qa-lab/src/crabline-transport.test.ts -- -t "partial recorder tail|malformed newline-terminated|permanently truncated" --reporter=verbose

Result: 1 test file passed; 3 tests passed, 15 skipped.

Residual scope: I did not rerun the full QA smoke scenario or the Testbox lane; this was a focused source review plus the new regression cases on the PR head.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 3, 2026
@RomneyDa

RomneyDa commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 3, 2026
@RomneyDa
RomneyDa merged commit 1cab479 into main Jul 3, 2026
212 of 222 checks passed
@RomneyDa
RomneyDa deleted the dallin/fix-native-command-json-flake branch July 3, 2026 22:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: QA Lab can parse partially appended Crabline JSONL records

2 participants