Skip to content

[Communication] PR2: Set up IADS proxy for Mailbox use#213

Open
Joseph0120 wants to merge 28 commits into
masterfrom
joseph/communication_delay_PR2
Open

[Communication] PR2: Set up IADS proxy for Mailbox use#213
Joseph0120 wants to merge 28 commits into
masterfrom
joseph/communication_delay_PR2

Conversation

@Joseph0120

Copy link
Copy Markdown
Collaborator

Files Modified:

IadsCommsAgent.cs -> IADS Proxy for supporting mailbox message sending and recieving. Created a proxy that extends IAgent so that Mailbox can support IADS. Mailbox only supports Agents and adding a proxy makes IADS a part of an agent.

@stacklane-pr-stack-visualizer

stacklane-pr-stack-visualizer Bot commented Apr 1, 2026

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds the IadsCommsAgent class to handle mailbox communication as a proxy. The review feedback suggests correcting a typo in the class description and replacing Time.time with a deterministic fallback value for elapsed time.

Comment thread Assets/Scripts/IADS/IadsCommsAgent.cs Outdated
Comment thread Assets/Scripts/IADS/IadsCommsAgent.cs Outdated
@Joseph0120 Joseph0120 changed the title [Communication] Set up IADS proxy for Mailbox use. [Communication] PR2: Set up IADS proxy for Mailbox use Apr 1, 2026
@coderabbitai

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new Unity MonoBehaviour IadsCommsAgent (Assets/Scripts/IADS/IadsCommsAgent.cs) implementing IAgent as a comms-only mailbox proxy. It exposes serialized references and kinematic fields, property mappings (Position/Transform, Speed, orientation vectors, InverseRotation), ElapsedTime access via SimManager, an idempotent Terminate() with OnTerminated, and many IAgent methods that throw NotSupportedException. Also adds messaging primitives (IMessagePayload, Message types, payloads, PendingMessage), EditMode tests validating wiring, termination and PendingMessage validation, and updates to package manifest/lockfile and a regenerated protobuf runtime header.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • tryuan99
  • daniellovell
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: setting up an IADS proxy for mailbox use, which aligns with the primary implementation of IadsCommsAgent.
Description check ✅ Passed The description directly relates to the changeset, explaining that IadsCommsAgent was created as a proxy extending IAgent to enable mailbox support for IADS.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch joseph/communication_delay_PR2

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.

@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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Assets/Scripts/IADS/IadsCommsAgent.cs`:
- Line 4: Update the class-level comment at the top of IadsCommsAgent.cs (the
comment referring to the IADS Proxy for supporting mailbox message sending and
recieving) to correct the typo by changing "recieving" to "receiving" so the
comment reads "IADS Proxy for supporting mailbox message sending and receiving."
- Around line 21-24: The HierarchicalAgent property may be null when
OnTerminated handlers access it; ensure it cannot be null by initializing
_hierarchicalAgent and guarding accesses: set a safe default in IadsCommsAgent
(e.g., instantiate a new HierarchicalAgent or a lightweight placeholder into the
backing field _hierarchicalAgent), and also add null-checks where OnTerminated
handlers dereference agent.HierarchicalAgent (or bail out early) to avoid race
conditions; update the HierarchicalAgent getter/setter to validate assigned
values (throw or log) so callers cannot set it to null.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2c791cae-aa45-48c9-bc64-d51cb1c61988

📥 Commits

Reviewing files that changed from the base of the PR and between 589802e and b203cf9.

📒 Files selected for processing (1)
  • Assets/Scripts/IADS/IadsCommsAgent.cs

Comment thread Assets/Scripts/IADS/IadsCommsAgent.cs Outdated
Comment thread Assets/Scripts/IADS/IadsCommsAgent.cs

@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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Assets/Scripts/IADS/IadsCommsAgent.cs`:
- Line 57: Fix the typo in the comment inside IadsCommsAgent (file/class
IadsCommsAgent.cs) — change "Setting ElpasedTime has to be dependent on
SimManager to have uniform clock time." to "Setting ElapsedTime has to be
dependent on SimManager to have uniform clock time." so the comment reads
correctly.

In `@Assets/Tests/EditMode/IadsCommsAgentTests.cs`:
- Around line 71-75: The test currently uses a hard-coded compiler backing field
name in SetSimManagerInstance; instead use the SimManager.Instance property via
reflection: locate the PropertyInfo for "Instance" on typeof(SimManager)
(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), call
PropertyInfo.SetValue(null, simManager) if a setter exists, and if not present
throw a clear exception indicating the Instance property is read-only so the
test fails with an actionable message; update references to FieldInfo/GetField
to use PropertyInfo/GetProperty and keep method name SetSimManagerInstance and
symbol SimManager.Instance for locating the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7c09a180-3b32-46b3-af37-c58ffb263e43

📥 Commits

Reviewing files that changed from the base of the PR and between b203cf9 and 0f2c041.

⛔ Files ignored due to path filters (1)
  • Assets/Scripts/Generated/Proto/CommunicationConfig.cs is excluded by !**/generated/**
📒 Files selected for processing (3)
  • Assets/Scripts/IADS/IadsCommsAgent.cs
  • Assets/Tests/EditMode/IadsCommsAgentTests.cs
  • Assets/Tests/EditMode/IadsCommsAgentTests.cs.meta

Comment thread Assets/Scripts/IADS/IadsCommsAgent.cs
Comment thread Assets/Tests/EditMode/IadsCommsAgentTests.cs Outdated
Base automatically changed from joseph/communication_delay_PR1 to master May 11, 2026 03:46
@Joseph0120 Joseph0120 force-pushed the joseph/communication_delay_PR2 branch from 0f2c041 to 8ed1ce6 Compare May 16, 2026 21:32

@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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@Assets/Scripts/Agents/Messaging/PendingMessage.cs`:
- Around line 15-18: The PendingMessage constructor currently allows invalid
deliverAt values; validate deliverAt in the PendingMessage(float deliverAt,
Message message) constructor to ensure it's a finite, non-negative number
(reject float.IsNaN(deliverAt), float.IsInfinity(deliverAt) and deliverAt < 0)
and throw an ArgumentOutOfRangeException (or ArgumentException) naming deliverAt
if validation fails; keep the existing null check for Message and only assign
DeliverAt and Message after validation.

In `@Assets/Tests/EditMode/IadsCommsAgentTests.cs`:
- Around line 12-23: The TearDown currently nulls the global SimManager by
calling SetSimManagerInstance(null) and does not restore the prior singleton;
capture the existing SimManager.Instance in SetUp (e.g., store in a private
field like _previousSimManager) before calling SetSimManagerInstance(null) and
then restore it in TearDown by calling
SetSimManagerInstance(_previousSimManager) (ensure restoration happens before or
after destroying _agent as appropriate); update the SetUp and TearDown methods
to use the private field and keep existing _agent cleanup intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a00ffbc5-6111-49c2-8a45-09b1d1811b18

📥 Commits

Reviewing files that changed from the base of the PR and between 0f2c041 and 8ed1ce6.

📒 Files selected for processing (7)
  • Assets/Scripts/Agents/Messaging/IMessagePayload.cs
  • Assets/Scripts/Agents/Messaging/Message.cs
  • Assets/Scripts/Agents/Messaging/MessagePayload.cs
  • Assets/Scripts/Agents/Messaging/PendingMessage.cs
  • Assets/Scripts/IADS/IadsCommsAgent.cs
  • Assets/Tests/EditMode/IadsCommsAgentTests.cs
  • Assets/Tests/EditMode/IadsCommsAgentTests.cs.meta

Comment thread Assets/Scripts/Agents/Messaging/PendingMessage.cs Outdated
Comment thread Assets/Tests/EditMode/IadsCommsAgentTests.cs Outdated

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Tools/pb/run_config_pb2.py (1)

5-16: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin protobuf runtime to the generated requirement (7.34.1)

Tools/pb/run_config_pb2.py includes an import-time ValidateProtobufRuntimeVersion(..., 7, 34, 1, ...) check, so any environment with a different google.protobuf runtime will fail to import. The repo doesn’t contain common Python dependency manifests with a protobuf pin, so CI/dev must install protobuf==7.34.1 (or regenerate the checked-in _pb2.py with the protobuf version you intend to support).

🤖 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 `@Tools/pb/run_config_pb2.py` around lines 5 - 16, The checked-in generated
file run_config_pb2.py calls ValidateProtobufRuntimeVersion(..., 7, 34, 1) which
will break imports unless the environment uses protobuf 7.34.1; either add an
explicit pin for protobuf==7.34.1 to the project dependency manifests used by
CI/dev (e.g., requirements.txt or pyproject.toml/poetry.lock) so installers will
install that exact runtime, or regenerate the _pb2.py files with the protobuf
tool version you want to support and update the generated
ValidateProtobufRuntimeVersion call accordingly; locate run_config_pb2.py and
the CI/dependency manifest to apply the change.
🤖 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.

Outside diff comments:
In `@Tools/pb/run_config_pb2.py`:
- Around line 5-16: The checked-in generated file run_config_pb2.py calls
ValidateProtobufRuntimeVersion(..., 7, 34, 1) which will break imports unless
the environment uses protobuf 7.34.1; either add an explicit pin for
protobuf==7.34.1 to the project dependency manifests used by CI/dev (e.g.,
requirements.txt or pyproject.toml/poetry.lock) so installers will install that
exact runtime, or regenerate the _pb2.py files with the protobuf tool version
you want to support and update the generated ValidateProtobufRuntimeVersion call
accordingly; locate run_config_pb2.py and the CI/dependency manifest to apply
the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ae663900-b359-4353-9a77-7aa5fbf3d4df

📥 Commits

Reviewing files that changed from the base of the PR and between 8ed1ce6 and 031b71f.

📒 Files selected for processing (5)
  • Assets/Scripts/Agents/Messaging/PendingMessage.cs
  • Assets/Tests/EditMode/IadsCommsAgentTests.cs
  • Packages/manifest.json
  • Packages/packages-lock.json
  • Tools/pb/run_config_pb2.py

@Joseph0120

Copy link
Copy Markdown
Collaborator Author

@tryuan99 Github tests are failing despite the code working locally. Any reason?

@tryuan99

Copy link
Copy Markdown
Member

Two things you should do first:

  • Revert all changes to package-lock.json
  • Merge in maser into this branch. IMessagePayload.cs is not a new change in this PR

@tryuan99 tryuan99 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are there 500k lines of deletion? Are you sure they're all necessary?


// IADS Proxy for supporting mailbox message sending and receiving.

public class IadsCommsAgent : MonoBehaviour, IAgent {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not inherit from AgentBase or even DummyAgent?

@Joseph0120 Joseph0120 May 30, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I thought AgentBase is only for physical agents (ie. mass and velocity and other parameters). Goal of IadsCommsAgent is just to add a communication "interface" for the IADS.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not necessarily, I think. Right now, you're implementing a lot of pieces of the interface that make it seem like a dummy agent.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you addressed this? @Joseph0120

Comment thread Assets/Scripts/IADS/IadsCommsAgent.cs Outdated
Comment thread Assets/Scripts/IADS/IadsCommsAgent.cs
Comment thread Assets/Tests/EditMode/IadsCommsAgentTests.cs Outdated
@Joseph0120

Joseph0120 commented May 30, 2026

Copy link
Copy Markdown
Collaborator Author

Why are there 500k lines of deletion? Are you sure they're all necessary?

@tryuan99

The deletions are because I deleted the Assets/UnityTechnologies/ParticlePack and I let unity regenerate it. Im not sure if it is the correct procedure.

At least it works; I think it is because of the version mismatches (new computer).

But it seems like a conflict in the particle pack. I wonder if the particle pack is crucial for this project? Wondering what was the purpose of the particle pack in the beginning when you imported it?

@Joseph0120 Joseph0120 requested a review from tryuan99 May 30, 2026 15:33
@tryuan99 tryuan99 requested a review from daniellovell May 30, 2026 17:15
@tryuan99

Copy link
Copy Markdown
Member

@daniellovell Could you please help review the particle pack changes?

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.

2 participants