fix: accept escaped provider strings#28
Merged
Merged
Conversation
d771dec to
d5ed87f
Compare
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.
d5ed87f to
a0e8d31
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
&strfields.Cow<str>for provider-owned dynamic string fields where escaped content is expected, including Windows paths and prompt/command text.Fixes #26
Root cause
serde_jsoncannot deserialize escaped JSON strings into borrowed&strbecause escape decoding requires an owned buffer. Windows paths such asD:\\Inputare encoded with escapes, so the Claude watch parser failed withexpected a borrowed stringbefore 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-featurescargo +nightly test -Zbuild-dir-new-layout -p agent-sessions --no-default-features --features claude,watchcargo +nightly test -Zbuild-dir-new-layout -p agent-sessions --no-default-features --features codex,watchcargo +nightly test -Zbuild-dir-new-layout -p agent-sessions --no-default-features --features copilot,watchcargo +nightly test -Zbuild-dir-new-layout --workspace --all-features -- --quiet