umanggarg Claude Sonnet 4.6 commited on
Commit
2bdaac4
Β·
1 Parent(s): 675dfb1

fix: progress label shows tool call not THINK text during tour generation

Browse files

React trace events forward the full THINK sentence as the loading
message β€” it was appearing as a wall of text in the progress overlay.
Fix: backend sends event.tool (short) as message for react events;
frontend caps label at 72 chars as a safety net.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

backend/services/tour_agent.py CHANGED
@@ -1590,12 +1590,18 @@ Rules:
1590
  if event.get("type") == "result":
1591
  pipeline_map = event.get("data", {})
1592
  break
1593
- # Forward trace events to the UI; advance progress slightly each round
 
 
1594
  react_prog = min(react_prog + 0.015, 0.24)
 
 
 
 
1595
  yield {
1596
  "stage": "mapping",
1597
  "progress": react_prog,
1598
- "message": event.get("text", ""),
1599
  "trace": event,
1600
  }
1601
 
 
1590
  if event.get("type") == "result":
1591
  pipeline_map = event.get("data", {})
1592
  break
1593
+ # Forward trace events to the UI; advance progress slightly each round.
1594
+ # For react events, show only the tool call as the loading message β€”
1595
+ # the full THINK text belongs in the trace panel, not the progress label.
1596
  react_prog = min(react_prog + 0.015, 0.24)
1597
+ if event.get("type") == "react":
1598
+ msg = event.get("tool", "") or event.get("text", "")
1599
+ else:
1600
+ msg = event.get("text", "")
1601
  yield {
1602
  "stage": "mapping",
1603
  "progress": react_prog,
1604
+ "message": msg,
1605
  "trace": event,
1606
  }
1607
 
ui/src/components/ExploreView.jsx CHANGED
@@ -637,7 +637,9 @@ export default function ExploreView({ repo, onAskAbout, onRegenerateRef }) {
637
  // ── Loading / error states ─────────────────────────────────────────────────
638
  if (loading) {
639
  const pct = loadStage ? Math.round(loadStage.progress * 100) : 0;
640
- const label = loadStage?.message || "Building your guided tour…";
 
 
641
  return (
642
  <div className="ec-loading" style={{ flexDirection: "column", alignItems: "stretch", gap: 16, maxWidth: 480, margin: "auto" }}>
643
  {/* Progress row */}
 
637
  // ── Loading / error states ─────────────────────────────────────────────────
638
  if (loading) {
639
  const pct = loadStage ? Math.round(loadStage.progress * 100) : 0;
640
+ const rawLabel = loadStage?.message || "Building your guided tour…";
641
+ // Cap the progress label β€” long THINK strings must not overflow this area
642
+ const label = rawLabel.length > 72 ? rawLabel.slice(0, 72) + "…" : rawLabel;
643
  return (
644
  <div className="ec-loading" style={{ flexDirection: "column", alignItems: "stretch", gap: 16, maxWidth: 480, margin: "auto" }}>
645
  {/* Progress row */}