Skip to content

Commit f09cd98

Browse files
committed
remove debug logs
1 parent 1872b29 commit f09cd98

9 files changed

Lines changed: 43 additions & 435 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -913,100 +913,6 @@ const MarkdownPreview = memo(function MarkdownPreview({
913913
revealedContent
914914
)
915915

916-
// #region agent log
917-
const mpUidRef = useRef(Math.random().toString(36).slice(2, 8))
918-
const revealedAtMountRef = useRef(revealedContent.length)
919-
useEffect(() => {
920-
const uid = mpUidRef.current
921-
const scroller = spacerRef.current?.parentElement ?? null
922-
if (!scroller || !isStreaming || content.length <= 60) return
923-
// Frame 2 after a resume mount: does the freshly mounted DOM have running CSS
924-
// animations? If so the visible "animate the whole file" is the markdown
925-
// (re)entering with a fade on every remount, independent of Streamdown props.
926-
let f = 0
927-
let raf = 0
928-
const tick = () => {
929-
if (f >= 2) {
930-
const el = scroller as Element & {
931-
getAnimations?: (o?: { subtree?: boolean }) => Animation[]
932-
}
933-
const anims = el.getAnimations ? el.getAnimations({ subtree: true }) : []
934-
const running = anims.filter((a) => a.playState === 'running')
935-
const names = running.slice(0, 6).map((a) => {
936-
const eff = a.effect as KeyframeEffect | null
937-
const target = eff?.target as Element | null
938-
const nm =
939-
(a as unknown as { animationName?: string; transitionProperty?: string })
940-
.animationName ??
941-
(a as unknown as { transitionProperty?: string }).transitionProperty ??
942-
a.constructor.name
943-
return `${nm}@${target?.tagName ?? '?'}`
944-
})
945-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
946-
method: 'POST',
947-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
948-
body: JSON.stringify({
949-
sessionId: '3dc406',
950-
hypothesisId: 'F3',
951-
location: 'preview-panel.tsx:MarkdownPreview:anim-probe',
952-
message: 'CSS animations on resume mount (running>0 = re-animate is mount fade)',
953-
data: {
954-
uid,
955-
contentLen: content.length,
956-
scrollTop: Math.round(scroller.scrollTop),
957-
scrollHeight: Math.round(scroller.scrollHeight),
958-
clientHeight: Math.round(scroller.clientHeight),
959-
animTotal: anims.length,
960-
animRunning: running.length,
961-
names,
962-
},
963-
timestamp: Date.now(),
964-
}),
965-
}).catch(() => {})
966-
return
967-
}
968-
f++
969-
raf = requestAnimationFrame(tick)
970-
}
971-
raf = requestAnimationFrame(tick)
972-
return () => cancelAnimationFrame(raf)
973-
}, [])
974-
// #endregion
975-
976-
// #region agent log
977-
// Render-time: catch the reveal jumping BACKWARD (re-reveal "from the
978-
// beginning") or the content prop resetting, the only remaining way the file
979-
// could appear to re-animate without a CSS animation/scroll.
980-
const prevRevealedLenRef = useRef(revealedContent.length)
981-
const prevContentLenRef = useRef(content.length)
982-
if (
983-
revealedContent.length < prevRevealedLenRef.current - 40 ||
984-
content.length < prevContentLenRef.current - 40
985-
) {
986-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
987-
method: 'POST',
988-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
989-
body: JSON.stringify({
990-
sessionId: '3dc406',
991-
hypothesisId: 'F6',
992-
location: 'preview-panel.tsx:reveal-drop',
993-
message: 'reveal/content dropped backward (re-reveal from beginning)',
994-
data: {
995-
uid: mpUidRef.current,
996-
revealedFrom: prevRevealedLenRef.current,
997-
revealedTo: revealedContent.length,
998-
contentFrom: prevContentLenRef.current,
999-
contentTo: content.length,
1000-
isStreaming,
1001-
},
1002-
timestamp: Date.now(),
1003-
}),
1004-
}).catch(() => {})
1005-
}
1006-
prevRevealedLenRef.current = revealedContent.length
1007-
prevContentLenRef.current = content.length
1008-
// #endregion
1009-
1010916
const contentRef = useRef(content)
1011917
contentRef.current = content
1012918

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/agent-group/agent-group.tsx

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -58,38 +58,6 @@ export function AgentGroup({
5858
defaultExpanded = false,
5959
}: AgentGroupProps) {
6060
const AgentIcon = getAgentIcon(agentName)
61-
// #region agent log
62-
useEffect(() => {
63-
if (!isStreaming) return
64-
const uid = Math.random().toString(36).slice(2, 8)
65-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
66-
method: 'POST',
67-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
68-
body: JSON.stringify({
69-
sessionId: '3dc406',
70-
hypothesisId: 'A12',
71-
location: 'agent-group.tsx:mount',
72-
message: 'AgentGroup MOUNT (parallel subagent flash)',
73-
data: { uid, agentName },
74-
timestamp: Date.now(),
75-
}),
76-
}).catch(() => {})
77-
return () => {
78-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
79-
method: 'POST',
80-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
81-
body: JSON.stringify({
82-
sessionId: '3dc406',
83-
hypothesisId: 'A12',
84-
location: 'agent-group.tsx:unmount',
85-
message: 'AgentGroup UNMOUNT',
86-
data: { uid, agentName },
87-
timestamp: Date.now(),
88-
}),
89-
}).catch(() => {})
90-
}
91-
}, [])
92-
// #endregion
9361
const hasItems = items.length > 0
9462
const resolved = isAgentGroupResolved(items)
9563
// Pure projection of the run's own state: a subagent header spins while it is

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -299,39 +299,6 @@ function ChatContentInner({
299299
const streamedContent = useSmoothText(displayContent, isStreaming)
300300
const isRevealing = isStreaming || streamedContent.length < displayContent.length
301301

302-
// #region agent log
303-
useEffect(() => {
304-
if (!isStreaming) return
305-
const uid = Math.random().toString(36).slice(2, 8)
306-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
307-
method: 'POST',
308-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
309-
body: JSON.stringify({
310-
sessionId: '3dc406',
311-
hypothesisId: 'A5',
312-
location: 'chat-content.tsx:mount',
313-
message: 'streaming ChatContent MOUNT (reveal resets to 0 here)',
314-
data: { uid, initialLen: displayContent.length },
315-
timestamp: Date.now(),
316-
}),
317-
}).catch(() => {})
318-
return () => {
319-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
320-
method: 'POST',
321-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
322-
body: JSON.stringify({
323-
sessionId: '3dc406',
324-
hypothesisId: 'A5',
325-
location: 'chat-content.tsx:unmount',
326-
message: 'streaming ChatContent UNMOUNT',
327-
data: { uid },
328-
timestamp: Date.now(),
329-
}),
330-
}).catch(() => {})
331-
}
332-
}, [])
333-
// #endregion
334-
335302
useEffect(() => {
336303
onRevealStateChangeRef.current?.(isRevealing)
337304
}, [isRevealing])

apps/sim/app/workspace/[workspaceId]/home/components/message-content/message-content.tsx

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -743,82 +743,6 @@ function MessageContentInner({
743743
onPhaseChangeRef.current?.(phase)
744744
}, [phase])
745745

746-
// #region agent log
747-
useEffect(() => {
748-
if (!isStreaming) return
749-
const uid = Math.random().toString(36).slice(2, 8)
750-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
751-
method: 'POST',
752-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
753-
body: JSON.stringify({
754-
sessionId: '3dc406',
755-
hypothesisId: 'A10',
756-
location: 'message-content.tsx:MessageContent:mount',
757-
message: 'MessageContent MOUNT',
758-
data: { uid },
759-
timestamp: Date.now(),
760-
}),
761-
}).catch(() => {})
762-
return () => {
763-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
764-
method: 'POST',
765-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
766-
body: JSON.stringify({
767-
sessionId: '3dc406',
768-
hypothesisId: 'A10',
769-
location: 'message-content.tsx:MessageContent:unmount',
770-
message: 'MessageContent UNMOUNT',
771-
data: { uid },
772-
timestamp: Date.now(),
773-
}),
774-
}).catch(() => {})
775-
}
776-
}, [])
777-
// #endregion
778-
779-
// #region agent log
780-
const parseSigRef = useRef('')
781-
useEffect(() => {
782-
if (!isStreaming) return
783-
const lines: string[] = []
784-
const walk = (segs: MessageSegment[], depth: number, parentId: string) => {
785-
for (const s of segs) {
786-
if (s.type !== 'agent_group') continue
787-
const childGroups = s.items
788-
.filter((it) => it.type === 'agent_group')
789-
.map((it) => (it as { group: AgentGroupSegment }).group)
790-
const toolCount = s.items.length - childGroups.length
791-
lines.push(`${s.id}|d${depth}|p:${parentId}|n${toolCount}${s.isDelegating ? '|deleg' : ''}`)
792-
walk(childGroups as unknown as MessageSegment[], depth + 1, s.id)
793-
}
794-
}
795-
walk(segments, 0, 'ROOT')
796-
const sig = lines.join(' ;; ')
797-
if (sig !== parseSigRef.current) {
798-
// Capture the raw subagent blocks' identity to learn whether the stable
799-
// anchor (parentToolCallId) survives the provisional->real spanId swap.
800-
const subBlocks = blocks
801-
.filter((b) => b.type === 'subagent')
802-
.map(
803-
(b) => `span:${b.spanId ?? '-'}|ptc:${b.parentToolCallId ?? 'NONE'}|a:${b.content ?? '-'}`
804-
)
805-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
806-
method: 'POST',
807-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
808-
body: JSON.stringify({
809-
sessionId: '3dc406',
810-
hypothesisId: 'F4',
811-
location: 'message-content.tsx:parse-tree-signature',
812-
message: 'agent_group tree CHANGED (depth/parent flip = re-parent remount/flash)',
813-
data: { prev: parseSigRef.current, next: sig, subBlocks },
814-
timestamp: Date.now(),
815-
}),
816-
}).catch(() => {})
817-
parseSigRef.current = sig
818-
}
819-
})
820-
// #endregion
821-
822746
if (segments.length === 0) {
823747
if (isStreaming) {
824748
return (

apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -182,39 +182,6 @@ const AssistantMessageRow = memo(function AssistantMessageRow({
182182

183183
const [phase, setPhase] = useState<MessagePhase>(isStreaming ? 'streaming' : 'settled')
184184

185-
// #region agent log
186-
useEffect(() => {
187-
if (!isStreaming) return
188-
const uid = Math.random().toString(36).slice(2, 8)
189-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
190-
method: 'POST',
191-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
192-
body: JSON.stringify({
193-
sessionId: '3dc406',
194-
hypothesisId: 'A9',
195-
location: 'mothership-chat.tsx:AssistantMessageRow:mount',
196-
message: 'streaming row MOUNT',
197-
data: { uid, id: message.id },
198-
timestamp: Date.now(),
199-
}),
200-
}).catch(() => {})
201-
return () => {
202-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
203-
method: 'POST',
204-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
205-
body: JSON.stringify({
206-
sessionId: '3dc406',
207-
hypothesisId: 'A9',
208-
location: 'mothership-chat.tsx:AssistantMessageRow:unmount',
209-
message: 'streaming row UNMOUNT',
210-
data: { uid },
211-
timestamp: Date.now(),
212-
}),
213-
}).catch(() => {})
214-
}
215-
}, [])
216-
// #endregion
217-
218185
const onAnimatingChangeRef = useRef(onAnimatingChange)
219186
onAnimatingChangeRef.current = onAnimatingChange
220187
useEffect(() => {
@@ -290,20 +257,6 @@ export function MothershipChat({
290257
* starving the main thread on every streaming token.
291258
*/
292259
const messages = useDeferredValue(messagesProp)
293-
// #region agent log
294-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
295-
method: 'POST',
296-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
297-
body: JSON.stringify({
298-
sessionId: '3dc406',
299-
hypothesisId: 'B1',
300-
location: 'mothership-chat.tsx:MothershipChat',
301-
message: 'list render',
302-
data: { msgCount: messages.length, deferred: messages !== messagesProp, isStreamActive },
303-
timestamp: Date.now(),
304-
}),
305-
}).catch(() => {})
306-
// #endregion
307260
const [lastRowAnimating, setLastRowAnimating] = useState(false)
308261
const scrollElementRef = useRef<HTMLDivElement | null>(null)
309262
const { ref: autoScrollRef } = useAutoScroll(isStreamActive || lastRowAnimating)
@@ -363,37 +316,6 @@ export function MothershipChat({
363316
setLastRowAnimating(false)
364317
}, [lastRowKey])
365318

366-
// #region agent log
367-
// Ungated: runs whenever the chat is mounted so it captures jank during an
368-
// IDLE canvas drag (after the stream completes), not only during streaming.
369-
useEffect(() => {
370-
let raf = 0
371-
let last = typeof performance !== 'undefined' ? performance.now() : Date.now()
372-
const tick = () => {
373-
const now = typeof performance !== 'undefined' ? performance.now() : Date.now()
374-
const delta = now - last
375-
last = now
376-
if (delta > 50) {
377-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
378-
method: 'POST',
379-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
380-
body: JSON.stringify({
381-
sessionId: '3dc406',
382-
hypothesisId: 'B1',
383-
location: 'mothership-chat.tsx:frame-probe',
384-
message: 'long frame (jank)',
385-
data: { frameMs: Math.round(delta), streamActive: isStreamActive },
386-
timestamp: Date.now(),
387-
}),
388-
}).catch(() => {})
389-
}
390-
raf = requestAnimationFrame(tick)
391-
}
392-
raf = requestAnimationFrame(tick)
393-
return () => cancelAnimationFrame(raf)
394-
}, [isStreamActive])
395-
// #endregion
396-
397319
const rangeExtractor = useCallback(
398320
(range: Range) => {
399321
const indexes = defaultRangeExtractor(range)

apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/resource-content.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -514,20 +514,6 @@ interface EmbeddedWorkflowProps {
514514
}
515515

516516
function EmbeddedWorkflow({ workspaceId, workflowId }: EmbeddedWorkflowProps) {
517-
// #region agent log
518-
fetch('http://127.0.0.1:1025/ingest/85045d0a-92f7-4ee2-9de1-e2f99930c6bc', {
519-
method: 'POST',
520-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '3dc406' },
521-
body: JSON.stringify({
522-
sessionId: '3dc406',
523-
hypothesisId: 'B2',
524-
location: 'resource-content.tsx:EmbeddedWorkflow',
525-
message: 'canvas wrapper render',
526-
data: { workflowId },
527-
timestamp: Date.now(),
528-
}),
529-
}).catch(() => {})
530-
// #endregion
531517
const { data: workflowList, isPending: isWorkflowsPending } = useWorkflows(workspaceId)
532518
const workflowExists = (workflowList ?? []).some((w) => w.id === workflowId)
533519
const hasLoadError = useWorkflowRegistry(

0 commit comments

Comments
 (0)