-
Notifications
You must be signed in to change notification settings - Fork 16
feat(events): preserve CLI context on session.resume #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -119,6 +119,39 @@ pub struct SessionStartData { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub struct SessionResumeData { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub resume_time: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub event_count: f64, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Optional CLI-supplied workspace context. Copilot CLI 1.0.35+ sends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// this object alongside the basic resume metadata so downstream | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// consumers (IDE integrations, session dashboards) can rebind to the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// right working directory, git branch, and remote without re-reading | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// the session store. Older CLI versions omit the field entirely, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// hence `Option` + `#[serde(default)]` keeps the type backward | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// compatible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub context: Option<SessionResumeContext>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Workspace context payload attached to a `session.resume` event by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Copilot CLI. Every field is optional because the CLI may omit any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// subset depending on whether the resumed session lives inside a git | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// repository and which host (IDE / terminal / etc.) initiated the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// resume. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(rename_all = "camelCase")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub struct SessionResumeContext { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub cwd: Option<String>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub git_root: Option<String>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub branch: Option<String>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub base_commit: Option<String>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub head_commit: Option<String>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub repository: Option<String>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+141
to
+153
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub cwd: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub git_root: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub branch: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub base_commit: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub head_commit: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub repository: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub cwd: Option<String>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub git_root: Option<String>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub branch: Option<String>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub base_commit: Option<String>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub head_commit: Option<String>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub repository: Option<String>, | |
| #[serde(skip_serializing_if = "Option::is_none")] |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regression-test doc comment references an external repo/POC document (“DevInSip POC-3”, “docs/POC_COPILOT_SDK.md”). That makes the test less self-contained and can become confusing/stale for future maintainers. Consider rewriting this comment to describe the provenance generically (e.g., “captured from Copilot CLI 1.0.35 wire trace”) without external repo names/paths.
| /// Regression fixture derived from the Copilot CLI 1.0.35 wire trace | |
| /// captured during DevInSip POC-3 (see docs/POC_COPILOT_SDK.md in the | |
| /// DevInSip repo). The CLI emits `session.resume` with an additional | |
| /// `context` object that the pre-patch SDK silently dropped, leaving | |
| /// downstream consumers (session binding, sidebar cwd) unable to | |
| /// recover the working directory without bypassing the SDK. | |
| /// Regression fixture derived from a Copilot CLI 1.0.35 wire trace. | |
| /// The CLI emits `session.resume` with an additional `context` object | |
| /// that the pre-patch SDK silently dropped, leaving downstream | |
| /// consumers (session binding, sidebar cwd) unable to recover the | |
| /// working directory without bypassing the SDK. |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test’s comments/error message say the context must “round-trip”, but the test only verifies deserialization (from_json). Either extend the test to serialize back to JSON and re-parse, or adjust the wording to avoid implying serialization coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contextis anOption, so missing JSON already deserializes toNonewithout#[serde(default)]. The doc comment also implies#[serde(default)]is needed for backward compatibility, which isn’t true forOptionfields. Consider droppingdefaulthere (keepingskip_serializing_if) and adjusting the comment accordingly.