Skip to content

[feat] agent: download original conversation traces as a ZIP archive (#421) - #422

Merged
FayeSpica merged 15 commits into
ThinkFlowLab:mainfrom
yefuyou:feat/421-trace-report-export
Nov 25, 2026
Merged

FayeSpica merged 15 commits into
ThinkFlowLab:mainfrom
yefuyou:feat/421-trace-report-export

Conversation

@yefuyou

@yefuyou yefuyou commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses @FayeSpica's review feedback: the previous Markdown-only summary omitted information needed to diagnose failures. This revision replaces the Markdown report with a Download original trace (.zip) action on the conversation-wide Trace page.

  • Fetches the existing read-only original .jsonl trace sources for every executed turn, including collapsed turns; no new backend endpoint, trace storage or provider call.
  • Packages unaltered bytes for each available source, including model.jsonl when recorded. No normalization, redaction, event-count clipping or JSONL parsing on export. Invalid/incomplete source lines remain exactly as recorded.
  • Adds manifest.json with conversation and turn IDs, runtime, status, source filenames / missing statuses, and linked Job ID/status metadata.
  • Missing trace sources (404) are explicitly listed. Other source failures or archive size limits abort the download; no partial archive is misrepresented as complete.
  • Requires an explicit confirmation warning that raw logs can include prompts, model requests, tool arguments/results, credentials and private paths. Review locally before sharing.
  • ZIP uses standards-compliant STORE entries (no data re-encoding), a maximum total source size of 64 MiB and a 32 MiB per-source limit. No additional third-party dependency.
  • English/Chinese labels and fixture-backed unit/browser ZIP download tests. No project mutation.

Scope

Replaces, rather than duplicates, the initial Markdown export. The original per-turn raw file API is reused. Trace display, normal lazy loading, conversation deep links, Job execution and Slice B timing overview are unchanged.

Validation

  • Unit tests: exact-byte JSONL fidelity, raw model requests, mixed runtime turns, missing logs, linked Job metadata, size rejection, unexpected sources and ZIP header/CRC checks.
  • Browser fixture test: bilingual download flow, ZIP file structure, byte comparison against seeded original JSONL, missing logs, failed jobs, read-only requests, error handling and legacy deep links.
  • GitHub CI on the updated branch: running; final results must be checked before merge.

Refs #421, #409, #374.

yefuyou and others added 3 commits November 21, 2026 20:35
…ab#421)

Add a Markdown report export across all executed turns, with bounded event metadata and linked generation-job status. Omit raw model prompts and tool payloads.
Restore the Markdown escape replace after the HTML entity escaping so the file parses again (TS1005/TS1127).
@yefuyou
yefuyou marked this pull request as ready for review November 23, 2026 11:15
@github-actions github-actions Bot added area:agent Agent runtime, assistant chat and tools type:feat New capability or behaviour labels Nov 23, 2026
@github-actions
github-actions Bot requested review from FayeSpica and wuzhf9 November 23, 2026 11:15
yefuyou pushed a commit to yefuyou/OpenDirector that referenced this pull request Nov 23, 2026
@FayeSpica

Copy link
Copy Markdown
Collaborator

The Markdown summary doesn’t preserve enough detail to diagnose failures. Please let users download the original trace.

@yefuyou yefuyou changed the title [feat] agent: export conversation traces as Markdown reports (#421) [feat] agent: download original conversation traces as a ZIP archive (#421) Nov 25, 2026
Preserve the upstream release checks and browser manifest while retaining the original JSONL ZIP export gate.

yefuyou commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for clarifying the debugging need, @FayeSpica. I agree that the Markdown event summary wasn't sufficient to diagnose failures, so I've replaced it in #422 with a Download original trace (.zip) action rather than keeping two export formats.

The ZIP includes the original, byte-for-byte per-turn JSONL logs from the existing read-only trace API, including the model source when present (no normalization, field removal, or event truncation). A manifest.json records turn/source paths, missing logs, runtime/status, and linked Job metadata. Unavailable non-404 sources and size-limit failures abort instead of producing a misleading partial archive.

Because raw logs may contain prompts, tool inputs/outputs, model requests, credentials, and private paths, the download requires a sensitive-data confirmation. I've updated the bilingual UI, added ZIP fidelity/unit tests, and replaced the browser fixture checks with an actual ZIP download and source-byte comparison. The branch now includes current upstream main and the static gate passes; the remaining GitHub CI checks are still running, and I'll address any failures before considering it ready to merge.

Updated HEAD: 2ba8f733. Thanks for the specific direction!

…running turns, bound reads

Reuse createZip()/downloadFile() instead of the hand-written ZIP writer whose
EOCD central directory size was 12 bytes too large (unzip and zipfile rejected
every archive). Re-check turn status at click time and after reading, drop the
32 MiB per-source cap in favour of a 64 MiB total including ZIP overhead, add
request/total timeouts and cancel, cancel streams on failure, distinguish an
empty Jobs list from a failed lookup, and document the per-source (non-atomic)
semantics in EN and zh-CN.

Refs ThinkFlowLab#421 ThinkFlowLab#422
@FayeSpica

Copy link
Copy Markdown
Collaborator

@yefuyou please fix ci issues

yefuyou commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for flagging the CI failures, @FayeSpica. I checked the logs for the latest head 4d7d6e9d (run 45549640079).

The only failing test lane is checks / browser (isolated); checks / checks fails as its aggregate gate. Two unrelated canvas scenarios failed:

  • capability_discovery.mjs: timed out waiting for a React Flow node; the diagnostic snapshot had canvasNodes: [].
  • canvas_progressive_load.mjs: the 720 全景 node-toolbar button intercepted clicks intended for 切换项目.

Neither scenario exercises the Trace export UI, and I haven't found a change in this PR that explains those failures. Both tests passed 3/3 times on this PR head and 3/3 times on a clean upstream main in local CI-style runs. This suggests an intermittent browser/canvas timing or overlay issue, but I haven't established the root cause, so I don't want to call it definitively flaky.

The PR's browser (assistant) lane and the other checks passed. Separately, the ZIP fix was verified against standard unzip -t and Python zipfile with byte-for-byte source comparisons.

I don't have permission to rerun the Actions job (the rerun request returns 403). Could someone with access please rerun the failed browser (isolated) job? If either scenario fails again, I'll investigate it separately with the new logs and report the root cause instead of assuming it's a flake. I won't merge while the required gate is red.

@github-actions github-actions Bot added the area:docs Documentation / 文档 label Nov 25, 2026

@FayeSpica FayeSpica left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM,Thanks

Maybe as a follow-up, we could redact credentials such as API keys and auth tokens from trace exports, then remove the download confirmation dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent runtime, assistant chat and tools area:docs Documentation / 文档 type:feat New capability or behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants