Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ function ResultDisplay({
}

return (
<HoverCard content={<ResultDisplayContent result={result} />}>
<HoverCard
content={<ResultDisplayContent result={result} />}
className="w-80"
>
<Badge color={rule ? "green" : "red"} className="whitespace-nowrap">
{rule
? rule.name
Expand Down Expand Up @@ -136,7 +139,9 @@ export function ResultDisplayContent({ result }: { result: RunRulesResult }) {
type: action.type,
label: action.label,
folderName: action.folderName,
content: action.content,
content:
action.content +
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Dec 16, 2025

Choose a reason for hiding this comment

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

P0: Debug/test code left in production: This line appends a hardcoded nonsensical URL string to action.content, corrupting the displayed content. This appears to be accidental test data that should be removed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/app/(app)/[emailAccountId]/assistant/ResultDisplay.tsx, line 143:

<comment>Debug/test code left in production: This line appends a hardcoded nonsensical URL string to `action.content`, corrupting the displayed content. This appears to be accidental test data that should be removed.</comment>

<file context>
@@ -136,7 +139,9 @@ export function ResultDisplayContent({ result }: { result: RunRulesResult }) {
                   folderName: action.folderName,
-                  content: action.content,
+                  content:
+                    action.content +
+                    &quot;https://www.google.comasdjhgaghjdsghjasdgjasdjhasd&quot;,
                   to: action.to,
</file context>
Fix with Cubic

"https://www.google.comasdjhgaghjdsghjasdgjasdjhasd",
Comment on lines +142 to +144
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggest removing the hardcoded URL concatenation to action.content. It looks like leftover debug code and corrupts displayed content; use action.content as-is.

Suggested change
content:
action.content +
"https://www.google.comasdjhgaghjdsghjasdgjasdjhasd",
content: action.content,

🚀 Reply to ask Macroscope to explain or update this suggestion.

👍 Helpful? React to give us feedback.

to: action.to,
subject: action.subject,
cc: action.cc,
Expand Down
7 changes: 6 additions & 1 deletion apps/web/components/HoverCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
HoverCardContent,
HoverCardTrigger,
} from "@/components/ui/hover-card";
import { cn } from "@/utils";

export function HoverCard(props: {
children: React.ReactNode;
Expand All @@ -12,7 +13,11 @@ export function HoverCard(props: {
return (
<HoverCardUi openDelay={100} closeDelay={100}>
<HoverCardTrigger asChild>{props.children}</HoverCardTrigger>
<HoverCardContent className={props.className} align="start" side="right">
<HoverCardContent
className={cn("overflow-hidden", props.className)}
align="start"
side="right"
>
{props.content}
</HoverCardContent>
</HoverCardUi>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/utils/ai/reply/reply-context-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ When searching, use natural language queries that would find relevant emails. Th
Search Tips:
- The search looks for EXACT text matches in emails
- IMPORTANT: Try simpler queries if you don't get results for your first search
- Try the subject line first if it contains the main topic
- Do NOT use field prefixes like subject:, from:, to:, or label: - just use plain text queries

Example search queries:
- "order status" OR "shipment arrival" OR "tracking number"
Expand Down
6 changes: 5 additions & 1 deletion apps/web/utils/email/microsoft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,11 @@ export class OutlookProvider implements EmailProvider {

// For Outlook, separate search queries from date filters
// Microsoft Graph API handles these differently
const originalQuery = options.query || "";
// Strip Gmail-style prefixes that don't work with Microsoft Graph
const originalQuery = (options.query || "").replace(
/\b(subject|label):/gi,
"",
);

// Build date filter for Outlook (no quotes for DateTimeOffset comparison)
const dateFilters: string[] = [];
Expand Down
8 changes: 8 additions & 0 deletions apps/web/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,13 @@ const REDACTED_FIELD_NAMES = new Set([
"authorization",
]);

// Fields containing email/message content - redacted in production unless debug logs enabled
const CONTENT_FIELD_NAMES = new Set(["text", "body"]);

/**
* Recursively processes an object to protect sensitive data:
* - REDACTED_FIELD_NAMES: Replaced with boolean (never logged)
* - CONTENT_FIELD_NAMES: Replaced with boolean in production (unless debug logs enabled)
* - SENSITIVE_FIELD_NAMES: Hashed in production (raw in dev/test)
*
* Only works server-side - client-side logs are visible in browser anyway.
Expand All @@ -247,6 +251,10 @@ function hashSensitiveFields<T>(obj: T, depth = 0): T {
if (REDACTED_FIELD_NAMES.has(key)) {
processed[key] = !!value;
}
// Redact content fields in production (unless debug logs enabled)
else if (CONTENT_FIELD_NAMES.has(key) && !env.ENABLE_DEBUG_LOGS) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CONTENT_FIELD_NAMES are redacted whenever !env.ENABLE_DEBUG_LOGS, but the comment says this should only happen in production. Consider adding env.NODE_ENV === "production" to the condition so text/body aren’t hidden in dev/test.

Suggested change
else if (CONTENT_FIELD_NAMES.has(key) && !env.ENABLE_DEBUG_LOGS) {
else if (CONTENT_FIELD_NAMES.has(key) && env.NODE_ENV === "production" && !env.ENABLE_DEBUG_LOGS) {

🚀 Reply to ask Macroscope to explain or update this suggestion.

👍 Helpful? React to give us feedback.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Dec 16, 2025

Choose a reason for hiding this comment

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

P2: Code doesn't match documented behavior: comment says content fields are "redacted in production" but the condition doesn't check for production environment. This will redact content in dev/test when ENABLE_DEBUG_LOGS is false, which may hide useful debugging information during development.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/utils/logger.ts, line 255:

<comment>Code doesn&#39;t match documented behavior: comment says content fields are &quot;redacted in production&quot; but the condition doesn&#39;t check for production environment. This will redact content in dev/test when `ENABLE_DEBUG_LOGS` is false, which may hide useful debugging information during development.</comment>

<file context>
@@ -247,6 +251,10 @@ function hashSensitiveFields&lt;T&gt;(obj: T, depth = 0): T {
         processed[key] = !!value;
       }
+      // Redact content fields in production (unless debug logs enabled)
+      else if (CONTENT_FIELD_NAMES.has(key) &amp;&amp; !env.ENABLE_DEBUG_LOGS) {
+        processed[key] = !!value;
+      }
</file context>
Fix with Cubic

processed[key] = !!value;
}
// Hash emails in production only (server-side only)
else if (
SENSITIVE_FIELD_NAMES.has(key) &&
Expand Down
Loading