Skip to content

Conversation

@pierre-lehnen-rc
Copy link
Contributor

@pierre-lehnen-rc pierre-lehnen-rc commented Oct 6, 2025

Proposed changes (including videos or screenshots)

Issue(s)

VAI-152

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features

    • Added support for a new hangup reason: “another-client.”
    • Expanded accepted hangup reasons to include “input-error” and “unknown.”
    • Improved multi-client behavior: if a call is already ignored by one client, hangup now correctly informs the server as “another-client.”
  • Bug Fixes

    • More reliable hangup processing across devices by safely bypassing a validation step when “another-client” applies, reducing false errors.
  • Documentation

    • Clarified signal-handling scenarios for hangups involving another client.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 6, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2025

⚠️ No Changeset found

Latest commit: 4342551

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pierre-lehnen-rc pierre-lehnen-rc added this to the 7.11.0 milestone Oct 6, 2025
@pierre-lehnen-rc pierre-lehnen-rc marked this pull request as ready for review October 6, 2025 19:56
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

Adds a new hangup reason 'another-client', updates schemas/types accordingly, adjusts client-side hangup flow to send an 'another-client' hangup when a normal hangup occurs while the contract is ignored, and updates server-side signal processing to skip contract validation for 'another-client' hangups. Also adds a clarifying comment in call signal processing.

Changes

Cohort / File(s) Summary of Changes
Client behavior: hangup flow
packages/media-signaling/src/lib/Call.ts
Adds early hangup path: if reason is 'normal' and contract state is 'ignored', send hangup with reason 'another-client' and return before normal flow.
Server/internal processing
ee/packages/media-calls/src/internal/SignalProcessor.ts, ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts
SignalProcessor: introduces skipContractCheck for hangups with reason 'another-client' to bypass contractId mismatch validation. CallSignalProcessor: adds descriptive comment about the new scenario; no logic changes.
Signaling definitions and schema
packages/media-signaling/src/definition/call/IClientMediaCall.ts, packages/media-signaling/src/definition/signals/client/hangup.ts
Adds 'another-client' to CallHangupReason; updates clientMediaSignalHangupSchema.reason enum to include 'input-error', 'unknown', and 'another-client'. No structural changes to types/schemas beyond enum expansion.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Client UI
  participant Call as ClientMediaCall
  participant Tx as Transporter
  participant S as Server
  participant SP as SignalProcessor
  participant OC as Other Client(s)

  rect rgba(220,240,255,0.5)
  note over Call: New/changed flow when contract is "ignored"
  UI->>Call: hangup(reason="normal")
  alt contract is "ignored"
    Call->>Tx: send hangup(reason="another-client")
    Tx-->>S: ClientMediaSignalHangup
    S->>SP: process hangup
    note over SP: skipContractCheck for "another-client"
    SP-->>OC: propagate hangup
    Call-->>UI: return (early)
  else normal flow
    Call->>Tx: send hangup(reason="normal")
    Tx-->>S: ClientMediaSignalHangup
    S->>SP: process hangup (normal checks)
    SP-->>OC: propagate hangup
  end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • tassoevan

Poem

A click, a hop—another client rings,
I thump the line, and snip the strings.
Contracts skipped, the burrow’s clear,
Signals scurry far and near.
With ears up high, I end the fight—
One client hops, the rest hang tight.
🐇📞✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly describes the regression being addressed by this changeset and directly relates to the core issue of enabling the hangup button on other clients by fixing the inter-client hangup signal handling. It succinctly captures the user-visible problem without extraneous detail.
Linked Issues Check ✅ Passed The implemented changes introduce the 'another-client' hangup reason, update the signal processor to bypass contract checks for this reason, adjust schemas and type definitions, and add the corresponding call flow logic so that hangup requests from secondary clients succeed, fully satisfying the objective of restoring cross-client hangup functionality from VAI-152.
Out of Scope Changes Check ✅ Passed All modifications are focused on supporting the 'another-client' hangup flow—updating schemas, types, signal processing, and call logic—and no unrelated or out-of-scope code has been introduced.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/media-calls-hangup-another-client

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
ee/packages/media-calls/src/internal/SignalProcessor.ts (1)

89-94: Bypass looks correct; add audit log for traceability.

The skip is safe given the earlier actor check (Lines 71–87). Consider logging when skipping the contract check to aid auditing/debugging.

Suggested tweak:

 // Hangup requests from different clients won't be coming from the signed client
 const skipContractCheck = signal.type === 'hangup' && signal.reason === 'another-client';
 
 // Ignore signals from different sessions if the actor is already signed
-if (!skipContractCheck && callActor.contractId && callActor.contractId !== signal.contractId) {
+if (!skipContractCheck && callActor.contractId && callActor.contractId !== signal.contractId) {
   return;
 }
+if (skipContractCheck) {
+  logger.info({
+    msg: 'Processing hangup from another client session',
+    callId: call._id,
+    uid,
+    actorRole: role,
+    actorContractId: callActor.contractId,
+    signalContractId: signal.contractId,
+  });
+}
packages/media-signaling/src/lib/Call.ts (1)

518-523: Debounce 'another-client' hangup to avoid duplicate sends.

Multiple quick clicks can send repeated hangups before server ends the call. Set a local guard:

-// If the hangup was requested by the user but the call is not happening here, send an 'another-client' hangup request to the server and wait for the server to hangup the call
-if (reason === 'normal' && this.contractState === 'ignored') {
-  this.config.transporter.hangup(this.callId, 'another-client');
-  return;
-}
+// If the hangup was requested by the user but the call is not happening here,
+// send an 'another-client' hangup request and avoid repeated sends
+if (reason === 'normal' && this.contractState === 'ignored') {
+  this.endedLocally = true;
+  this.config.transporter.hangup(this.callId, 'another-client');
+  return;
+}
packages/media-signaling/src/definition/signals/client/hangup.ts (1)

43-47: Schema sync looks good; add cross‑ref comment.

Enum matches CallHangupReason updates. Consider adding a note to keep this list in sync with IClientMediaCall.ts to avoid drift.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9f8a603 and 4342551.

📒 Files selected for processing (5)
  • ee/packages/media-calls/src/internal/SignalProcessor.ts (1 hunks)
  • ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts (1 hunks)
  • packages/media-signaling/src/definition/call/IClientMediaCall.ts (2 hunks)
  • packages/media-signaling/src/definition/signals/client/hangup.ts (1 hunks)
  • packages/media-signaling/src/lib/Call.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: Builds matrix rust bindings against alpine
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (2)
ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts (1)

85-90: Good documentation update.

The added scenario note aligns with the server-side skip for 'another-client' hangups.

packages/media-signaling/src/definition/call/IClientMediaCall.ts (1)

29-44: Type addition is correct and consistent.

'another-client' reason is properly added and documented to sync with schema.

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.44%. Comparing base (9f8a603) to head (4342551).
⚠️ Report is 1 commits behind head on release-7.11.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-7.11.0   #37151      +/-   ##
==================================================
+ Coverage           67.41%   67.44%   +0.03%     
==================================================
  Files                3329     3329              
  Lines              113383   113383              
  Branches            20569    20575       +6     
==================================================
+ Hits                76433    76471      +38     
+ Misses              34351    34318      -33     
+ Partials             2599     2594       -5     
Flag Coverage Δ
e2e 57.26% <ø> (-0.03%) ⬇️
unit 71.23% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pierre-lehnen-rc pierre-lehnen-rc added the stat: QA assured Means it has been tested and approved by a company insider label Oct 6, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 6, 2025
@kodiakhq kodiakhq bot merged commit c36ae37 into release-7.11.0 Oct 6, 2025
43 of 45 checks passed
@kodiakhq kodiakhq bot deleted the fix/media-calls-hangup-another-client branch October 6, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants