Skip to content

Export a thread as one redacted HTML bug report (#394) - #1675

Merged
currentbits merged 2 commits into
mainfrom
coder/export-a-thread-as-a-self-contained-reda-0dc01e
Oct 18, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/export-a-thread-as-a-self-contained-reda-0dc01e

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Reporting an agent bug used to mean screenshotting a terminal. The thread's overflow menu now has Export bug report…: it saves one HTML file with no external dependencies, ready to attach to a vendor issue or send to a teammate. Secrets are redacted before anything is written. Closes #394.

Changes

  • The report contains the transcript with collapsible tool calls (errored ones in red), the committed diff on the branch plus any uncommitted changes, the agent details (provider, model, CLI version from <bin> --version, token count, cost) and the environment (Solenta, OS, Electron, Node).
  • Redaction runs on every string before it reaches the file. It covers values typed into secret-request cards (Secret placeholders: orchestrator substitutes real values, agents never see them #289), the guardrail secret patterns, bearer tokens, whole PEM private-key blocks (not just the header line) and the home directory, which becomes ~. The report header says how many secrets were removed and by which pattern.
  • The save dialog opens first, so cancelling skips the diff and --version work entirely.

Verification

  • electron/test/threadReport.test.js checks that no secret pattern, secret-card value, bearer token, PEM body or home path survives, that HTML is escaped, that placeholders like your-key-… are kept, and that cancelling writes nothing. test/threadHeader.test.tsx covers the menu item: a cancel shows no confirmation, a save flashes "Saved".
  • Live data: I ran the export read-only against all 1939 threads in my real store. No guardrail-pattern secrets or home paths were left in the output; the largest report (1.8 MB) took 312 ms.
  • npm run typecheck (including the preload sync check) and npx vite build pass.
  • Full test:electron: 22 tests failed in codex, grok MCP, PR refresh and terminal sign-in. The run was alongside vite build. I reran the 10 failing files one at a time: all passed on this branch, and the 9 that finished on clean HEAD passed there too. Not rerun as a full suite after merging main.

Notes for reviewers

  • Start with redactor() in electron/threadReport.js. The privacy gateway (Privacy gateway: PII/secret redaction before context leaves the machine #295) isn't built yet, so this reuses the guardrail patterns, and guardrails.js only gains two exports. Redaction is pattern-based, so a token in an unrecognised format would still leak; the report tells the reader to review it before sharing.
  • Tool input and output are the versions the app already shortened (about 2000 and 4000 characters), so the report isn't a full replay.
  • On web clients the item shows "Export failed" because there's no save dialog there, and the reason isn't shown.

🤖 Generated with Claude Code

Solenta and others added 2 commits October 18, 2026 21:45
Solenta-Message-Id: 95489d2d-0ae8-40bd-be13-8bcb63155597
…-as-a-self-contained-reda-0dc01e

# Conflicts:
#	src/components/ThreadView.tsx
#	src/dev/threads.ts
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T21:03:38.181049Z fa9cfae PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@currentbits
currentbits enabled auto-merge (squash) October 18, 2026 21:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa9cfae490

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread electron/threadReport.js
/** @param {unknown} value @returns {string} */
const text = (value) => {
const raw = String(value ?? "");
let s = threadSecrets.redact(threadId, raw);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Redact short secret-card values before export

When a user supplies a secret of five characters or fewer and that value appears in a tool call, output, or diff, this call leaves it unchanged because threadSecrets.redact deliberately ignores values shorter than six characters. The HTML exporter then writes the known secret verbatim unless it coincidentally matches another pattern, violating the export's guarantee that secret-request-card values are removed.

Useful? React with 👍 / 👎.

Comment thread electron/threadReport.js
for (const [scope, fallback] of [["branch", "Committed on branch"], ["uncommitted", "Uncommitted"]]) {
try {
const d = await diff({ store: ctx.store, threadId, scope });
if (d.patch) diffs.push({ label: d.scopeLabel ? `${fallback} (${d.scopeLabel})` : fallback, patch: d.patch });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include untracked files in the exported changes

When the relevant work consists of newly created, untracked files, worktrees.diff reports them only through d.files; its Git patch remains empty because git diff does not include untracked content. Since the exporter retains only d.patch, a report for an entirely untracked fix says “No changes,” omitting the code most likely needed to reproduce the bug.

Useful? React with 👍 / 👎.

Comment thread electron/threadReport.js
Comment on lines +208 to +209
const d = await diff({ store: ctx.store, threadId, scope });
if (d.patch) diffs.push({ label: d.scopeLabel ? `${fallback} (${d.scopeLabel})` : fallback, patch: d.patch });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Export patches omitted by the diff preview budget

When a changed file exceeds the 60 KB per-file limit or the scope exceeds the 100 KB aggregate preview budget, worktrees.diff drops that file from d.patch and records the omission only in d.files[].patchOmitted. The exporter ignores that metadata, so large changes silently disappear from the supposedly complete report; it should retrieve the omitted file patches or at least disclose that they were excluded.

Useful? React with 👍 / 👎.

Comment thread electron/threadReport.js
Comment on lines +206 to +208
for (const [scope, fallback] of [["branch", "Committed on branch"], ["uncommitted", "Uncommitted"]]) {
try {
const d = await diff({ store: ctx.store, threadId, scope });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Separate committed changes from working-tree changes

When tracked uncommitted changes exist, the branch scope compares the merge base directly with the working tree, so those edits are already included in the section labeled “Committed on branch.” The following uncommitted scope exports the same edits again, making the report mislabel and duplicate them; the committed section needs to end at HEAD rather than use the existing branch-preview scope unchanged.

Useful? React with 👍 / 👎.

Comment thread electron/webScopes.js
"speech:cancel",
],
files: ["projects:writeAgentConfig", "workflows:exportToRepo"],
files: ["projects:writeAgentConfig", "workflows:exportToRepo", "threads:exportReport"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the native export dialog out of web scope

When a paired Solenta Web device has files access, this classification allows it to invoke the endpoint even though export is documented as desktop-only. The web bridge preserves the desktop context's dialog, so the request opens a save dialog on the host machine rather than failing on the web client; the remote request then waits for host interaction and any returned path refers to an inaccessible host file. Reject web transport or keep this native-dialog channel host-only.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit 84ebb2e into main Oct 18, 2026
6 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.

Export a thread as a self-contained, redacted bug report

1 participant