Skip to content

fix: address PR review comments — traceback, CORS parsing, byte sizes, DecisionTree collapse#2

Merged
acailic merged 2 commits into
bugfix/agent-debugger-fixesfrom
copilot/sub-pr-1
Mar 23, 2026
Merged

fix: address PR review comments — traceback, CORS parsing, byte sizes, DecisionTree collapse#2
acailic merged 2 commits into
bugfix/agent-debugger-fixesfrom
copilot/sub-pr-1

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

Five issues identified in code review of the comprehensive bug-fix PR.

Changes

  • context.pyTraceContext.__aexit__ used traceback.format_exc(), which reads the currently active exception rather than the exc_type/exc_val/exc_tb args passed to it. When invoked manually (e.g. in trace_tool/trace_llm) with no active exception, this produced "NoneType: None". Now uses format_exception(exc_type, exc_val, exc_tb) with a format_exception_only fallback when exc_tb is None.

  • api/main.py — CORS origin list now filters empty strings after split/strip, preventing phantom entries from trailing commas (e.g. "https://a.com,") in AGENT_DEBUGGER_CORS_ORIGINS.

  • collector/server.py — Size validators used len(json.dumps(v)) (character count), undercounting multi-byte characters. Switched to len(json.dumps(v, ensure_ascii=False).encode('utf-8')) for accurate byte enforcement.

  • DecisionTree.tsx — collapse stated.data._collapsed was set on the ephemeral D3 hierarchy node, which is fully reconstructed from convertToD3Tree(tree) on every render, discarding all mutations. Collapse state is now persisted in a stable collapsedStateRef: Map<string, boolean> keyed by event id and applied during hierarchy construction.

  • DecisionTree.tsx — collapsed indicator selector.node[data-id="..."] selector never matched because node <g> elements lacked the attribute. Added .attr('data-id', (d) => d.data.id) to the node selection.

  • client.ts — Removed unused TreeNode import that was causing tsc to exit non-zero.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI changed the title [WIP] Fix comprehensive bug fixes for agent debugger fix: address PR review comments — traceback, CORS parsing, byte sizes, DecisionTree collapse Mar 23, 2026
Copilot AI requested a review from acailic March 23, 2026 12:28
@acailic acailic marked this pull request as ready for review March 23, 2026 12:30
Copilot AI review requested due to automatic review settings March 23, 2026 12:30
@acailic acailic merged commit 98f8506 into bugfix/agent-debugger-fixes Mar 23, 2026
1 check passed
@acailic acailic deleted the copilot/sub-pr-1 branch March 23, 2026 12:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a focused set of follow-up fixes to address prior review comments across the SDK, API, collector, and frontend tree visualization—primarily improving traceback capture, configuration parsing, byte-accurate size validation, and persistent UI collapse behavior.

Changes:

  • Fixes TraceContext.__aexit__ to format the exception from the provided (exc_type, exc_val, exc_tb) instead of relying on the currently-active exception.
  • Hardens CORS origin parsing to drop empty entries and updates collector validators to enforce payload size limits in UTF-8 bytes.
  • Persists DecisionTree collapse state outside the ephemeral D3 hierarchy and adds missing data-id attributes used by the collapsed indicator selector; removes an unused TS import breaking tsc.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/src/components/DecisionTree.tsx Persist collapse state across renders via ref-backed map and ensure node elements get data-id for selectors.
frontend/src/api/client.ts Removes unused TreeNode type import to keep tsc clean.
collector/server.py Switches size checks from character count to UTF-8 byte count for correct DoS-limit enforcement.
api/main.py Filters out empty CORS origins after split/strip to avoid phantom entries from trailing commas.
agent_debugger_sdk/core/context.py Formats traceback from the exception arguments passed to __aexit__, fixing “NoneType: None” when no active exception exists.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

acailic pushed a commit that referenced this pull request Mar 30, 2026
Cover search returning no results (#1), error count semantic mismatch
(#2), null optional fields (#3), drift detection data requirements
(#4), empty behavior alerts (#5), and zero cost/tokens (#6).

29 tests across 3 files: 27 passing, 2 xfail documenting real bugs
where session.errors is not auto-computed and the tokens-implies-cost
invariant is not enforced.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants