Skip to content

chore(sessions): don't allow packages to request user data for the session - #993

Merged
evanspearman merged 1 commit into
mainfrom
evan/removepackagepatches
Jul 28, 2026
Merged

chore(sessions): don't allow packages to request user data for the session#993
evanspearman merged 1 commit into
mainfrom
evan/removepackagepatches

Conversation

@evanspearman

@evanspearman evanspearman commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

Removed the ability for packages to request user data on session creation including file patches and inherited environment variables.

Testing

Verified that my claude config was not uploaded when creating a session with claude-code

Note

Strip package-supplied patches and user data vars from sessions before composition

  • Adds Contribution::drop_package_supplied_patches_and_user_data_vars() in compose.rs that removes package-sourced patches and package-sourced vars carrying user data from a Contribution in-place.
  • SessionComposer::compose in composer.rs now calls this method before destructuring and gating, so packages can no longer inject patches or user data vars into the final session composition or the pending client state.
  • Behavioral Change: package-supplied patches and user-data-carrying vars are now silently dropped rather than passed through to the client.

Macroscope summarized 49c3545.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented package-supplied patches and user-data variables from being included in session compositions.
    • Ensured equivalent values provided by other sources continue to be applied correctly.
    • Prevented filtered items from appearing in pending session responses.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Package-supplied patches and user-data variables are filtered from contributions before session composition. Tests verify that static package variables and equivalent entries from other sources remain available.

Changes

Package contribution filtering

Layer / File(s) Summary
Filter package entries and validate retention
crates/sessions/src/core/compose.rs
Adds contribution filtering for package patches and user-data variables, with tests covering retained static package and non-package entries.
Apply filtering during composition
crates/sessions/src/daemon/composer.rs
Invokes contribution filtering before pending-path handling and composition assembly.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: norrietaylor

Poem

I nibbled the package crumbs away,
Kept static greens for another day.
Shared entries stayed in the row,
While user-data sprouts said go.
The composer now hops clean and bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The summary and testing sections are present, but the required checklist section is missing. Add the Checklist section and address Docs updated and BREAKING CHANGE if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise, conventional, and accurately summarizes the main behavioral change.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/sessions/src/daemon/composer.rs (1)

156-164: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a composer-level regression test for this filtering boundary.

The helper tests validate the predicate, but no test shown here proves that SessionComposer::compose invokes it before either the fast path or pending transformation. Assert that package patches and user-data vars are absent from the resulting response/state while eligible static and non-package entries remain.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/sessions/src/daemon/composer.rs` around lines 156 - 164, Add a
regression test around SessionComposer::compose that supplies package patches
and user-data vars alongside eligible static and non-package entries. Assert the
composed response/state excludes the package-supplied data while retaining
eligible entries, covering both the fast path and pending transformation
boundary as applicable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/sessions/src/daemon/composer.rs`:
- Around line 156-164: Add a regression test around SessionComposer::compose
that supplies package patches and user-data vars alongside eligible static and
non-package entries. Assert the composed response/state excludes the
package-supplied data while retaining eligible entries, covering both the fast
path and pending transformation boundary as applicable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cb9af8bd-004d-4518-b345-8d8ba25fb284

📥 Commits

Reviewing files that changed from the base of the PR and between f9de7a1 and 49c3545.

📒 Files selected for processing (2)
  • crates/sessions/src/core/compose.rs
  • crates/sessions/src/daemon/composer.rs

@evanspearman
evanspearman merged commit 264f1d5 into main Jul 28, 2026
29 checks passed
@evanspearman
evanspearman deleted the evan/removepackagepatches branch July 28, 2026 15:53
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.

3 participants