Skip to content

[fix] Stop accepted shared session executions - #6587

Merged
mmabrouk merged 1 commit into
release/v0.115.1from
fix/release-1151-shared-stop
Sep 5, 2026
Merged

[fix] Stop accepted shared session executions#6587
mmabrouk merged 1 commit into
release/v0.115.1from
fix/release-1151-shared-stop

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Sep 5, 2026

Copy link
Copy Markdown
Member

Context

With shared session delivery enabled, clicking Stop after approving a shell command could leave the command running. The browser received the accepted execution ID, but Stop waited for transcript metadata that the detached sender never receives.

Changes

The desktop and shared chat hooks now cache the execution ID as soon as the runner accepts the turn. Approval resumes can explicitly reaccept the same execution ID; stale transcript metadata still cannot restore a superseded ID.

How to review

Start with the accepted-ID setter in sessionEphemera.ts, then its two acceptance callbacks. The desktop regression asserts that Stop immediately sends cancellation with the accepted ID before transcript metadata arrives. Shared-hook and cache regressions cover detached delivery and same-execution approval resumes.

Tests

  • Reproduced on OSS preview twice: Stop issued no cancellation request and the shell completed.
  • New regression assertions failed before the fix and passed afterward.
  • Desktop session hook: 10 passed. Chat package: 761 passed. Chat TypeScript check passed.
  • Frontend pnpm lint-fix: all 25 tasks passed.
  • Candidate live browser capture is pending while the isolated local frontend is prepared; deployment QA will verify desktop and mobile Stop before release signoff.

What to QA

  • With shared delivery enabled, approve a long shell command and click Stop in desktop and mobile. The browser sends cancellation for the current execution and the command stops.
  • Resume another approval, then Stop again. Reaccepting the same execution must work; stale metadata must not target an older run.

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 5, 2026 6:23pm UTC

Request Review

@mmabrouk

mmabrouk commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

@coderabbitai review

Please review the accepted-execution Stop guard, especially same-ID approval resumes and protection against stale transcript metadata. Independent agent review found no blocking issue; desktop and shared regressions failed before the fix and passed afterward. This release hotfix will wait for an actual completed review before merging.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Team

Run ID: 66cdd722-2c5e-476d-8418-4ca1a9d3496e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Team

Run ID: e75220df-0594-4553-bb25-949cd4273ebd

📥 Commits

Reviewing files that changed from the base of the PR and between 4e5e172 and a4401d9.

📒 Files selected for processing (6)
  • web/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.test.ts
  • web/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.ts
  • web/packages/agenta-chat/src/hooks/useAgentConversation.ts
  • web/packages/agenta-chat/src/state/sessionEphemera.ts
  • web/packages/agenta-chat/tests/unit/hooks/useAgentConversation.test.ts
  • web/packages/agenta-chat/tests/unit/state/sessionEphemera.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved stopping of shared chat sessions immediately after execution is accepted.
    • Users can now reliably cancel an accepted execution even before transcript details become available.
    • Prevented stale turn information from interfering with cancellation of the current session execution.

Walkthrough

The change records accepted execution IDs as session turn IDs. Chat stop handling can then cancel an accepted execution before transcript metadata arrives. Tests cover state authority, shared-stream acceptance, and early cancellation.

Changes

Accepted session turn tracking

Layer / File(s) Summary
Accepted turn state
web/packages/agenta-chat/src/state/sessionEphemera.ts, web/packages/agenta-chat/tests/unit/state/sessionEphemera.test.ts
Adds setAcceptedSessionTurnId and verifies that only accepted turn IDs are readable and stale updates cannot replace them.
Chat hook integration
web/packages/agenta-chat/src/hooks/useAgentConversation.ts, web/packages/agenta-chat/tests/unit/hooks/useAgentConversation.test.ts, web/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.ts, web/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.test.ts
Both chat hooks persist accepted execution IDs. Tests verify that stop handling targets the accepted execution before transcript metadata arrives.

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

Merge Risk: ⚪ Minimal · up to a4401

Stop can now target an accepted shared-session shell execution immediately, including before transcript metadata is available, with coverage for early cancellation and stale turn handling. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6…
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 clearly and concisely describes the main change: fixing cancellation for accepted shared session executions.
Description check ✅ Passed The description directly explains the cancellation issue, the implementation changes, regression coverage, test results, and QA scope.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-1151-shared-stop

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.

@mmabrouk

mmabrouk commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

Independent reviews are complete with no blocking findings. CodeRabbit reviewed all six files through a4401d941cf935503f60a28488086c9e9648df49 and reported no actionable comments (review run e75220df-0594-4553-bb25-949cd4273ebd).

Candidate unit, type and lint checks passed. Local browser validation remains outstanding: the isolated dev frontend encountered host file-watcher exhaustion and did not become usable within the navigation window. The release conductor will verify the actual deployed candidate before release signoff. No source changes followed review.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@mmabrouk I will review the accepted-execution Stop guard. I will check same-ID approval resumes and protection against stale transcript metadata.

⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mmabrouk
mmabrouk merged commit 2528652 into release/v0.115.1 Sep 5, 2026
45 checks passed
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-6587.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-6587-6a5884a
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-09-05T18:37:15.860Z

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant