Repository navigation
feat(ios): export chat transcripts as Markdown via the share sheet - #100417
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 5:11 PM ET / 21:11 UTC. Summary PR surface: Other +387. Total +387 across 6 files. Reproducibility: yes. for the PR defects by source inspection: the exporter serializes raw messages while ChatView renders merged/filtered rows and transient rows outside that array. The actual iOS share-sheet behavior has not been proven in a real setup. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Land transcript export only after it serializes the same visible chat snapshot as ChatView, handles or blocks transient rows, preserves visible system markers, and includes redacted iOS share-sheet proof. Do we have a high-confidence way to reproduce the issue? Yes for the PR defects by source inspection: the exporter serializes raw messages while ChatView renders merged/filtered rows and transient rows outside that array. The actual iOS share-sheet behavior has not been proven in a real setup. Is this the best way to solve the issue? No, not yet: the shared formatter and iOS share-sheet direction are plausible, but the best merge state must export the rendered-visible snapshot and include real iOS proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cff46028f4e5. Label changesLabel justifications:
Evidence reviewedPR surface: Other +387. Total +387 across 6 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1cbcd5307c
ℹ️ 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".
| } | ||
| let text = self.visibleText(in: message) | ||
| guard !text.isEmpty else { return false } | ||
| return role == "user" || AssistantTextParser.hasVisibleContent(in: text) |
There was a problem hiding this comment.
Hide matched tool results before exporting
When a session contains an assistant tool call followed by a matching toolResult/tool_result row, the chat UI first merges that result into the prior message (ChatView.mergeToolResults) and, with showsAssistantTrace == false in ChatProTab, hides inline tool results. The exporter walks raw viewModel.messages, and this predicate treats the tool-result text as visible, so exporting a transcript after tool use can include hidden tool output/trace content that was not shown in the chat before the user shares the Markdown file.
Useful? React with 👍 / 👎.
| - **Cron duration validation:** reject positive durations that truncate below one millisecond instead of silently scheduling a zero-duration interval. (#100311) Thanks @qingminglong. | ||
| - **Skill workshop proposals:** preserve the terminal newline in generated proposal Markdown while still rejecting blank raw content. (#100293) Thanks @anyech. | ||
| - **Agent tool inputs and LSP startup:** treat blank optional integer arguments as absent, and fail embedded LSP startup immediately when its child process cannot spawn. (#100273, #99922) Thanks @snotty and @cxbAsDev. | ||
| - **Gateway and memory diagnostics:** report failed start-session persistence and close-time memory work instead of silently discarding those failures. (#100313, #100308) Thanks @masatohoshino and @lin-hongkuan. | ||
| - **Unicode and plugin package verification:** match native slice semantics for reversed UTF-16 bounds, and reject published plugin packages that omit `openclaw.plugin.json`. (#100014, #99904) Thanks @Simon-XYDT and @849261680. |
There was a problem hiding this comment.
Drop unrelated changelog entries
When this iOS transcript-export commit is merged, these manually added Unreleased fix entries publish unrelated release-note content for other issues. The root AGENTS.md Docs/Changelog section says CHANGELOG.md is release-only and normal feature/fix commits should not edit it, so this block should be removed from this commit and left to release generation.
Useful? React with 👍 / 👎.
1cbcd53 to
f9e2101
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9e210179a
ℹ️ 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".
| Image(systemName: "square.and.arrow.up") | ||
| } | ||
| } | ||
| .disabled(self.viewModel == nil) |
There was a problem hiding this comment.
Prevent exporting while streaming rows are visible
When a run is in progress, this keeps Export enabled as soon as a view model exists. The chat view can still be showing transient content from pendingRunCount, pendingToolCalls, and especially streamingAssistantText (apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatView.swift:349-379), but exportTranscriptMarkdown() serializes only self.messages, so tapping Export mid-response produces a Markdown file that omits assistant text the user can currently see. Disable export until transient rows settle or include those transient rows in the exported snapshot.
Useful? React with 👍 / 👎.
f9e2101 to
6a6f7b2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a6f7b209e
ℹ️ 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".
|
|
||
| private static func shouldExport(_ message: OpenClawChatMessage) -> Bool { | ||
| let role = message.role.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() | ||
| guard role != "system" else { return false } |
There was a problem hiding this comment.
Keep visible system rows in exports
When a session contains a visible system row such as the compaction marker synthesized by src/gateway/session-utils.fs.ts (role: "system", text Compaction), ChatView.shouldDisplayMessage renders it because it has visible non-user text, but this guard always drops it from the exported Markdown. That makes exports of compacted sessions omit rows the user can see in the chat, so the exporter should mirror the chat visibility rules or distinguish truly hidden system prompts from displayable system markers.
Useful? React with 👍 / 👎.
6a6f7b2 to
a5ab771
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5ab771c1b
ℹ️ 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".
| var parts: [String] = [] | ||
| let text = self.visibleText(in: message) | ||
| if !text.isEmpty { | ||
| parts.append(text) |
There was a problem hiding this comment.
Apply the chat markdown cleanup before exporting
When a message contains markdown that the chat renderer cleans before display, such as [message_id: ...] hints, untrusted context blocks, prefixed timestamps, or inline data:image/... markdown, the UI runs it through ChatMarkdownPreprocessor.preprocess in ChatMarkdownRenderer before rendering. Appending the raw visibleText here means the exported Markdown can include hidden metadata or large base64 image blobs that were not visible in the chat the user is sharing, so the exporter should use the same cleaned text path or otherwise represent inline images consistently.
Useful? React with 👍 / 👎.
…penclaw#100417) * feat(ios): export chat transcripts as Markdown via the share sheet * chore(ios): sync native i18n inventory
Part of #100415
What Problem This Solves
Conversations are trapped in the app: there is no way to hand a chat transcript to Mail, Files, Notes, or a colleague.
Why This Change Was Made
Adds a pure, deterministic Markdown formatter to the shared chat package (
ChatTranscriptExporter): H1 session title, per-message role + ISO8601 UTC timestamp headings, verbatim pass-through for fenced code and tables,_[attachment: name]_placeholders, and the same hidden-row filtering the transcript view applies. Filenames are sanitized and UTF-8-length-bounded. The iOS chat screen gains an Export action in the trailing toolbar menu that writes<session-title>.mdto a temp file and presents the system share sheet. Formatter stays platform-pure (macOS builds untouched); share-sheet wiring is iOS-only.User Impact
iOS users can export the current conversation as a named Markdown file to any share-sheet destination. No behavior change otherwise.
Evidence
cd apps/shared/OpenClawKit && swift test --filter ChatTranscriptExporterTests— 3/3 (snapshot-exact fixture with user/assistant/attachment rows + unicode + code fence; filename sanitization; empty transcript).pnpm ios:build— BUILD SUCCEEDED (includes SwiftFormat/SwiftLint phases); typography guard updated per apps/ios/AGENTS.md.