Skip to content

refactor(sessions): isolate legacy transcript fixtures - #115231

Merged
steipete merged 2 commits into
mainfrom
codex/cleanup-session-manager-test-adapters
Jul 28, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/cleanup-session-manager-test-adapters

Conversation

@steipete

@steipete steipete commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Related: #113233

What Problem This Solves

The SQLite transcript teardown retained a test-only compatibility installer that patched SessionManager.create and SessionManager.openFile onto the shared production class. Importing one legacy fixture therefore changed the constructor API for every test in the worker, and a declaration merge made those retired file methods look like real runtime surface.

This is a maintainer-requested follow-up to #113233. AI-assisted implementation and review were used; the resulting boundary and proof were manually checked.

Why This Change Was Made

Legacy JSONL tests now opt into explicit file-backed fixture factories. The factories decorate only the returned in-memory manager, preserve the old write-through, rotation, cwd, and newline behavior, and leave the production constructor untouched. The embedded-runner E2E fixture now uses storage-neutral compatibility keys and canonical SQLite targets for the tests that inspect persisted history.

The removed installer was internal-only and never shipped. It was introduced by untagged commit 4273ca9dbd9b3e3172f34a7231d41bcd8b5d200c; git tag --contains returns zero tags. The package inventory explicitly excludes both dist/plugin-sdk/agent-runtime-test-contracts.js and its declaration, and a live dry-run inventory of [email protected] contains neither that barrel nor session-manager-file-compat.

User Impact

There is no user-visible runtime change. Test fixtures no longer manufacture production-looking file persistence APIs, and the embedded-runner coverage now exercises the current SQLite ownership contract.

Evidence

  • Direct after-fix Testbox proof: run 30375350433 printed:

    {"productionRetiredStaticsAbsent":true,"fixtureFileExists":true,"reopenedMessageCount":1,"reopenedText":"fixture proof"}
  • Compatibility proof:

    • git tag --contains 4273ca9dbd9b3e3172f34a7231d41bcd8b5d200c | wc -l returned 0.
    • package.json excludes the test-contract JS and declaration files from the npm package.
    • Live npm pack openclaw@latest --dry-run --json resolved 2026.7.1-2 and found zero paths containing agent-runtime-test-contracts or session-manager-file-compat.
  • Blacksmith Testbox tbx_01kymdaxsms6qztfag69dnevc9 (run 30361705407):

    • 182 Codex app-server tests passed.
    • 102 focused core session, doctor, gateway, and guard tests passed.
    • Embedded-runner E2E coverage passed across the 16-case broad pass set plus a targeted rerun of the five corrected stale cases.
  • Exact-head PR CI run 30369330386: dependency/dead-code, SDK, type, lint, build, and changed-surface lanes passed. Its only failed shard was an unrelated UI test-state leak (#agent-tool-read); the failed-job rerun passed, including openclaw/ci-gate.

  • Targeted formatting passed for all changed files; git diff --check is clean.

  • Codex autoreview (gpt-5.6-sol, high) was clean before the initial commit and after the CI fix, with no accepted/actionable findings.

ClawSweeper rank-up moves

  • Prove internal-only compatibility status: applied with package exclusions, zero containing tags, and live npm tarball inventory above.
  • Post direct after-fix behavior proof: applied with the redacted Testbox JSON output above.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations agents Agent runtime and tooling extensions: codex size: M maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete steipete self-assigned this Jul 28, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 28, 2026
@clawsweeper

clawsweeper Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 10:56 AM ET / 14:56 UTC.

ClawSweeper review

What this changes

This PR replaces the global legacy JSONL SessionManager test adapter with explicit file-backed fixture factories, updates affected Codex and core tests, and removes the declaration merge that made retired file methods appear on the production class.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 6 items remain

Keep this PR open for maintainer review. The fixture-isolation direction is sound, but it removes an exported Plugin SDK test-contract symbol without evidence that no shipped or external consumer imports it; its stated validation is also test/CI-only rather than direct after-fix behavior proof.

Likely related people: steipete (high confidence) authored the merged SQLite transcript teardown and this follow-up fixture-boundary work.

Priority: P3
Reviewed head: 5d75094f24f6f54409293c2900eec2d7332438c2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation has a focused boundary-improvement rationale, but the removed exported contract and lack of direct after-fix proof prevent a merge-ready rating.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR reports substantial Testbox and CI coverage, but the provided evidence is test/check output only; before merge, add redacted terminal or live output showing the production class has no retired static file methods while a selected fixture still persists and reopens its JSONL transcript. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR reports substantial Testbox and CI coverage, but the provided evidence is test/check output only; before merge, add redacted terminal or live output showing the production class has no retired static file methods while a selected fixture still persists and reopens its JSONL transcript. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Removed exported test-contract symbol: The branch replaces the installSessionManagerFileCompat export with two new fixture factories in the Plugin SDK test-contract barrel. This removes a named import path rather than only changing internal test implementation.
Fixture-local implementation: The renamed fixture helper decorates an individual in-memory manager instead of assigning create and openFile to the shared production constructor, matching the SQLite-only production ownership boundary described by the linked teardown.
Related merged teardown: The linked predecessor merged on July 28, 2026 and explicitly retained the global adapter as a temporary legacy-test compatibility boundary; this PR is a focused follow-up that changes that retained boundary.
Findings 1 actionable finding [P1] Establish compatibility before removing the test-contract export
Security None None.

How this fits together

OpenClaw production sessions now use SQLite or in-memory managers, while a limited set of legacy tests still need observable JSONL files. The fixture layer feeds those tests with decorated in-memory managers, while the production SessionManager continues into normal embedded-agent, gateway, and plugin runtime paths without file-persistence methods.

flowchart LR
  A[Legacy JSONL tests] --> B[Explicit fixture factory]
  B --> C[In-memory session manager]
  C --> D[Test-only file persistence]
  D --> E[Legacy transcript assertions]
  F[Production session callers] --> G[Production SessionManager]
  G --> H[SQLite or in-memory runtime state]
  H --> I[Gateway and embedded-agent flows]
Loading

Decision needed

Question Recommendation
May the Plugin SDK test-contract barrel remove installSessionManagerFileCompat, or must external/shipped consumers receive a deprecation and migration path? Verify internal-only removal: Confirm from package exports and release history that this test-contract symbol is not a shipped external contract, then keep the clean removal.

Why: The branch intentionally deletes a named exported helper to eliminate unsafe global class mutation, but repository policy requires direct compatibility evidence before removing a potentially shipped Plugin SDK surface.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR reports substantial Testbox and CI coverage, but the provided evidence is test/check output only; before merge, add redacted terminal or live output showing the production class has no retired static file methods while a selected fixture still persists and reopens its JSONL transcript. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Establish compatibility before removing the test-contract export (P1) - installSessionManagerFileCompat is removed from the agent-runtime-test-contracts Plugin SDK barrel. If any shipped extension test imports that name, this is a breaking SDK change; either prove it is internal-only from package/release history or provide a named migration/deprecation path to the two new factories before landing.
  • Resolve merge risk (P1) - agent-runtime-test-contracts is a Plugin SDK barrel, so removing installSessionManagerFileCompat can break an external or shipped test consumer unless release/export history proves the symbol is private or an explicit deprecation path is supplied.
  • Resolve merge risk (P1) - The supplied proof is limited to tests, checks, and CI claims; it does not yet visibly demonstrate the new fixture boundary after the change.
  • Complete next step (P2) - A maintainer or SDK owner must classify the removed exported test-contract helper before an automated repair can safely choose between clean removal and a compatibility migration.

Findings

  • [P1] Establish compatibility before removing the test-contract export — src/plugin-sdk/agent-runtime-test-contracts.ts:9-12
Agent review details

Security

None.

PR surface

Source -10, Tests +5. Total -5 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 5 52 62 -10
Tests 14 172 167 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 224 229 -5

Review metrics

Metric Value Why it matters
Plugin SDK test-contract change 1 named export removed, 2 fixture factories added The refactor improves test isolation, but the removed export needs a compatibility classification before merge.

Stored data model

Persistent data-model change detected: serialized state: src/agents/sessions/session-manager.persistence-compat.test.ts, serialized state: src/agents/sessions/session-manager.test-compat.d.ts, serialized state: src/agents/sessions/session-manager.test.ts, serialized state: src/agents/sessions/session-migrate-id-dedup.test.ts, serialized state: src/gateway/session-utils.fs.test.ts, serialized state: src/plugin-sdk/test-helpers/agents/session-manager-file-compat.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Resolve the exported-contract status before merge (recommended)
    Verify whether installSessionManagerFileCompat ever shipped through the Plugin SDK; preserve a documented migration only if it did, otherwise record the internal-only proof and land the removal.

Technical review

Best possible solution:

Keep the fixture-local design, first establish the release/consumer status of the removed test-contract export, then either retain a narrowly documented migration path for shipped consumers or remove it with proof that it is internal-only; add redacted direct execution evidence for the isolated fixture behavior.

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

Yes, at source level: importing the old adapter patched static methods onto the shared SessionManager constructor, while the new factories decorate only returned fixture instances. A full current-main execution was not established in this read-only review.

Is this the best way to solve the issue?

Unclear: instance-local decoration is the narrower maintainable fix for the global mutation, but deleting the barrel export is only the best solution after its shipped/external compatibility status is proven.

Full review comments:

  • [P1] Establish compatibility before removing the test-contract export — src/plugin-sdk/agent-runtime-test-contracts.ts:9-12
    installSessionManagerFileCompat is removed from the agent-runtime-test-contracts Plugin SDK barrel. If any shipped extension test imports that name, this is a breaking SDK change; either prove it is internal-only from package/release history or provide a named migration/deprecation path to the two new factories before landing.
    Confidence: 0.86

Overall correctness: patch is incorrect
Overall confidence: 0.76

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 206f989069fb.

Labels

Label changes:

  • add P3: This is a focused test-boundary cleanup with no stated production behavior change.
  • add merge-risk: 🚨 compatibility: A named helper is removed from a Plugin SDK test-contract barrel, which may affect external or shipped test consumers.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports substantial Testbox and CI coverage, but the provided evidence is test/check output only; before merge, add redacted terminal or live output showing the production class has no retired static file methods while a selected fixture still persists and reopens its JSONL transcript. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a focused test-boundary cleanup with no stated production behavior change.
  • merge-risk: 🚨 compatibility: A named helper is removed from a Plugin SDK test-contract barrel, which may affect external or shipped test consumers.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports substantial Testbox and CI coverage, but the provided evidence is test/check output only; before merge, add redacted terminal or live output showing the production class has no retired static file methods while a selected fixture still persists and reopens its JSONL transcript. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Removed exported test-contract symbol: The branch replaces the installSessionManagerFileCompat export with two new fixture factories in the Plugin SDK test-contract barrel. This removes a named import path rather than only changing internal test implementation. (src/plugin-sdk/agent-runtime-test-contracts.ts:9, 5d75094f24f6)
  • Fixture-local implementation: The renamed fixture helper decorates an individual in-memory manager instead of assigning create and openFile to the shared production constructor, matching the SQLite-only production ownership boundary described by the linked teardown. (src/plugin-sdk/test-helpers/agents/session-manager-file-fixture.ts:6, 5d75094f24f6)
  • Related merged teardown: The linked predecessor merged on July 28, 2026 and explicitly retained the global adapter as a temporary legacy-test compatibility boundary; this PR is a focused follow-up that changes that retained boundary. (4273ca9dbd9b)
  • Reported validation is supplemental: The PR body reports Testbox test passes, changed checks, formatting, and autoreview, but it does not include an inspectable after-fix run demonstrating both that the production constructor lacks the retired static methods and that an explicit fixture still writes and reopens a legacy transcript. (5d75094f24f6)

Likely related people:

  • steipete: Authored the merged transcript-runtime teardown that retained the legacy test adapter and authored this focused follow-up removing the shared-class mutation. (role: related teardown author and recent area contributor; confidence: high; commits: 38a4f131d6aa, 108ef3d22bf9, 5d75094f24f6; files: src/plugin-sdk/test-helpers/agents/session-manager-file-fixture.ts, src/plugin-sdk/agent-runtime-test-contracts.ts, src/agents/sessions/session-manager.persistence-compat.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Prove from package exports and release history that the removed test-contract helper is internal-only, or add a documented staged migration.
  • Post redacted terminal or live output demonstrating per-instance fixture persistence and the absence of production static file APIs.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 924f91c into main Jul 28, 2026
333 of 345 checks passed
@steipete
steipete deleted the codex/cleanup-session-manager-test-adapters branch July 28, 2026 15:56
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 28, 2026
…etwork-none

* origin/main: (24 commits)
  refactor(sessions): isolate legacy transcript fixtures (#115231)
  fix(discord): clear pending launch watchdog (#115100)
  fix(agents): stop quadratic subagent prompt rendering (#115263)
  fix(memory-core): recover dreaming cron reconciliation (#115174)
  fix(qa-lab): filter incompatible channel scenarios (#115087)
  fix(android): respect locale in compact labels
  test(i18n): prove iOS discovery catalog ownership
  chore(i18n): refresh gateway discovery catalogs
  fix(i18n): include shared discovery copy in macOS catalog
  fix(apple): localize gateway discovery status
  chore(i18n): drop release-owned changelog entry
  fix(macos): localize privacy permission prompts
  fix(voice-call): bracket IPv6 webhook hosts (#115135)
  test(ci): split control UI scope coverage
  fix(ui): detect composed accessibility copy
  fix(ci): run localization checks for UI changes
  test(ui): catch untranslated accessibility labels
  fix(ui): localize chat action labels
  fix(ui): localize chat status indicators
  fix(ui): sync document locale metadata
  ...
vincentkoc added a commit that referenced this pull request Jul 28, 2026
…-20260728

* origin/main: (21 commits)
  refactor(sessions): isolate legacy transcript fixtures (#115231)
  fix(discord): clear pending launch watchdog (#115100)
  fix(agents): stop quadratic subagent prompt rendering (#115263)
  fix(memory-core): recover dreaming cron reconciliation (#115174)
  fix(qa-lab): filter incompatible channel scenarios (#115087)
  fix(android): respect locale in compact labels
  test(i18n): prove iOS discovery catalog ownership
  chore(i18n): refresh gateway discovery catalogs
  fix(i18n): include shared discovery copy in macOS catalog
  fix(apple): localize gateway discovery status
  chore(i18n): drop release-owned changelog entry
  fix(macos): localize privacy permission prompts
  fix(voice-call): bracket IPv6 webhook hosts (#115135)
  test(ci): split control UI scope coverage
  fix(ui): detect composed accessibility copy
  fix(ci): run localization checks for UI changes
  test(ui): catch untranslated accessibility labels
  fix(ui): localize chat action labels
  fix(ui): localize chat status indicators
  fix(ui): sync document locale metadata
  ...
vincentkoc added a commit to LZY3538/openclaw that referenced this pull request Jul 28, 2026
* origin/main: (199 commits)
  refactor(workboard): tidy Control UI card execution helpers (openclaw#115195)
  perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281)
  fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232)
  fix: restore Fish completion after global CLI options (openclaw#115222)
  refactor(agents): collapse the client-tool catalog branch (openclaw#115212)
  fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957)
  fix(agents): prevent repeated Code Mode output across waits (openclaw#115213)
  refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245)
  fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229)
  fix(cli): reject malformed infer model refs (openclaw#115225)
  feat(ui): finish the Lobsterdex at 42 with wild variants, squish fix, and blink variance (openclaw#115264)
  test(migrations): avoid mtime precision in checkpoint fixture (openclaw#115269)
  test(signal): verify archive limits without malformed tar (openclaw#115270)
  refactor(sessions): isolate legacy transcript fixtures (openclaw#115231)
  fix(discord): clear pending launch watchdog (openclaw#115100)
  fix(agents): stop quadratic subagent prompt rendering (openclaw#115263)
  fix(memory-core): recover dreaming cron reconciliation (openclaw#115174)
  fix(qa-lab): filter incompatible channel scenarios (openclaw#115087)
  fix(android): respect locale in compact labels
  test(i18n): prove iOS discovery catalog ownership
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
* test(sessions): isolate legacy file fixtures

* test(sessions): hide fixture-only manager type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M 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.

1 participant