Skip to content

Harden rcf_patch.py against property-order drift in OpenClaw replaceConfigFile #2875

@ericksoa

Description

@ericksoa

PR #2696 replaces the brittle exact-string Dockerfile patch for OpenClaw replaceConfigFile with scripts/rcf_patch.py, which is a real improvement and matches the current openclaw@2026.4.24 compiled shape.

One follow-on hardening gap: the regex is whitespace-tolerant, but still assumes the object passed to tryWriteSingleTopLevelIncludeMutation({...}) lists snapshot before nextConfig: params.nextConfig.

Current order works:

tryWriteSingleTopLevelIncludeMutation({
  snapshot,
  nextConfig: params.nextConfig
})

Equivalent reversed order currently fail-closes:

tryWriteSingleTopLevelIncludeMutation({
  nextConfig: params.nextConfig,
  snapshot
})

That is not a current 2026.4.24 blocker, but it is the same class of future compiled-dist drift this helper is meant to reduce. A good follow-up would make the matcher genuinely order-independent, or narrow the claim/comment so it only promises whitespace tolerance.

@BenediktSchackenberg, thanks again for #2696. If you agree with this follow-up and want to take it, that would be welcome, but no pressure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions