Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

[2026-09-08] merging staging to main

merged#2730CedarCopilot

CedarCopilot wants to merge 1 commit into main from staging

Not deployedTimeline and evidence
  1. Opened
    Sep 8, 2026, 1:54 PM
  2. Merged
    Sep 8, 2026, 2:02 PM
  3. Sep 8, 2026, 2:09 PM
  4. Live on staging, live on prod, observed
    Pending
  5. Not deployed

    Not deployed

    Pending

Libra has no production signal for this change yet because it has not deployed. Libra checks hourly for 3 days after each deploy.

Greptile Summary

This change preserves Mastra Tool prototypes when wrapping Master family tools and adds regression coverage for the previous request-context loss. The new source guard still misses several ordinary raw-spread forms that produce the same broken runtime object, and the wrapper contains a repository-rule violation that must be corrected before merging.

Confidence Score: 4/5

Do not merge until the repository-required removal of the unnecessary assertion is complete. The source-guard coverage gap is non-blocking but should be addressed to prevent the same request-context regression from being reintroduced through an unrecognized wrapper form.

The final findings are limited to improvement-level issues.

Files Needing Attention: apps/server/src/mastra/tools/master-surface.ts and apps/server/src/mastra/tools/tests/no-raw-tool-spread.test.ts

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a P2 finding proof and attached supporting artifacts for review.
  • T-Rex produced a P1 finding proof for a posted finding.
  • General contract validation summarized a no-raw-tool-spread issue that breaks the Tool prototype and Mastra's dispatch, as shown by the before/after observations in the logs.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Raw tool-spread source guard misses shorthand and ordinary-property variants

    • Bug
      • At apps/server/src/mastra/tools/__tests__/no-raw-tool-spread.test.ts:62, /\{\s*\.\.\.[A-Za-z_$][\w$]*\s*,\s*execute\s*:/ matches only a spread immediately followed by an explicit execute: key. It does not identify const execute = wrapped; return { ...tool, execute };, { ...tool, name: 'wrapped', execute: wrapped }, or { name: 'wrapped', ...tool, execute }. The validation executed the actual source regex and found all 3 harmful variants evade it.
    • Cause
      • The regex requires both execute: syntax and immediate adjacency after the identifier spread; shorthand properties omit : and intervening/preceding ordinary properties violate the positional requirement.
    • Fix
      • Replace the narrow regex heuristic with source parsing/AST inspection that identifies object literals containing both an identifier spread and an execute property (including shorthand), regardless of property order; alternatively broaden the guard deliberately and add contract cases for shorthand and intervening-property layouts.

    T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
### Issue 1
apps/server/src/mastra/tools/master-surface.ts:132
**Remove redundant assertion**

`wrapped
Show production surfaces and changed-file mapping

Production surfaces

Libra has not measured any production surfaces for this change yet.

Changed files → surfaces

  • apps/server/src/mastra/tools/__tests__/master-surface.test.tsno production surface mapped
  • apps/server/src/mastra/tools/__tests__/no-raw-tool-spread.test.tsno production surface mapped
  • apps/server/src/mastra/tools/master-surface.tsno production surface mapped