Skip to content

refactor(session-catalog): split codex catalog modules and unify adoption coordination - #124178

Merged
steipete merged 3 commits into
mainfrom
steipete/session-catalog-cleanup
Aug 15, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/session-catalog-cleanup

Conversation

@steipete

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

PR #123899 left three hand-rolled session-catalog continue-memo patterns and a grandfathered 1,775-line Codex session-catalog module. That duplication obscured the race and ownership invariants and made the Codex catalog harder to navigate and maintain.

Why This Change Was Made

This behavior-neutral cleanup moves the simple Anthropic and paired-node Codex continuation paths onto the existing race-safe Plugin SDK adoption coordinator, while retaining the specialized Codex-local path because it must revalidate and unarchive the bound generation and refresh its canonical-thread baseline inside one pinned exclusive operation. It also splits the Codex production catalog into concept-owned control/cache, listing/read, adoption, archive, and provider-registration modules, each below the line cap, without adding public Plugin SDK surface.

User Impact

None. This is a behavior-neutral internal refactor: catalog listing, reading, continuation, archive, upstream baselines, agent-qualified memoization, and source-qualified exclusivity retain their existing behavior.

Evidence

  • node scripts/run-vitest.mjs extensions/codex/src extensions/anthropic/session-catalog.test.ts extensions/acpx/src/pi-session-catalog.test.ts extensions/opencode/session-catalog.test.ts src/plugins/session-catalog.test.ts src/gateway/server-methods/session-catalog.test.ts: passed with default workers; the Codex directory covered 153 files and 3,586 tests, and all six routed shards passed.
  • Focused Anthropic and shared plugin session-catalog suites passed.
  • CI=1 node scripts/check-changed.mjs: passed all selected core, core-test, extension, extension-test, and tooling lanes locally. The normal remote raw-sync path is unavailable for this linked worktree because the remote box lacks origin/main.
  • pnpm plugin-sdk:surface:check: passed at the existing surface budget.
  • Branch autoreview: clean, with no accepted/actionable findings.
  • Production LOC: net -1. The production session-catalog.ts max-lines suppression and its ratchet entry are retired.
  • A/B attribution for the discarded test split: clean origin/main passed the same full proof with 3,586 Codex tests in 233 seconds; the split branch worker-exited under both default workers and OPENCLAW_VITEST_MAX_WORKERS=1. Restoring the original test file made the production-only branch pass with default workers.

Follow-ups

Splitting extensions/codex/src/session-catalog.test.ts (4.7k lines, grandfathered max-lines suppression) is blocked on mock-topology restructuring: per-file vi.mock duplication crashes non-isolated Vitest workers even serially. The fix path is narrowing the broad mock barrels to injection plus *.runtime.ts mocks per docs/reference/test.md guidance before re-attempting the split. extensions/anthropic/session-catalog.ts (2,083 lines) is the next production split candidate.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

The coordinator migration hoisted history to an optional outer binding;
afterCreate needs the definite array from the create scope.

Also drop the retired session-catalog max-lines ratchet entry.
@clawsweeper clawsweeper Bot added 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 9:34 AM ET / 13:34 UTC.

ClawSweeper review

What this changes

The PR splits Codex session-catalog responsibilities into focused modules and consolidates Anthropic and paired-node continuation deduplication on the shared adoption coordinator.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking patch defect found: the exact head preserves paired-node agent identity through list, read, and continue paths, addressing the prior P1 finding. Keep this maintainer-owned PR open until exact-head checks complete; likely related people are steipete and IWhatsskill.

Priority: P1
Reviewed head: 0b9244aad9d750814cc181e4d7aa5f59c65cc5ab

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation preserves the reviewed ownership invariant and has no concrete patch defect, with exact-head validation still pending.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused validation claims.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused validation claims.
Evidence reviewed 6 items Prior ownership finding resolved: The exact head forwards agentId to paired-node listing, record lookup, and transcript retrieval, preserving the request owner throughout the node RPC sequence.
Ownership regression coverage: Existing Codex coverage exercises concurrent paired-node continues for alpha and beta and asserts all node RPCs retain those two agent identities.
Shared coordinator boundary: The SDK coordinator now supports asynchronous existing-session lookup while retaining a single-flight create-and-complete operation; Codex deliberately keeps its local pinned exclusive path separate.
Findings None None.
Security None None.

How this fits together

The session catalog serves UI and CLI requests to list, read, continue, and archive provider sessions. It propagates an agent owner and source identity through provider code to local Codex app-server or paired-node session stores.

flowchart LR
  A[UI and CLI catalog request] --> B[Agent and source resolution]
  B --> C[Codex catalog provider]
  C --> D[Local or paired-node catalog]
  D --> E[Adoption coordination]
  E --> F[Session binding and transcript state]
  F --> G[Catalog or continuation result]
Loading

Before merge

  • Resolve merge risk (P1) - The refactor moves session-adoption ownership logic, so merge should wait for the in-progress exact-head checks to complete green.
  • Resolve merge risk (P1) - The Codex app-server dependency is directly relevant, but its sibling source was unavailable for this review; retain dependency-aware runtime validation before merge.
  • Complete next step (P2) - No concrete repair is identified; this protected maintainer-owned PR should remain open for normal exact-head validation.
Agent review details

Security

None.

PR surface

Source +2, Other -1. Total +1 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 10 1620 1618 +2
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 11 1620 1619 +1

Review metrics

Metric Value Why it matters
Production versus test LOC production +2, tests 0, config baseline -1 This is near-net-neutral production code relocation with existing owner-boundary tests retained rather than expanded.

Stored data model

Persistent data-model change detected: persistent cache schema: extensions/codex/src/session-catalog-control.ts, persistent cache schema: extensions/codex/src/session-catalog.ts, serialized state: extensions/anthropic/session-catalog.ts, serialized state: extensions/anthropic/session-upstream-activity.ts, serialized state: extensions/codex/src/session-catalog-adoption.ts, serialized state: extensions/codex/src/session-catalog-archive.ts, and 16 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete exact-head session validation (recommended)
    Merge after the remaining exact-head checks are green and the Codex app-server contract gap has been covered by dependency-aware validation.

Technical review

Best possible solution:

Complete exact-head validation while retaining the agent-qualified paired-node RPCs and source-qualified exclusive adoption locks.

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

Not applicable: this is a behavior-neutral refactor rather than a standalone bug report; existing tests exercise the moved multi-agent ownership path.

Is this the best way to solve the issue?

Yes, provisionally: shared coordination removes duplicated memoization while the specialized local Codex path keeps its pinned exclusive revalidation; upstream Codex-source confirmation remains unavailable.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 987c73e79304.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused validation claims.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: A regression in this refactor could associate a paired-node continuation with the wrong agent in multi-agent deployments.
  • merge-risk: 🚨 session-state: The changed coordinator and catalog modules create and reconnect adopted sessions and their transcript baselines.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused validation claims.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current-main paired-node ownership preservation and the present session-catalog refactor. (role: recent area contributor; confidence: high; commits: da111689594c, 2c7af09ec709, 1deff6996235; files: extensions/codex/src/session-catalog.ts, extensions/codex/src/session-catalog-node-continue.ts)
  • IWhatsskill: Authored the merged explicit-agent-ownership change whose catalog invariant this refactor preserves. (role: feature contributor; confidence: high; commits: 632581477f04; files: extensions/codex/src/session-catalog.ts, src/plugins/session-catalog.ts)

Rank-up moves

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

  • Let the remaining exact-head checks complete green.
  • Cover the unavailable sibling Codex-source review through dependency-aware runtime validation before merge.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-15T13:15:32.776Z sha 1b85123c5770b7f0fe4519298aa09ea534e88e6f :: found issues before merge. :: [P1] Preserve agent identity in paired-node catalog RPCs

@steipete
steipete force-pushed the steipete/session-catalog-cleanup branch from 1b85123 to 0b9244a Compare August 15, 2026 13:27
@steipete
steipete marked this pull request as ready for review August 15, 2026 13:28
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 15, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper rank-up move disposition for exact head 0b9244aad9d750814cc181e4d7aa5f59c65cc5ab:

  • Exact-head CI is green: run https://github.com/openclaw/openclaw/actions/runs/31887289050.
  • The Codex dependency contract was checked directly in the sibling Codex source: codex-rs/app-server-protocol/src/protocol/v2/thread.rs, codex-rs/app-server/src/request_processors/thread_processor.rs, codex-rs/app-server/src/thread_status.rs, and codex-rs/app-server/src/request_processors/thread_enrichment.rs. The rebased head also passed the focused Codex catalog suite (109 tests), CI=1 node scripts/check-changed.mjs, SDK surface validation, Codex lint, and pnpm build with no [INEFFECTIVE_DYNAMIC_IMPORT] warning.
  • The stored-data-model warning is skipped as a scanner false positive: this behavior-neutral refactor moves existing code and memo coordination but changes no persisted schema or serialized state shape.

No actionable ClawSweeper finding remains.

@steipete
steipete merged commit 7862a5d into main Aug 15, 2026
254 checks passed
@steipete
steipete deleted the steipete/session-catalog-cleanup branch August 15, 2026 13:40
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Aug 16, 2026
)

* refactor(anthropic): split session-catalog into concept modules

Follow the #124178 sibling seam pattern while preserving behavior. Remove the max-lines suppression and baseline entry after the split.

* refactor(anthropic): own record caches in session-catalog-discovery

The record-shaped caches (catalogDiscoveryCache, claudeSessionScanCache,
their entry types, bounds, and TTLs) are consumed only by discovery; moving
them out of scan removes the scan->discovery type-import edge flagged by the
madge topology gate and leaves scan as record-agnostic fs primitives.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…tion coordination (openclaw#124178)

* refactor(session-catalog): unify adoption coordination

* refactor(codex): split session catalog modules

* fix(anthropic): narrow adopted history for import

The coordinator migration hoisted history to an optional outer binding;
afterCreate needs the definite array from the create scope.

Also drop the retired session-catalog max-lines ratchet entry.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…claw#124342)

* refactor(anthropic): split session-catalog into concept modules

Follow the openclaw#124178 sibling seam pattern while preserving behavior. Remove the max-lines suppression and baseline entry after the split.

* refactor(anthropic): own record caches in session-catalog-discovery

The record-shaped caches (catalogDiscoveryCache, claudeSessionScanCache,
their entry types, bounds, and TTLs) are consumed only by discovery; moving
them out of scan removes the scan->discovery type-import edge flagged by the
madge topology gate and leaves scan as record-agnostic fs primitives.
steipete added a commit that referenced this pull request Aug 16, 2026
)

* test(codex): split the session-catalog suite along module seams

Replace the 4.8k-line grandfathered session-catalog.test.ts with seven
seam-anchored suites plus shared fixtures, and remove its max-lines
suppression and baseline entry. The broad openclaw/plugin-sdk/node-host
vi.mock becomes a narrow session-catalog-pty.runtime.ts boundary so the
non-isolated extension-codex worker no longer re-instantiates the
plugin-sdk graph once per split file (the crash PR #124178 measured).
Test bodies are verbatim; AST parity across the split checked out
96/96 identical.

AI-assisted (Codex worker under maintainer review).

* test(codex): carry caller origin in the cron-authority capability fixture

PR #118579 widened the in-process CronCreatorAuthorityCapability run
scope with a contractually required callerOrigin, and the new transcript
tool wiring reads it during turn startup. The hand-built fixture in
run-attempt.configured-mcp.test.ts predated the field, so
bindActiveOperatorTurnAuthority threw and runCodexAppServerAttempt
rejected while five tests awaited turn/start - 120s timeouts, then a
worker teardown crash. #118579's CI never ran the extension-codex lane
(cross-lane classification gap), so main's codex lane was latently red.
Bisected to 8668aeb; fixture now mints the local-operator origin the
helper's name promises.

AI-assisted (maintainer-diagnosed, Codex-era fixture repair).

* test(codex): keep catalog fixture internals private
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…claw#124397)

* test(codex): split the session-catalog suite along module seams

Replace the 4.8k-line grandfathered session-catalog.test.ts with seven
seam-anchored suites plus shared fixtures, and remove its max-lines
suppression and baseline entry. The broad openclaw/plugin-sdk/node-host
vi.mock becomes a narrow session-catalog-pty.runtime.ts boundary so the
non-isolated extension-codex worker no longer re-instantiates the
plugin-sdk graph once per split file (the crash PR openclaw#124178 measured).
Test bodies are verbatim; AST parity across the split checked out
96/96 identical.

AI-assisted (Codex worker under maintainer review).

* test(codex): carry caller origin in the cron-authority capability fixture

PR openclaw#118579 widened the in-process CronCreatorAuthorityCapability run
scope with a contractually required callerOrigin, and the new transcript
tool wiring reads it during turn startup. The hand-built fixture in
run-attempt.configured-mcp.test.ts predated the field, so
bindActiveOperatorTurnAuthority threw and runCodexAppServerAttempt
rejected while five tests awaited turn/start - 120s timeouts, then a
worker teardown crash. openclaw#118579's CI never ran the extension-codex lane
(cross-lane classification gap), so main's codex lane was latently red.
Bisected to ffb2614; fixture now mints the local-operator origin the
helper's name promises.

AI-assisted (maintainer-diagnosed, Codex-era fixture repair).

* test(codex): keep catalog fixture internals private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: anthropic extensions: codex maintainer Maintainer-authored PR 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant