Skip to content

fix: address CodeRabbit findings from PR #41 - #83

Merged
jusso-dev merged 1 commit into
mainfrom
fix/coderabbit-pr41-followups
Jul 28, 2026
Merged

fix: address CodeRabbit findings from PR #41#83
jusso-dev merged 1 commit into
mainfrom
fix/coderabbit-pr41-followups

Conversation

@jusso-dev

@jusso-dev jusso-dev commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses the unresolved CodeRabbit review threads from closed PR #41 (issue-40 work already on main via #42).

Finding Fix
Synthetic-cleanup unbounded body 1 MiB Content-Length + body-byte cap before JSON parse
DM invocation not atomic with message Write agent.direct_message.evaluate outbox in same tx as message; worker redrives via shared AgentDirectMessageDomainService
agents.invoke after eligibility leaks Capability check moved before agent_count / agent_unavailable
Archived connector stays hidden configure() clears archivedAt on update
Worker dispatch missing org header Send x-muster-organisation-id on gateway dispatch
Research compose assertion weak Service-scoped web/worker/postgres block asserts
Research status posts to archived rooms Join unarchived room + agent room membership
Known gateway token default Require MUSTER_AGENT_GATEWAY_TOKEN in Compose (no shared fallback)
Legacy audit integration.action.failed Added to legacy approvalId allow-list + test
Audit org id unvalidated Require UUID for MUSTER_AUDIT_ORGANISATION_ID
Hardcoded object-storage creds Require access/secret env; 30s request timeouts

Validation

  • pnpm --filter @muster/audit test
  • pnpm --filter @muster/evidence test
  • pnpm --filter @muster/worker test (research-config + suite)
  • typecheck: @muster/rooms, @muster/worker, @muster/web

Summary by CodeRabbit

  • New Features

    • Direct-message conversations can now automatically trigger eligible agent evaluations.
    • Previously archived connectors are restored when reconfigured.
    • Agent processing now preserves organization context for more reliable results.
  • Bug Fixes

    • Research status updates are restricted to active, authorized rooms and memberships.
    • Maintenance requests now reject oversized or malformed payloads with clearer errors.
    • Object-storage operations now enforce timeouts and required credentials.
  • Security & Reliability

    • Missing or invalid security configuration is now detected earlier.
    • Legacy audit records with omitted approval identifiers remain verifiable.

Harden direct-message agent invocation durability and eligibility disclosure,
reactivate archived connectors on reconfigure, require gateway and object-storage
secrets, and close remaining audit/research/storage review nits.
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c9438b4c-f0b1-4ee1-ab07-af4333854450

📥 Commits

Reviewing files that changed from the base of the PR and between 820eef1 and 33e57ef.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • apps/web/app/api/v1/maintenance/synthetic-cleanup/route.ts
  • apps/web/lib/agent-direct-message-domain.ts
  • apps/web/lib/connector-domain.ts
  • apps/worker/package.json
  • apps/worker/src/index.ts
  • apps/worker/src/research-config.test.ts
  • apps/worker/src/research-status.ts
  • docker-compose.yml
  • packages/audit/src/audit.test.ts
  • packages/audit/src/index.ts
  • packages/database/src/verify-audit-integrity.ts
  • packages/evidence/src/object-storage.test.ts
  • packages/evidence/src/object-storage.ts
  • packages/rooms/package.json
  • packages/rooms/src/agent-direct-message.ts
  • packages/rooms/src/index.ts

📝 Walkthrough

Walkthrough

Direct-message posting now emits evaluation jobs processed by the worker and queued through a shared rooms domain service. The change also adds request and object-storage safeguards, tightens research and runtime configuration checks, and extends audit compatibility validation.

Changes

Direct-message agent evaluation

Layer / File(s) Summary
Direct-message event production
packages/rooms/package.json, packages/rooms/src/index.ts, apps/web/lib/agent-direct-message-domain.ts
Direct root text messages in direct rooms emit idempotent evaluation outbox events, and the agent direct-message service is re-exported from @muster/rooms.
Direct-message queueing domain
packages/rooms/src/agent-direct-message.ts
AgentDirectMessageDomainService validates authorization and agent eligibility, computes idempotency data, and persists queued runs with events, audit records, and outbox entries.
Worker evaluation dispatch
apps/worker/package.json, apps/worker/src/index.ts
The worker handles evaluation jobs in process, builds an authorization subject, invokes maybeQueue, logs outcomes, and adds organisation scoping to gateway requests.

Platform and operational hardening

Layer / File(s) Summary
Request and object-storage safeguards
apps/web/app/api/v1/maintenance/synthetic-cleanup/route.ts, packages/evidence/src/object-storage.ts, packages/evidence/src/object-storage.test.ts
Synthetic cleanup validates body size and JSON parsing; object storage requires credentials and applies timeout signals to requests, with updated test setup.
Connector and research query constraints
apps/web/lib/connector-domain.ts, apps/worker/src/research-status.ts, apps/worker/src/research-config.test.ts
Connector updates clear archival state, research status writes require an active organisation-matching room and agent membership, and Compose allowlist tests inspect individual services.
Required runtime configuration
docker-compose.yml
The agent gateway token is now required during Compose configuration.

Audit validation updates

Layer / File(s) Summary
Audit compatibility and input validation
packages/audit/src/index.ts, packages/audit/src/audit.test.ts, packages/database/src/verify-audit-integrity.ts
Legacy approval-ID omission handling includes integration failures, with coverage for that case; audit organisation input now requires a valid UUID.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RoomPosting
  participant Outbox
  participant Worker
  participant AgentDirectMessageDomainService
  RoomPosting->>Outbox: Enqueue direct-message evaluation
  Outbox->>Worker: Deliver evaluation job
  Worker->>AgentDirectMessageDomainService: maybeQueue authorized message
  AgentDirectMessageDomainService->>Outbox: Enqueue agent run
Loading

Possibly related PRs

✨ 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/coderabbit-pr41-followups

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

@jusso-dev
jusso-dev merged commit 16d575b into main Jul 28, 2026
5 of 6 checks passed
@jusso-dev
jusso-dev deleted the fix/coderabbit-pr41-followups branch July 28, 2026 12:12
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.

1 participant