Skip to content

Conversation

@aliu39
Copy link
Member

@aliu39 aliu39 commented Dec 15, 2025

Adds a to copy the conversation (messages, tool calls, tool links + status (error, empty, success)) to clipboard as markdown text
Screenshot 2025-12-15 at 11 10 07 AM

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 15, 2025
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #104936      +/-   ##
===========================================
- Coverage   80.52%    80.41%   -0.11%     
===========================================
  Files        9398      9393       -5     
  Lines      405708    403360    -2348     
  Branches    25923     25919       -4     
===========================================
- Hits       326710    324378    -2332     
+ Misses      78558     78542      -16     
  Partials      440       440              

@aliu39 aliu39 marked this pull request as ready for review December 15, 2025 17:26
@aliu39 aliu39 requested a review from a team as a code owner December 15, 2025 17:26
@roaga
Copy link
Member

roaga commented Dec 15, 2025

  1. when i click the button i see a weird flashing thing
  2. do you wanna just do chat-sharing properly instead? I think that will be much more useful and is what people want rather than reading through a markdown copy-pasted chat

@JoshFerge
Copy link
Member

  1. when i click the button i see a weird flashing thing
  2. do you wanna just do chat-sharing properly instead? I think that will be much more useful and is what people want rather than reading through a markdown copy-pasted chat

sometimes people might want to copy their chat and paste into their local AI agent as well

@aliu39
Copy link
Member Author

aliu39 commented Dec 15, 2025

flashing fixed by removing the loading state, callback happens way too fast to need it

@roaga
Copy link
Member

roaga commented Dec 15, 2025

I see some urls on tool blocks now have an organizations/org_slug prefix? And at least sometimes it causes the whole site to reload for me when I follow those links?

@aliu39
Copy link
Member Author

aliu39 commented Dec 15, 2025

I see some urls on tool blocks now have an organizations/org_slug prefix? And at least sometimes it causes the whole site to reload for me when I follow those links?

@roaga is this on the copy to clipboard output, or the actual block data / when clicking links in the chat?
my changes shouldn't affect how the chat links are rendered

Copy link
Member

@roaga roaga left a comment

Choose a reason for hiding this comment

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

what's the sample.json for?

@roaga
Copy link
Member

roaga commented Dec 15, 2025

I see some urls on tool blocks now have an organizations/org_slug prefix? And at least sometimes it causes the whole site to reload for me when I follow those links?

@roaga is this on the copy to clipboard output, or the actual block data / when clicking links in the chat? my changes shouldn't affect how the chat links are rendered

ok nvm i cross-checked with prod and seems nothing new

@aliu39
Copy link
Member Author

aliu39 commented Dec 16, 2025

what's the sample.json for?

shoot sorry i accid commited

Comment on lines +737 to +744
.filter(item => item !== null)
.sort((a, b) => a.toolCallIndex - b.toolCallIndex);

// Create mapping from tool call index to sorted link index
const toolCallToLinkMap = new Map<number, number>();
mappedLinks.forEach((item, sortedIndex) => {
toolCallToLinkMap.set(item.toolCallIndex, sortedIndex);
});
Copy link

Choose a reason for hiding this comment

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

Bug: The getValidToolLinks function filters out null values without a proper TypeScript type guard, leading to a compilation error under strictNullChecks when accessing properties on the filtered array.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

In the getValidToolLinks function, an array is created by a .map operation that can return objects or null. A subsequent .filter(item => item !== null) is used to remove the null values. However, this is not a proper TypeScript type guard. Because the project's TypeScript configuration has strictNullChecks enabled, the compiler still considers the elements in the filtered mappedLinks array to be potentially null. This leads to a compilation error when properties like item.toolCallIndex are accessed in the following .sort() and forEach() calls, as they could be accessed on a null value.

💡 Suggested Fix

Update the .filter() call to use a TypeScript type guard predicate. This will correctly inform the compiler that all null values have been removed from the array. For example: .filter((item): item is NonNullable<typeof item> => item !== null).

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: static/app/views/seerExplorer/utils.tsx#L737-L744

Potential issue: In the `getValidToolLinks` function, an array is created by a `.map`
operation that can return objects or `null`. A subsequent `.filter(item => item !==
null)` is used to remove the `null` values. However, this is not a proper TypeScript
type guard. Because the project's TypeScript configuration has `strictNullChecks`
enabled, the compiler still considers the elements in the filtered `mappedLinks` array
to be potentially `null`. This leads to a compilation error when properties like
`item.toolCallIndex` are accessed in the following `.sort()` and `forEach()` calls, as
they could be accessed on a `null` value.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7557869

@aliu39 aliu39 merged commit bec0f3a into master Dec 16, 2025
49 checks passed
@aliu39 aliu39 deleted the aliu/share-chat branch December 16, 2025 00:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants