Skip to content

fix(control-ui): show archived transcripts and images after reset#77996

Open
Rene0422 wants to merge 2 commits into
openclaw:mainfrom
Rene0422:fix-webchat-history-issue
Open

fix(control-ui): show archived transcripts and images after reset#77996
Rene0422 wants to merge 2 commits into
openclaw:mainfrom
Rene0422:fix-webchat-history-issue

Conversation

@Rene0422

@Rene0422 Rene0422 commented May 5, 2026

Copy link
Copy Markdown

Summary

Fixes #77819. After a session reset, the prior .jsonl.reset.<ts> and
.jsonl.deleted.<ts> transcripts persisted on disk but were unreachable
from the Control UI, so the conversation and its image attachments
looked deleted even though the data was retained.

  • Gateway: enumerate archived transcripts in the agent's sessions
    directory and attach an archivedTranscripts summary to the agent's
    main session row in sessions.list. Add two additive RPCs under the
    read scope:
    • sessions.archived.list — lists archived transcripts (filename,
      archivedAt, reason, sessionId, sizeBytes, agentId).
    • sessions.archived.read — reads a specific archived transcript's
      messages by filename. Validates the resolved path stays inside the
      agent's sessions dir (path-traversal guard) and that the filename
      matches the <sessionId>.jsonl.(reset|deleted).<isoTs> shape.
  • Control UI: render archived transcripts in the session row's
    expanded panel with an inline viewer. The viewer renders text, image,
    and attachment content blocks from the JSONL, so prior image
    attachments come back as soon as you open one — no separate route
    or download needed.

Image attachments were never deleted; they were stored in the archived
JSONL and just had no UI surface. The new viewer reads the same blocks
the live chat view consumes, including base64 image/* sources.

Affected surfaces

  • sessions.list payload: each agent main row may now carry
    archivedTranscripts: ArchivedTranscriptPreview[] (additive).
  • New RPCs sessions.archived.list / sessions.archived.read
    (read-scoped, additive — third-party clients are unaffected).
  • Control UI Sessions tab: row expansion now triggers when archived
    transcripts exist, even without compaction checkpoints.

Real behavior proof

  • Behavior or issue addressed: After sessions.reset, archived .jsonl.reset.<ts> transcripts persisted in the agent sessions directory but were unreachable from the Control UI, so the prior conversation and its image attachments looked deleted. This change attaches archivedTranscripts to the agent's main session row in sessions.list and adds two read-scope Gateway RPCs (sessions.archived.list, sessions.archived.read) that the Sessions view consumes to render archived transcripts inline. Fixes WebChat history after session reset hides archived sessions and loses image attachment display #77819.

  • Real environment tested: Linux x86_64, Node v24.14.0, pnpm 10.33.2. OpenClaw built from this branch via pnpm build (commit 76f6758). Gateway run via node openclaw.mjs --dev gateway run --port 19001 (loopback bind, token auth, dev profile under ~/.openclaw-dev).

  • Exact steps or command run after this patch:

    1. pnpm install && pnpm build
    2. node openclaw.mjs --dev gateway run --port 19001 (background)
    3. Wrote a synthetic archived transcript at ~/.openclaw-dev/agents/dev/sessions/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d.jsonl.reset.2026-05-05T10-00-00.000Z with a user message containing a text block + a base64 image/png block, and an assistant reply. Standard archive shape produced by sessions.reset per src/gateway/session-transcript-files.fs.ts.
    4. Called the two new RPCs and sessions.list against the running gateway via openclaw --dev gateway call <method> --params '<json>' --json.
    5. Called sessions.archived.read with a path-traversal filename to confirm rejection.
  • Evidence after fix:

    $ openclaw --version
    OpenClaw 2026.5.4 (76f6758)
    
    $ ls -la ~/.openclaw-dev/agents/dev/sessions/
    -rw------- 1 root root  691 May  5 20:31 a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d.jsonl.reset.2026-05-05T10-00-00.000Z
    -rw------- 1 root root 4263 May  5 20:08 sessions.json
    
    ===== sessions.archived.list =====
    $ openclaw --dev gateway call sessions.archived.list --params '{"agentId":"dev"}' --json
    {
      "archived": [
        {
          "archivedFileName": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d.jsonl.reset.2026-05-05T10-00-00.000Z",
          "archivedAt": 1777975200000,
          "reason": "reset",
          "sessionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
          "sizeBytes": 691,
          "agentId": "dev"
        }
      ]
    }
    
    ===== sessions.archived.read — base64 image preserved end-to-end =====
    $ openclaw --dev gateway call sessions.archived.read \
        --params '{"archivedFileName":"a1b2c3d4-...reset...","agentId":"dev"}' --json
    {
      "archivedFileName": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d.jsonl.reset.2026-05-05T10-00-00.000Z",
      "archivedAt": 1777975200000,
      "reason": "reset",
      "sessionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
      "agentId": "dev",
      "messages": [
        {
          "role": "user",
          "content": [
            { "type": "text", "text": "what does this lobster look like?" },
            {
              "type": "image",
              "source": {
                "type": "base64",
                "media_type": "image/png",
                "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/q842iQAAAABJRU5ErkJggg=="
              }
            }
          ]
        },
        { "role": "assistant", "content": [{ "type": "text", "text": "It's a small red square — likely a placeholder image." }] }
      ],
      "totalMessages": 2
    }
    
    ===== sessions.archived.read — path traversal rejected at the schema layer =====
    $ openclaw --dev gateway call sessions.archived.read \
        --params '{"archivedFileName":"../../escape.jsonl.reset.2026-05-05T09-57-18.833Z","agentId":"dev"}' --json
    Gateway call failed: GatewayClientRequestError: invalid sessions.archived.read params:
      at /archivedFileName: must match pattern
      "^[A-Za-z0-9._-]+\\.jsonl\\.(reset|deleted)\\.\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}(?:\\.\\d{3})?Z$"
    
    ===== sessions.list — archivedTranscripts now attached to the agent main row =====
    $ openclaw --dev gateway call sessions.list --params '{"agentId":"dev"}' --json
          "key": "agent:dev:main",
          "sessionId": "77aca545-beb3-45c1-994c-0dd754de1126",
          "archivedTranscripts": [
            {
              "archivedFileName": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d.jsonl.reset.2026-05-05T10-00-00.000Z",
              "archivedAt": 1777975200000,
              "reason": "reset",
              "sessionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
              "sizeBytes": 691
            }
          ]
    
  • Observed result after fix: sessions.archived.list returns the archived transcript with reason: "reset", the original sessionId, parsed archivedAt epoch, and sizeBytes. sessions.archived.read returns the prior user/assistant messages with the user message's image content block intact — source.media_type: "image/png" and the full base64 data payload survive end-to-end, which is what the Control UI's archived-transcript viewer renders inline as data:image/png;base64,<data>. The traversal request was rejected at schema validation (the ArchivedTranscriptFileNameSchema regex), before the handler even ran. sessions.list now carries archivedTranscripts on the agent:dev:main row, which is the field the Sessions view's expanded panel consumes.

  • What was not tested: macOS and Windows hosts. Control UI click-through was not exercised in this proof — the verified surface is the Gateway RPC payload the UI consumes; the rendering side is covered by the existing UI vitests in ui/src/ui/views/sessions.test.ts.

Test plan

  • pnpm tsgo:core:all — clean
  • pnpm lint:core — clean
  • pnpm format:check (touched files) — clean
  • New unit tests:
    • src/gateway/session-transcript-files.archive-discovery.test.ts
      (4 tests: enumeration, sort order, path traversal rejection,
      missing-file rejection)
    • src/gateway/server.sessions.archived.test.ts (3 tests: end-to-end
      sessions.archived.list, sessions.archived.read with base64
      image payload preserved, traversal + missing rejected)
  • Touched-area regression run (gateway + UI, serial):
    pnpm test src/gateway/server.sessions.archived.test.ts src/gateway/session-transcript-files.archive-discovery.test.ts src/gateway/session-transcript-files.fs.archive-events.test.ts src/gateway/server.sessions.list-changed.test.ts src/gateway/server.sessions.reset-hooks.test.ts src/gateway/server.sessions.reset-models.test.ts src/gateway/server.sessions.store-rpc.test.ts ui/src/ui/views/sessions.test.ts ui/src/ui/controllers/sessions.test.ts71/71 passing.
  • Manual smoke: dev gateway on :19001, reset a session, confirm
    the archived transcript shows up in the Sessions row's expanded
    panel and that opening it renders the prior messages and images.

Closes #77819.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. size: XL labels May 5, 2026
@clawsweeper

clawsweeper Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: this is a useful candidate for the linked archived transcript visibility bug, but it is not merge-ready because the branch is conflicting, the Gateway API registration is stale against current main, archive discovery is added to a hot sessions.list path, the UI duplicates only part of the chat renderer, and the visible Control UI behavior still lacks proof.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #77819
Summary: This PR is the open candidate fix for the canonical reset/deleted transcript archive visibility and image-display issue; related reconnect and sessions_history items overlap but do not replace the Sessions UI viewer work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level. Current main creates reset/deleted transcript archives but sessions.list and the Sessions view do not expose an archive list/read/viewer path; I did not run a live browser reproduction in this read-only review.

Is this the best way to solve the issue?

No. The direction is useful, but this branch is not the best merge shape until it uses current Gateway/protocol ownership, avoids sessions.list hot-path scans, shares the existing chat renderer, resolves conflicts, and proves the visible UI path.

Security review:

Security review cleared: No concrete supply-chain issue was found; the new archive read surface is sensitive but read-scoped and includes filename/path validation, leaving functional/API ownership as the blocker.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-05-05T18:10:44Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is insufficient and proof tier is C, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • mcaxtr: Authored the merged reset transcript archiving PR that produces .jsonl.reset.* files this PR tries to expose. (role: archive behavior introducer; confidence: high; commits: 31537c669a01; files: src/gateway/session-utils.fs.ts, src/gateway/server-methods/sessions.ts, src/auto-reply/reply/session.ts)
  • gumadeiras: Authored merged follow-up commits on the reset transcript archive PR that tightened tests, typing, and archive callsite deduplication around the same behavior. (role: archive behavior follow-up contributor; confidence: medium; commits: b79cff1c3678, d480867157ad, 4724df7dea24; files: src/gateway/session-utils.fs.ts, src/gateway/server-methods/sessions.ts, src/gateway/session-utils.fs.test.ts)
  • scoootscooob: Authored the merged compaction checkpoint PR that added the current Sessions row expansion/details surface adjacent to this archive viewer. (role: adjacent session details contributor; confidence: medium; commits: f4fcaa09a358; files: src/gateway/server-methods/sessions.ts, src/gateway/session-utils.ts, ui/src/ui/views/sessions.ts)
  • byungsker: Authored the merged scheduled/daily reset transcript archiving PR that creates additional .jsonl.reset.* artifacts affected by this UI gap. (role: scheduled reset archive contributor; confidence: high; commits: 709dc671e442; files: src/auto-reply/reply/session.ts, src/auto-reply/reply/session.test.ts)
  • jalehman: Merged the scheduled reset archive PR and has adjacent session lifecycle work touching reset/delete archive handling surfaces. (role: adjacent lifecycle contributor and merger; confidence: medium; commits: 709dc671e442; files: src/auto-reply/reply/session.ts, src/gateway/session-transcript-files.fs.ts)

Codex review notes: model internal, reasoning high; reviewed against 010b61746379.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 31, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label May 31, 2026
@barnacle-openclaw barnacle-openclaw Bot removed the stale Marked as stale due to inactivity label May 31, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 14, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 20, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

@Rene0422 thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(control-ui): show archived transcripts and images after reset This is item 1/1 in the current shard. Shard 14/22.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

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

Labels

app: web-ui App: web-ui gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebChat history after session reset hides archived sessions and loses image attachment display

1 participant