Skip to content

Fix archived sessions remaining pinned - #6902

Closed
ubaids12 wants to merge 1 commit into
Agenta-AI:mainfrom
ubaids12:main
Closed

ubaids12 wants to merge 1 commit into
Agenta-AI:mainfrom
ubaids12:main

Conversation

@ubaids12

Copy link
Copy Markdown

What changed?
This change fixes a bug where a session could remain marked as pinned even after it was archived or deleted.

The root cause was that the pinned-session state was stored separately from the archived state and was never explicitly cleared during archive/delete flows. As a result, the UI continued to treat the archived session as pinned.

This fix clears the pin state when a session is archived or deleted so archived sessions no longer appear as pinned and no longer behave as pinned items in the session list.

Why was this change needed?
Users expected archived sessions to be removed from the active pinned state. Previously, archived sessions could still show up as pinned, which was confusing and inconsistent with the expected behavior.

What problem does it solve?
It ensures the pin flag is reset when a session is archived or removed, keeping the pinned state aligned with the actual session lifecycle .

Testing
Verified locally
Not run locally for this change. The repository work was limited to code edits only, without dependency installation or local runtime validation, per the request.

Added or updated tests
Updated the session regression coverage to include the pinned archive/delete flow so this edge case is captured in future test runs.

QA follow-up
Validate that archiving a pinned session removes the pin immediately in the UI.
Validate that deleting a pinned session also clears its pinned state.
Validate pinned sessions still remain pinned when active and not archived.
Validate archive/unarchive behavior in the sidebar and session list views.
Confirm there are no regressions in other session actions such as rename, open, and share link.
Demo
N/A for this change. No local app demo was captured because this branch was updated without running the app locally.

Checklist
Demo shows the real app running this branch (not a mock-up or recreated UI), or is marked N/A
Relevant tests pass locally
Relevant linting and formatting pass locally
I have signed the CLA, or I will sign it when the bot prompts me

@github-actions

Copy link
Copy Markdown
Contributor

Hi @ubaids12, thanks for opening a pull request. 🙏

This PR was automatically closed because it does not yet meet our contribution requirements:

  • The Summary section is missing or empty. Describe what changed and why using the PR template.
  • This PR changes functional code (SDK, API, or frontend) but includes no demo. Add a screenshot or short video of the change. Only test-only, docs-only, or chore changes may skip it.

We ask for this so every change is documented and demonstrably tested before review.

How to get it reopened
Update the PR description (and add a demo recording if your change touches functional code). The bot reopens the PR automatically once the requirements are met. No need to open a new one.

See the Contributing guide and Creating your first PR. If you think this was closed in error, leave a comment and a maintainer will take a look.

@github-actions github-actions Bot added the incomplete-pr PR is missing required template sections or a demo recording label Sep 16, 2026
@github-actions github-actions Bot closed this Sep 16, 2026
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


ubaids12 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 81cf11cd-ec2b-4a25-b967-c5c76f90e54f

📥 Commits

Reviewing files that changed from the base of the PR and between e5643f0 and 5b64e64.

📒 Files selected for processing (5)
  • web/oss/src/components/AgentChatSlice/state/sessions.delete.test.ts
  • web/oss/src/components/AgentChatSlice/state/sessions.ts
  • web/packages/agenta-sessions-ui/src/useSessionActions.tsx
  • web/packages/agenta-sessions/src/state/index.ts
  • web/packages/agenta-sessions/src/state/pins.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Archived or deleted sessions are now automatically removed from the pinned sessions list.
    • Pin state remains consistent across session actions, preventing archived or deleted sessions from remaining pinned.
  • Tests
    • Added coverage verifying that archiving a pinned session removes its pin.

Walkthrough

The change adds explicit session pin removal and applies it when sessions are archived or deleted. The session action hook also unpins sessions before these actions. Tests cover pin removal during archiving.

Changes

Session pin cleanup

Layer / File(s) Summary
Explicit pin removal
web/packages/agenta-sessions/src/state/pins.ts, web/packages/agenta-sessions/src/state/index.ts
Adds removeSessionPinAtom, exports it, and reuses it from toggleSessionPinAtom when removing a pin.
Session lifecycle integration
web/oss/src/components/AgentChatSlice/state/sessions.ts, web/oss/src/components/AgentChatSlice/state/sessions.delete.test.ts
Session deletion and archiving remove the session ID from pinned state. A test verifies pin removal during archiving.
Session action integration
web/packages/agenta-sessions-ui/src/useSessionActions.tsx
Archive and delete actions unpin the target session when it is pinned.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

incomplete-pr PR is missing required template sections or a demo recording

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants