Skip to content

fix: preserve client working directories during fingerprint scrubbing - #23

Merged
rynfar merged 2 commits into
rynfar:mainfrom
sergiomarquezdev:codex/preserve-client-directory-verbatim
Oct 15, 2026
Merged

rynfar merged 2 commits into
rynfar:mainfrom
sergiomarquezdev:codex/preserve-client-directory-verbatim

Conversation

@sergiomarquezdev

Copy link
Copy Markdown
Contributor

When a client working directory contains OpenCode or OhMyOpenCode, the current scrubber rewrites the path to the assistant. Other prose rules can truncate a path such as /tmp/You are powered by the model named Demo before keepClientCwd sees it. Meridian then extracts incorrect client metadata and may fall back to the server directory or adopt a different existing directory.

This change separates generated environment blocks and the canonical cwd block retained by a previous scrub before applying the prose rules. It restores the cwd at the same position, removes the duplicate environment preamble, and preserves idempotence without placeholders or shared request state. It also recognizes CRLF environment input.

The new regressions cover Windows and Unix paths, spaces, brand and instruction-like directory names, both modes, repeated scrubbing, preserved tool/project guidance, and independent project requests. This is independent of the optional Primary working directory form addressed by #22. No package version or dependency changes are included.

Validation:

  • Before the patch, 23 of the 24 new regression tests fail against the base source. Published npm 0.2.3 also reproduces three path corruptions; the compiled patch fixes them, with three ordinary prose/no-cwd controls unchanged.
  • npm ci --ignore-scripts, npm run build, and bun test: 52 tests pass. Independent code and specification reviews also pass.
  • Native Windows OpenCode 2.0.27 integration with opencode-with-claude 1.11.1 and the locally built scrub package: three concurrent projects, including OpenCode and OhMyOpenCode project, preserve their directories. Each executes a relative file read and continues with the correct marker. The production Meridian 1.79 cwd parser and fingerprint function return the three correct directories and distinct conversation fingerprints.
  • Three title requests and manual compaction complete; the local compaction priorities appear once per request and the HTTP beta header remains removed.

The integration uses an HTTP fixture through the plugin's existing MERIDIAN_PATH entrypoint. It exercises the actual CLI, plugin, transport, and client tools; it does not qualify Claude account authentication or SDK inference. The tested tarball is a local build of this source, not a published npm release.

@rynfar
rynfar merged commit c59fa18 into rynfar:main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants