Skip to content

fix: accept escaped provider strings#28

Merged
tuchg merged 1 commit into
mainfrom
fix/issue-26-escaped-provider-strings
May 23, 2026
Merged

fix: accept escaped provider strings#28
tuchg merged 1 commit into
mainfrom
fix/issue-26-escaped-provider-strings

Conversation

@tuchg

@tuchg tuchg commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix provider parsers that deserialized escaped dynamic strings into borrowed &str fields.
  • Use Cow<str> for provider-owned dynamic string fields where escaped content is expected, including Windows paths and prompt/command text.
  • Add escaped Windows string regressions across all agent-session providers: Claude, Codex, Copilot, Cursor, Gemini, and Pi.

Fixes #26

Root cause

serde_json cannot deserialize escaped JSON strings into borrowed &str because escape decoding requires an owned buffer. Windows paths such as D:\\Input are encoded with escapes, so the Claude watch parser failed with expected a borrowed string before emitting session updates.

Scope

This is not Claude-specific. The patch covers the provider boundary where each format owns its parsing rules. Dynamic text/path fields were changed to Cow<str>; constrained tag/id/timestamp fields remain borrowed because they are not user/path text and broad conversion would add schema churn without addressing the observed failure mode.

Verification

  • cargo +nightly test -Zbuild-dir-new-layout -p agent-sessions escaped_windows --all-features
  • cargo +nightly test -Zbuild-dir-new-layout -p agent-sessions --no-default-features --features claude,watch
  • cargo +nightly test -Zbuild-dir-new-layout -p agent-sessions --no-default-features --features codex,watch
  • cargo +nightly test -Zbuild-dir-new-layout -p agent-sessions --no-default-features --features copilot,watch
  • cargo +nightly test -Zbuild-dir-new-layout --workspace --all-features -- --quiet

@tuchg tuchg force-pushed the fix/issue-26-escaped-provider-strings branch 2 times, most recently from d771dec to d5ed87f Compare May 23, 2026 06:42
serde_json cannot deserialize escaped JSON strings, such as Windows paths, into borrowed &str fields because decoding escapes requires an owned buffer. This caused provider watch parsing to fail before emitting updates.

Convert provider-owned dynamic string fields to Cow where escaped content is expected: Claude cwd/progress/input metadata, Codex escaped path/error metadata, and Copilot chat workspace/prompt fields. Keep constrained tag/id/timestamp fields borrowed to avoid broadening provider schemas unnecessarily.

Add escaped Windows string regressions across all agent-session providers: Claude, Codex, Copilot, Cursor, Gemini, and Pi.
@tuchg tuchg force-pushed the fix/issue-26-escaped-provider-strings branch from d5ed87f to a0e8d31 Compare May 23, 2026 06:46
@tuchg tuchg merged commit bb49857 into main May 23, 2026
6 checks passed
@tuchg tuchg deleted the fix/issue-26-escaped-provider-strings branch May 23, 2026 06:51
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.

windows 启动提示warning,且微信收不到消息

1 participant