Skip to content

fix(config): preserve user-set meta.lastTouchedVersion during config set - #80941

Closed
alexuser wants to merge 1 commit into
openclaw:mainfrom
alexuser:fix/preserve-meta-lastTouchedVersion
Closed

alexuser wants to merge 1 commit into
openclaw:mainfrom
alexuser:fix/preserve-meta-lastTouchedVersion

Conversation

@alexuser

Copy link
Copy Markdown
Contributor

Summary

Fixes #80849.

stampConfigVersion() in src/config/io.ts unconditionally overwrote meta.lastTouchedVersion and meta.lastTouchedAt on every config write. This caused openclaw config set meta.lastTouchedVersion <value> to silently report success while the value was immediately overridden.

Changes

  • stampConfigVersion now accepts an optional explicitSetPaths parameter.
  • If the user explicitly set meta.lastTouchedVersion or meta.lastTouchedAt (via explicitSetPaths), the stamp skips overwriting that field.
  • Writes without explicitSetPaths (e.g., normal gateway startup) continue to stamp both fields as before.

Verification

  • Added 3 regression tests in src/config/io.write-config.test.ts covering:
    • Preserving meta.lastTouchedVersion when explicitly set
    • Preserving meta.lastTouchedAt when explicitly set
    • Still stamping both fields when explicitSetPaths is absent
  • All existing tests pass locally.

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 12, 2026
@clawsweeper

clawsweeper Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: the same config metadata false-success bug is already tracked by a better canonical PR that preserves the documented auto-managed contract, while this branch makes those system-owned fields user-controlled and lacks real behavior proof.

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Review details

Best possible solution:

Continue the fix on the canonical rejection-at-the-CLI-boundary PR, keeping stampConfigVersion authoritative for meta.lastTouchedVersion and meta.lastTouchedAt.

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

Yes. The linked issue has live command output, and current-main source shows config set values are applied before serialization, then stampConfigVersion overwrites those fields while the CLI reports Updated.

Is this the best way to solve the issue?

No. This PR solves the false-success symptom by changing the documented auto-managed fields into user-preserved fields, while the narrower maintainable fix is to reject or diagnose those paths before writing as tracked in #80856.

Security review:

Security review cleared: The diff only changes local config serialization behavior and tests; I found no dependency, workflow, permission, secret-handling, or external code-execution change.

What I checked:

  • Current auto-managed metadata contract: Current main documents meta as system-maintained and specifically says meta.lastTouchedVersion and meta.lastTouchedAt are auto-set on OpenClaw config writes. (src/config/schema.help.ts:5, ac017fa4439b)
  • Current write-time stamping path: Current main still has stampConfigVersion overwrite lastTouchedVersion with VERSION and lastTouchedAt with a fresh ISO timestamp before serialization. (src/config/io.ts:897, ac017fa4439b)
  • This PR changes field ownership: The PR diff changes stampConfigVersion so explicitSetPaths for the two meta fields prevent the automatic stamp, allowing user-supplied values to persist for documented auto-managed fields. (src/config/io.ts:913, 88f548119f49)
  • Canonical open replacement PR: The related open PR at fix(config): reject auto-managed meta.lastTouched* paths in config set/unset #80856 targets the same issue by rejecting direct set/unset operations for the auto-managed meta paths at the CLI boundary, and its discussion includes after-fix terminal proof. (src/cli/config-cli.ts:155, f855f8ef580d)
  • Duplicate search: GitHub search for the central user problem found the canonical open PR and this PR as the matching PRs for config set meta.lastTouchedVersion.
  • Proof status: The PR body lists regression tests but no after-fix real config set run, and live status includes failing Real behavior proof checks. (88f548119f49)

Likely related people:

  • steipete: Blame and GitHub path history tie the current config stamping and adjacent explicit config persistence work to this contributor, including the merged explicit-default config write fix. (role: recent area contributor; confidence: high; commits: abb4f96b81df, 2e400c5b76db, e21e83db97ef; files: src/config/io.ts, src/cli/config-cli.ts, src/config/io.write-prepare.ts)
  • hclsys: Co-authored the merged explicit-default persistence work that introduced the explicitSetPaths plumbing adjacent to this bug class. (role: adjacent contributor; confidence: medium; commits: 2e400c5b76db; files: src/config/io.ts, src/cli/config-cli.ts, src/config/io.write-prepare.ts)
  • vincentkoc: Recent path history shows config CLI and config IO recovery/unset work in the same broad config mutation surface. (role: recent adjacent contributor; confidence: medium; commits: 5c844bea8807, fb73f2161e01, 3c5169254362; files: src/cli/config-cli.ts, src/config/io.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against ac017fa4439b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

1 participant