Repository navigation
feat(openclaw): retain replay sources and record phase timing - #3338
Closed
vincentkoc wants to merge 40 commits into
Closed
vincentkoc wants to merge 40 commits into
vincentkoc wants to merge 40 commits into
Conversation
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Co-Authored-By: GPT-5.6 Sol <[email protected]> Generated-By: pi 0.84.2 (https://pi.dev)
Merge main into the trajectory capture work and adopt the current Harbor agent contracts. Conflict resolution in openclaw.py keeps main's newer code and adds the trajectory attributes the capture path needs: - keep the capability declaration import and add the validation import - keep the options-based super() call and read the export flag from self.options.session_to_trajectory - drop main's session JSONL branch, which the public export replaces Changes on top of the merge: - implement convert_trajectory() for preview conversion without changing run results, sharing the export loader with populate_context_post_run - emit ATIF v1.8 - describe session_to_trajectory as the rich export request - cover the conversion hook and the agreement between the rolled-up totals and compute_model_usage() Co-Authored-By: DeepSeek V4.1 Flash · Auto · Novita <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Address two review findings on the trajectory converter. Cost: a message that reports tokens without a cost total no longer counts as free. `_metrics` returns whether pricing was present, the session omits `total_cost_usd` when any token-bearing message is unpriced, and every ancestor inherits that unknown status through the capture graph. A partial numeric total can no longer ship. Media: content mapping keeps image and audio parts that name a media type and a location, such as a file path or URL, as ATIF content parts. Inline base64 media cannot be represented in ATIF, so it becomes a truthful placeholder and the capture is marked partial with the `media-content-not-preserved` warning code. This covers user messages, assistant messages, and tool results. Co-Authored-By: DeepSeek V4.1 Flash · Auto · Novita <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
The first pass only recognised `image` and `audio` parts, so any other part type still disappeared without a trace while the capture reported `complete`. Content mapping now tracks the part types that have their own converters, either a tool call or reasoning, and records every other non-empty part as omitted. It also accepts the `image_url` and `input_image` shapes that carry a declared media type and location. Covered by `test_unknown_content_part_marks_capture_partial` and `test_provider_image_url_shape_is_preserved`. Co-Authored-By: DeepSeek V4.1 Flash · Auto · Novita <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Address three more review findings on the converter. Local media: a path inside the agent environment is deleted with that environment, so it no longer counts as preserved. The converter copies such a file next to the trajectory under `media/`, references it with a relative path that resolves against the trajectory directory, and keeps the copy private. A file that is missing, a symlink, or larger than the 32 MiB cap becomes a placeholder with the `media-content-not-preserved` warning instead. Zero cost: an explicit `cost.total: 0` establishes that pricing is known. Step metrics now carry a zero cost, and the session reports `total_cost_usd: 0.0` when every token-bearing message is priced, so a free run no longer reports an unknown cost. Identity: `trajectory_id` now derives from the exported `session_id` together with the session key. Isolated trials reuse the key `agent:main:main`, so the key alone gave unrelated runs the same identifier. Co-Authored-By: DeepSeek V4.1 Flash · Auto · Novita <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Address two more review findings. Repeated media: the file limit now counts retained files, not references to them. A payload is content-addressed before the limit is applied, so a file that is already retained stays referenceable after the limit is reached instead of turning into a placeholder. Exposure: local media is copied only when the resolved path stays inside the session's own export bundle. A crafted part that names a credential, configuration, or unrelated task file is dropped with the `media-content-not-preserved` warning instead, so it cannot reach the synchronized logs. Co-Authored-By: DeepSeek V4.1 Flash · Auto · Novita <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
A media location can be absolute, a URL, or relative to the export bundle that contains the event. Resolving a relative location from the process directory made the containment check reject a valid bundle-local file, so the part became an omission placeholder. A relative location now resolves from the bundle root before the containment, symlink, size, and regular-file checks run. Co-Authored-By: DeepSeek V4.1 Flash · Auto · Novita <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Run public session discovery, export, and conversion in one remote helper. Keep all private state and exports under one trial directory with bounded cleanup, and fail the run when cleanup fails after a capture fallback. Preserve partial trees at capture limits and add standalone helper, cancellation, and combined-failure coverage. Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Download backends recreate remote files with `mkdir` and `Path.write_bytes`, so an export written as 0600 files inside a 0700 directory arrives on the host as 0644 files inside a 0755 directory under umask 022. `_load_export` narrowed only `trajectory.json` and `receipt.json`, which left the package's image and audio files readable by other host users. Harden every package-owned artifact after the transfer: the two JSON files and the whole `media/` tree. Directories become 0700 and files 0600, which are the modes `openclaw-atif` writes. Hardening reuses `validate_output_path`, so a path that resolves outside the logs directory, or any link, is left untouched; the shared log directory keeps its mode. Hardening runs before receipt validation and also when a failed capture leaves a media bundle behind, so private media is never left readable. Co-Authored-By: DeepSeek V4.1 Flash · Auto · Novita <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
Co-Authored-By: GPT-6 Astra <[email protected]> Generated-By: pi 0.85.1 (https://pi.dev)
The converter package moved to the @openclaw npm scope. Install @openclaw/[email protected] instead of [email protected]. The scoped release is not on npm yet. The unit tests use a fake environment, so they pass. A live run needs the published release. Co-Authored-By: DeepSeek V4.1 Flash · Novita <[email protected]> Generated-By: pi 0.86.1 (https://pi.dev)
|
@vincentkoc is attempting to deploy a commit to the Harbor Framework Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Enjoy a better diff viewing experience by clicking one of these URLs: |
This was referenced Sep 21, 2026
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Separate follow-up to #3336 and #2327. Neither predecessor branch is modified. Keep this draft until those changes land, then rebase and drop the predecessor commits.
Live recheck: #2327 independently advanced to
8649c58f3c110f806723bec9545361f639ab2a89with capture-metadata support after this stack was based. Its metadata overlaps #3336; reconcile that overlap during restacking. This draft does not claim to include that newer predecessor head.Incremental review: vincentkoc/harbor@be142ea...f6cef25
retain_source_bundles=trueto request the exporter's existing--keep-source-bundlesflag and retain public bundles before private trial cleanup.These are controller-observed remote-operation durations, not exact container command time or provider latency. There is no resource collector, generic Harbor schema change, or campaign policy in this PR.
The pinned exporter 0.1.2 already retains bundles. Automatic graph replay requires the separate exporter follow-up and a later maintainer-owned release/pin; this PR does not bump or publish it.
Validation
Design and authorship
Keep execution, capture, retention, accounting, and resource proof separate. Reuse the existing exporter and adapter cleanup/hardening boundaries. Do not change Onur's integration branch or the accounting draft. Implementation, tests, and draft description were prepared with OpenClaw/Codex assistance; maintainer review is still required.