Skip to content

Improve agent tracing, exec tooling, and tool-card stability#1180

Merged
wsp1911 merged 9 commits into
GCWing:mainfrom
wsp1911:main
Jun 13, 2026
Merged

Improve agent tracing, exec tooling, and tool-card stability#1180
wsp1911 merged 9 commits into
GCWing:mainfrom
wsp1911:main

Conversation

@wsp1911

@wsp1911 wsp1911 commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR improves agent runtime observability and tool execution behavior across the core runtime, adapters, and Web UI. It adds request trace usage analysis tools, expands model exchange tracing for context compression calls, stabilizes prompt-visible tool definitions across turns, and improves exec command/control handling.

It also adds a dedicated Web UI card for ExecControl, refines ask-user-question contract defaults, removes dead /btw persistence helpers, and fixes cancellation so round stream retries stop promptly when a dialog turn is cancelled.

Changes

  • Add request trace usage tooling:
    • CSV exporter for request trace token usage
    • Standalone HTML dashboard for prompt/completion/cache usage trends
  • Extend model exchange tracing:
    • Support full vs usage-only capture modes
    • Trace auto/manual context compression model exchanges
    • Persist capture mode and operation-level trace metadata
  • Improve agent/tool runtime behavior:
    • Keep collapsed tool definitions cache-stable across turns
    • Avoid provider-side prefix/KV cache misses caused by schema drift
    • Make ask_user_question.multiSelect optional with default false
    • Stop cancelled round stream retries immediately during request open or retry backoff
  • Update exec command behavior:
    • Remove max_output_chars from ExecCommand/WriteStdin/ExecControl inputs
    • Return unbounded output through runtime persistence
    • Tune default yield_time_ms values
    • Add Windows guidance for local non-TTY ExecControl interrupt behavior
  • Add Web UI support for ExecControl:
    • Dedicated ExecControl tool card
    • Localized interrupt/kill session state copy
    • Focused model tests for card behavior
  • Clean up unused core code:
    • Remove dead /btw persistence helpers from coordinator/session manager

Verification

  • cargo check --workspace
  • pnpm run type-check:web
  • pnpm --dir src/web-ui run test:run src/flow_chat/tool-cards/execProcessToolCardModel.test.ts
  • pnpm run i18n:audit

wsp1911 added 9 commits June 13, 2026 16:24
- add structured model exchange tracing modes under app logging config
- support full and usage-only trace capture policies
- skip request body capture when usage-only tracing is enabled
- allow response trace fields to be omitted based on trace policy
- persist capture mode in model exchange trace records
…cancelled

Root cause:
single-round stream retry logic only checked cancellation before/after parts of the
request flow, but not while awaiting send_message_stream or retry backoff sleep.
When the API was unreachable, a cancelled dialog turn could remain stuck inside
request open / retry wait and continue retrying until the 10-attempt budget was exhausted.

Fix:
wrap send_message_stream with cancellation-aware select logic so request opening can
exit immediately on cancel, and replace retry backoff waits with cancellable sleep.
Add focused tests to verify retry sleep returns promptly when the cancellation token fires.
Add request trace usage CSV exporter under scripts/request-trace-tools
Add standalone usage dashboard for visualizing request token trends
Support prompt/completion/cache hit/cache miss/cache write analysis
A regression was introduced by 05be491 ("feat(miniapp): add PPT Live built-in app with agent bridge and deck export"),
which started replacing collapsed tool stubs with expanded schemas after GetToolSpec unlocks.

That behavior changed the request prefix across turns and caused provider-side prefix/KV cache misses.

This change restores stable prompt-visible tool definitions by:
- keeping collapsed stubs unchanged after GetToolSpec unlocks
- relaxing collapsed stubs with `additionalProperties: true` so unlocked tools remain callable without schema rewrites
- keeping Task prompt-visible even when fresh subagents are temporarily unavailable, avoiding additional turn-to-turn manifest drift

Also add comments documenting when tool-definition changes are expected and why other mid-session drift should be avoided.
- add model exchange tracing support to aggregated ai-adapter requests
- trace auto and manual context compression model calls as operations
- replace round-specific trace metadata with operation metadata
- update request trace CSV/dashboard tools for the new trace shape
- remove ExecCommand/WriteStdin/ExecControl max_output_chars tool input
- let exec runtimes return unbounded output and rely on tool-result persistence
- set default yield_time_ms to 30s for ExecCommand and WriteStdin
- keep ExecControl default yield_time_ms at 10s
- exempt WriteStdin from identical-call loop blocking for polling flows
- add Windows runtime guidance that ExecControl interrupt matches kill for local non-TTY exec sessions
Drop the dead persist_btw_turn helpers from coordinator and session manager.
This keeps /btw aligned with its EphemeralChild design and avoids accidental
reintroduction of persisted side-thread turns.
- Add ExecControl card model and renderer wiring
- Show interrupt/kill session state with localized copy
- Treat ExecControl progress as terminal-like output
- Cover ExecControl model behavior with focused tests
@wsp1911 wsp1911 marked this pull request as ready for review June 13, 2026 09:36
@wsp1911 wsp1911 merged commit bb9f057 into GCWing:main Jun 13, 2026
4 checks passed
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.

1 participant