Skip to content

patch: Propagate optional session IDs through parsed touched lines#51

Draft
stefanskoricdev wants to merge 4 commits into
mainfrom
feat/conversations
Draft

patch: Propagate optional session IDs through parsed touched lines#51
stefanskoricdev wants to merge 4 commits into
mainfrom
feat/conversations

Conversation

@stefanskoricdev
Copy link
Copy Markdown
Contributor

@stefanskoricdev stefanskoricdev commented Jun 1, 2026

No description provided.

stefanskoricdev and others added 4 commits June 1, 2026 14:54
Add session_id: Option<String> to TouchedLine for traceability.

Extend parse_patch(input, session_id) and hunk parsing to stamp each added/removed touched line with the provided session ID.

Update patch parser consumers and tests to pass explicit None where no session context exists, and session IDs where available.

Keep patch/domain docs in sync with the parser and model contract.

Co-authored-by: SCE <sce@crocoder.dev>
Convert intersect_patches from .filter().cloned() to .filter_map() so that when a post-commit hunk line matches an available line, the resulting overlapping line inherits the session_id from the matched entry in the first patch (a). This ensures session provenance is preserved through intersection, matching the existing model_id inheritance pattern.

Co-authored-by: SCE <sce@crocoder.dev>
- Introduce ConversationRelated with schema-aligned fields (type, url) and add optional Conversation.related to the conversation payload model
- Omit related when absent via skip_serializing_if = "Option::is_none" and initialize new entries with related: None in trace construction
- Update context/sce/agent-trace-minimal-generator.md to reflect the current payload/type shape

Co-authored-by: SCE <sce@crocoder.dev>
…sion_id provenance

Conversation.related was always None despite the ConversationRelated domain type existing in the schema. Downstream consumers need session provenance to trace which sessions contributed to each AI-authored conversation.

Extract non-empty session_id values from touched lines on the matched intersection_patch hunk, deduplicate with deterministic BTreeSet ordering, and emit conversation.related as session link entries.

The related field is omitted (None) when no included lines provide session_id values.

Co-authored-by: SCE <sce@crocoder.dev>
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.

1 participant