Files
sim/apps
Waleed bca7f2c9b3 feat(logs): add Troubleshoot in Chat button for errored runs (#5341)
* feat(logs): add Troubleshoot in Chat button for errored runs

Errored log runs now surface a "Troubleshoot in Chat" action in the log
details panel. It tags the failed run as a logs context (executionId) and
auto-sends a message to Chat asking Sim to investigate and fix the error,
porting the old copilot "Fix in Chat" behavior to mothership and adding
run-ID tagging.

Cross-route handoff rides a one-shot MothershipHandoffStorage consumed once
on the home surface mount, so the tagged run + prompt survive the navigation
from Logs to Chat and the agent receives the full run error via the resolved
logs context.

* fix(logs): deliver troubleshoot to a mounted chat + harden handoff

Review follow-ups:
- Same-route case (Cursor): LogDetailsContent is also embedded in the Chat
  resource panel, where router.push('/home') doesn't remount Home, so the
  mount-only handoff consume never fired. Generalize the existing
  sendMothershipMessage event to carry contexts and be cancelable: deliver
  straight to a mounted chat when one claims it, and only persist + navigate
  when none is listening.
- Corrupted-entry tombstone (Greptile): consume now clears whenever any entry
  exists, so a malformed/expired handoff can't linger across future mounts.
- Silent store failure (Greptile): only navigate when the handoff actually
  stored, so a failed write never strands the user on an empty chat.

* docs(logs): convert inline comments to TSDoc on declarations

* style(logs): match Troubleshoot button icon gap to View Snapshot sibling

* improvement(logs): use Chip for log-detail action buttons

Aligns the log-details panel's labeled action buttons (View Snapshot,
Troubleshoot in Chat) with the settings design language by swapping the
emcn Button for the canonical Chip pill. variant='primary' preserves the
prior filled emphasis; leftIcon keeps the icons canonical.

* fix(chat): only consume troubleshoot handoff on the new-chat surface

Gate the mount-time handoff consume on `!chatId` so an existing
`/chat/[chatId]` mount can't claim a pending handoff if navigation races —
a handoff always targets a fresh chat.

* fix(logs): hover only the interactive Run ID row in log details

The detail-card rows all hovered to --surface-2, but the card itself is
--surface-2, so the hover was a no-op in light mode and only showed in dark.
It also implied clickability on static readout rows. Now only the clickable
Run ID row hovers, using the canonical --surface-active token; static rows
carry no hover.

* improvement(logs): use emcn Badge for the version pill

Replaces the hand-rolled version span with the canonical Badge
(variant='green' size='md', pixel-identical tokens), so all three detail
badges (Level, Trigger, Version) render through the same component.
2026-07-01 17:19:45 -07:00
..
…
…
…