Repository navigation
fix: Code Mode rejects division after optional property access - #196785
Conversation
Co-authored-by: vincentkoc <[email protected]>
Worked on by: - @vincentkoc Co-authored-by: vincentkoc <[email protected]> OpenClaw-Publication: c65a8e11-78d4-847b-85c7-6dc3dba5d0cc
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR patches Acorn to accept division after optional property access and preserves the patched parser in published packages. Example: Code Mode executes
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored draft open: it addresses a documented current-main defect, and source review found no actionable introduced bug. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCode Mode parses submitted JavaScript with Acorn before module-access validation and Node or QuickJS execution; package producers must preserve the patched parser in installed artifacts. flowchart TD
A[Agent JavaScript] --> B[Acorn syntax parser]
B --> C[Module access validation]
C --> D[Node or QuickJS executor]
D --> E[Execution result]
F[Patched dependency packaging] --> B
Technical reviewBest possible solution: Repair Acorn's paired token-context owners and ship those exact bytes through the existing package producers. Do we have a high-confidence way to reproduce the issue? The exact failure is documented on current main and explained by Acorn's ordinary-dot-only token-context guards; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch addresses the parser owner directly, preserves matching class/function cleanup, and reuses existing packaging machinery without rewriting guest source or adding a competing parser. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against afaaa8d287a3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +41, Docs +33, Config +5, Other +80. Total +159 across 15 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 10, 2026, 1:19 PM ET / 18:19 UTC. |
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…law#196785) * fix: accept division after optional property access Co-authored-by: vincentkoc <[email protected]> * fix: Code Mode rejects division after optional property access Worked on by: - @vincentkoc Co-authored-by: vincentkoc <[email protected]> OpenClaw-Publication: c65a8e11-78d4-847b-85c7-6dc3dba5d0cc --------- Co-authored-by: vincentkoc <[email protected]>
What Problem This Solves
Fixes: Code Mode rejects valid JavaScript when division follows optional access to a keyword or contextual-name property, such as
value?.return / 2 / 3.User Impact
These expressions execute without extra parentheses. Shell commands, malformed JavaScript, and module access remain rejected before nested tool dispatch. There are no version upgrades, configuration changes, or migration steps.
Scoped maintainer proof exception, November 12: @vincentkoc explicitly approved landing this PR using the verified production-tool, parser, packaging and review evidence while waiving only the missing isolated Gateway/real-agent/real-model proof. That test remains unexecuted: the normal agent CLI refused an agent-exec invocation because it would lose inter-session attribution. The marker and guard were preserved; no alternate dispatch route or credential substitution was used. Full CI completed with five reproduced inherited-main failures, detailed below; CI is not green. Landing must use the native exact-head inherited-failure route and still satisfy current dependency, security, enforced-review and writer-authority checks. This exception does not waive any tool or security guard.
Why This Change Was Made
Patch Acorn 8.19.0 at its token-context owner, including matching
class/functionidentifier cleanup, rather than rewriting guest source. Both published module formats are regenerated from canonical upstream source.Keep those patched bytes in npm and ClawHub artifacts. Codex explicitly selects Acorn for bundling while retaining its native-heavy full-dependency opt-out. Unselected patches and blanket bundling still fail closed; global bundling cannot pull in the native platform closure.
Evidence
of/generator-yieldsiblings; shell, syntax, import and require controls reject before dispatch. This is not a Gateway/model end-to-end claim or live Team deployment.a0c232f2ebf962d44aa8b8e5942a1a2586a232f932556b5a0049807c1caa56f4.37a3b162a0c58aaceb1634aaef726d0e178a529c..2ff3e3f51750d95ed1a42b9892fc8a1b9b35e39b: scoped-clean, no findings. It reviewed supplied source without project-code execution and noted unavailable broader unchanged context. Hosted ClawSweeper completed the published5f5518bf4321f9038581df3d882aa5021f2467d7review on November 10 with no source findings and the same missing live-proof qualification. No duplicate request was made for this unchanged source.Exact-head CI: reproduced inherited-main failures
Run 43150112087, attempt 1 completed failure on November 12 at 04:17:08 UTC. All 162 jobs were terminal: 133 succeeded, 23 skipped, five test jobs failed, and the downstream
openclaw/ci-gatefailed. CI is not green.The job tested merge
ee1d4a395be9e1f05da2fb269f10b7459e705c6fof this head into main9c2e60f7d003e30d417d60655a4bd2dc56168e8d. Each exact assertion reproduced with the unchanged failed sub-shard/singleton selection on both that merge and unpatched contemporaneous main:[]undefined/foreign_key_check/rejection, no throwBoth sides used independent frozen dependencies and the identical pinned OpenClaw Bun engine, SHA-256
0cef667e2f3fd465b6429904ed074381a679be379ec44fa42b5f460ed118b2b8. The local Node launcher was 26.12.1 versus CI 24.22.1, so local hardware/launcher is not claimed to clone the runner. The same signatures reproduced on both sides; 21 relevant source fingerprints were unchanged. Original base and candidate also both passed the 174-test CLI shard. Only failed sub-shards were replayed; Telegram's source-specific QA builds passed on both trees. No introducing-commit bisection was added for memory or Telegram.These controlled observations supplement the automatic classifier's unknown/no-matching-main-job result. They establish inherited failure attribution, not a passing status. No source, assertion, timeout or baseline was weakened, and no CI rerun, dispatch or green-chasing push occurred. @vincentkoc's November 12 scoped land instruction authorizes the native inherited-failure exception for these identified baseline failures; the separate missing real Gateway/agent/model proof is explicitly waived as recorded above, not claimed as passed. Applicable dependency, security, enforced-review and live writer-authority admission remain required.
Contributor credit
Requested and scoped with @vincentkoc, including explicit approval for this dependency patch.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by