Skip to content

refactor(tool-call-repair): simplify redundant guards - #166192

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/tool-call-repair-guards
Oct 6, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/tool-call-repair-guards

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Removes redundant guard bookkeeping in tool-call repair as part of the requested internal simplification.

User Impact

No intended runtime behavior or public API change. Fence protection, ambiguous-input fallback, and incomplete payload handling remain unchanged.

Why This Change Was Made

The fence scanner already rejects indented openings before recording protection, so it can record the resolved fence state directly. An early incomplete-prefix return duplicates the later undefined block-end return.

Evidence

  • Independent source/diff review and scoped autoreview found no actionable findings; the reviewed two-file patch is unchanged after incorporating main.
  • The original aggregate failed on the baseline CallBrief re-export. Its other 31 commands passed, including the separately completed nine-command suffix. The blocker was repaired separately in fix(voice-call): unblock unused-export checks #166147.
  • Refreshed native plan: all 32 commands covered by seven input-qualified retained passes and 25 fresh passes, including all three unused-export scans and all 27 core-test type graphs.
  • Fresh whole focused suites passed: protection fast path (13), stream normalizer (52), payload (27), and the SDK tool-payload consumer (38): 130 tests across four files, zero skips.
  • Exact-head required hosted CI and native landing gates remain required. This does not claim complete CommonMark coverage or live-provider proof.

@vincentkoc vincentkoc self-assigned this Oct 6, 2026
@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review October 6, 2026 16:16
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 6, 2026
@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 12:34 PM ET / 16:34 UTC (Revision 2).

ClawSweeper review

What this changes

The PR simplifies incomplete-payload handling and Markdown fence bookkeeping in OpenClaw’s plain-text tool-call repair package without changing intended behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: the cleanup remains absent from current main, and source review found no introduced correctness defect. This member-authored PR is also protected from automatic closure.

Priority: P3
Reviewed head: 3ebc785e6031373521b1f0bbeeedd6656e812a1f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving simplification with relevant reported validation and no actionable finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored cleanup is exempt from external-contributor runtime proof. Source inspection connects both changes to existing payload and streaming-protection behavior; reported focused tests are supplemental, and no live run is claimed. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored cleanup is exempt from external-contributor runtime proof. Source inspection connects both changes to existing payload and streaming-protection behavior; reported focused tests are supplemental, and no live run is claimed. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduction: The merge-base-to-head patch contains only the two claimed simplifications. Both complete original modules and head modules were inspected.
Incomplete-payload equivalence: After invalid scans continue, an incomplete prefix with no completeEnd reaches the remaining undefined block-end return with no intervening mutation. Complete prefixes and malformed-candidate progress retain their existing paths.
Fence-protection equivalence: applyLine marks indented openings structurally unknown before setting fenceChar. The caller rejects that state before recording protection, so accepted openings begin at the line start and the removed whitespace bookkeeping is unreachable.
Findings None None.
Security None None.

How this fits together

Tool-call repair processes model text that contains tool-call syntax, separating calls from visible replies. Its Markdown protection scanner preserves literal examples and falls back to the full parser when ownership is uncertain.

flowchart TD
  A[Model text] --> B[Tool-call repair]
  B --> C[Markdown protection]
  C --> D{Protection certain?}
  D -->|No| E[Full Markdown parser]
  D -->|Yes| F[Payload scanner]
  E --> F
  F --> G[Tool calls and visible text]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -11. Total -11 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 1 12 -11
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 1 12 -11

Review metrics

None.

Technical review

Best possible solution:

Keep the simpler implementation while preserving conservative Markdown fallback and incomplete-payload semantics.

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

Not applicable: this PR proposes behavior-preserving cleanup rather than a reported bug; equivalence was checked in source without executing tests.

Is this the best way to solve the issue?

Yes: both removals follow existing scanner invariants and avoid adding another owner, API, or compatibility path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 817706084620.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is bounded internal cleanup with no intended runtime or public API change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored cleanup is exempt from external-contributor runtime proof. Source inspection connects both changes to existing payload and streaming-protection behavior; reported focused tests are supplemental, and no live run is claimed. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction: The merge-base-to-head patch contains only the two claimed simplifications. Both complete original modules and head modules were inspected. (packages/tool-call-repair/src/payload.ts:550, 3ebc785e6031)
  • Incomplete-payload equivalence: After invalid scans continue, an incomplete prefix with no completeEnd reaches the remaining undefined block-end return with no intervening mutation. Complete prefixes and malformed-candidate progress retain their existing paths. (packages/tool-call-repair/src/payload.ts:557, 3ebc785e6031)
  • Fence-protection equivalence: applyLine marks indented openings structurally unknown before setting fenceChar. The caller rejects that state before recording protection, so accepted openings begin at the line start and the removed whitespace bookkeeping is unreachable. (packages/tool-call-repair/src/protection-fast-path.ts:63, 3ebc785e6031)
  • Production fallback boundary: The stream normalizer uses this scanner only for opted-in fence-compatible resolvers; undefined verdicts still use snapshot protection or the full protected-range resolver. This is an OpenClaw-owned implementation and establishes no dependency on the Codex harness. (packages/tool-call-repair/src/stream-normalizer.ts:1344, 3ebc785e6031)
  • Current-main necessity: Comparison with fetched main shows that both redundant sections remain there; the submitted cleanup is still distinct. Release-file inspection could not complete because the required historical blob was unavailable, so no shipped-version claim is made. (packages/tool-call-repair/src/protection-fast-path.ts, 817706084620)
  • Verified merge scope: Raw test-merge parents match the pinned base followed by the exact PR head. Its result changes only the two introduced paths; endpoint drift does not remove unrelated base work. (cceb5e3f027b)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Harjoth Khara: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-06T16:21:53.688Z sha 3ebc785 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc merged commit abeb5f1 into main Oct 6, 2026
155 checks passed
@vincentkoc
vincentkoc deleted the refactor/tool-call-repair-guards branch October 6, 2026 17:05
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
## What Problem This Solves

Removes redundant guard bookkeeping in tool-call repair as part of the requested internal simplification.

## User Impact

No intended runtime behavior or public API change. Fence protection, ambiguous-input fallback, and incomplete payload handling remain unchanged.

## Why This Change Was Made

The fence scanner already rejects indented openings before recording protection, so it can record the resolved fence state directly. An early incomplete-prefix return duplicates the later undefined block-end return.

## Evidence

- Independent source/diff review and scoped autoreview found no actionable findings; the reviewed two-file patch is unchanged after incorporating main.
- The original aggregate failed on the baseline `CallBrief` re-export. Its other 31 commands passed, including the separately completed nine-command suffix. The blocker was repaired separately in openclaw#166147.
- Refreshed native plan: all 32 commands covered by seven input-qualified retained passes and 25 fresh passes, including all three unused-export scans and all 27 core-test type graphs.
- Fresh whole focused suites passed: protection fast path (13), stream normalizer (52), payload (27), and the SDK tool-payload consumer (38): 130 tests across four files, zero skips.
- Exact-head required hosted CI and native landing gates remain required. This does not claim complete CommonMark coverage or live-provider proof.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant