Repository navigation
fix(sessions): preserve fixed-store owner during migration - #123235
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a Codex doctor-migration startup failure on gateways configured with explicit multi-agent ownership by ensuring legacy/unscoped Codex binding surfaces can still resolve a deterministic owner during upgrade. It does so by using the persisted agents.defaults.systemAgent.agentId as a migration-only fallback when resolving session agent IDs, avoiding AGENT_SELECTION_REQUIRED during legacy sidecar detection/migration.
Changes:
- Add a small helper to derive a migration fallback agent id from
config.agents.defaults.systemAgent.agentId. - Pass
fallbackAgentIdintoresolveSessionAgentIds(...)at the two legacy binding owner-resolution sites so unscoped legacy surfaces have a stable owner in explicit-ownership configs. - Add a regression test covering multi-agent explicit ownership using the persisted system owner for legacy bindings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| extensions/codex/src/migration/session-binding-sidecars.ts | Uses persisted system-agent owner as a migration fallback when resolving legacy/unscoped binding ownership. |
| extensions/codex/doctor-contract-api.test.ts | Adds regression coverage ensuring legacy binding migration succeeds under explicit multi-agent ownership with a system owner set. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Independent production-shaped acceptance from a real multi-agent Claw Patrol clone:
This directly covers the failed production upgrade path that motivated the PR. Separate ambient-owner warnings from generic Doctor/plugin-inventory subchecks remain outside this focused Codex migration fix. |
|
Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 7:15 PM ET / 23:15 UTC. ClawSweeper reviewWhat this changesThe PR makes startup migration assign unscoped legacy session rows in a configured fixed session store to that store’s persisted agent owner, with regression coverage and a Codex test-shard routing update. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for maintainer review. The patch plausibly repairs the owner-boundary defect and has detailed exact-head acceptance evidence, but it changes upgrade-time assignment of persisted session keys and needs explicit confirmation that the fixed-store owner is the intended canonical authority. Priority: P1 Review scores
Verification
How this fits togetherGateway startup migrates legacy session-store data before serving requests. The session-key canonicalizer produces owner-scoped keys that later migration checkpoints and plugin state importers consume. flowchart LR
A[Legacy session rows] --> B[Startup migration]
C[Persisted fixed-store owner] --> D[Ownership resolution]
B --> D
D --> E[Canonical owner-scoped keys]
E --> F[Migration checkpoints]
F --> G[Gateway readiness]
Decision needed
Why: The answer establishes a persisted-data upgrade contract; automated review cannot choose whether historical unscoped rows should be reassigned rather than retained for operator repair. Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests +91. Total +105 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Define the persisted fixed-store owner as the canonical migration authority, retain failure for genuinely ambiguous stores, and document or test the intended upgrade boundary before landing. Do we have a high-confidence way to reproduce the issue? No independent high-confidence reproduction was possible because the sandbox rejected read-only inspection commands; the PR nevertheless contains detailed exact-head production-shaped acceptance evidence. Is this the best way to solve the issue? Unclear: assigning the persisted owner at the canonicalization producer is the plausible owner-boundary fix, but maintainers must decide whether reassignment is the desired persisted-data upgrade contract. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against d9d970240022. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Exact-head production acceptance is complete on The acceptance run uncovered and repaired the remaining owner consumer: core session-key canonicalization was still treating the persisted fixed store as shared, even after the Codex importer correctly retained Proof on the final commit:
The PR body now includes the complete evidence and production-vs-test LOC metric. No merge or auto-merge was requested. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Updated PR #123235 to exact head
Exact-head proof:
The earlier ClawSweeper TypeScript narrowing finding is fixed. No merge or auto-merge was enabled. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Final current-main head: The prior CI red was Reproduction and repair proof:
PR #123303 does not conflict: its merged commit No merge or auto-merge is enabled. |
|
Final CI is green on
The PR is open and mergeable. Auto-merge remains disabled; this is ready for maintainer review/approval only. |
…23387) * feat(skills): resolve explicit $skill references on every channel Explicit $skill-name references from authorized senders now resolve on all channels, not only WebChat/Control UI, and explicitly referenced skills are always invoked: disable-model-invocation keeps a skill out of model-initiated selection but no longer blocks user-initiated explicit references. Hidden skills carry their SKILL.md path in the injected instruction since the model cannot discover them from the available-skills prompt. Part of #123367 * fix(ci): dedupe run-attempt-state vitest lane ownership Main is red on the full-suite ownership audit from the #123235 x #123363 double-registration race. Keep run-attempt-state.test.ts beside its run-attempt siblings in the extra lane and heal the audit here per the land-onto-red-main policy.
…123235) Co-authored-by: Peter Steinberger <[email protected]>
…enclaw#123387) * feat(skills): resolve explicit $skill references on every channel Explicit $skill-name references from authorized senders now resolve on all channels, not only WebChat/Control UI, and explicitly referenced skills are always invoked: disable-model-invocation keeps a skill out of model-initiated selection but no longer blocks user-initiated explicit references. Hidden skills carry their SKILL.md path in the injected instruction since the model cannot discover them from the available-skills prompt. Part of openclaw#123367 * fix(ci): dedupe run-attempt-state vitest lane ownership Main is red on the full-suite ownership audit from the openclaw#123235 x openclaw#123363 double-registration race. Keep run-attempt-state.test.ts beside its run-attempt siblings in the extra lane and heal the audit here per the land-onto-red-main policy.
|
Follow-up: this merged PR resolves the Codex legacy-binding migration failure reported in #123320. The issue has been linked and closed as completed after production-shaped multi-agent cold-start validation. |
What Problem This Solves
Fixes the remaining multi-agent upgrade failure for a configured fixed session store.
The Codex migration now resolves legacy sidecar ownership on
mainvia #123331. Core session-key canonicalization still built ownership from every configured agent sharing the fixed path, ignoredagents.defaults.sessionStore.agentId, and treated raw rows as ambiguous. That warning blocks startup migration checkpointing, so the same build retries it on every process start.This PR makes the core canonicalizer consume the persisted fixed-store owner. Other configured agents can no longer make that store's unscoped rows look ambiguous. Real ownership ambiguity still fails closed.
Why This Is the Owner-Boundary Fix
agents.defaults.sessionStore.agentId.No config surface, database schema, runtime fallback, or session-history behavior changes.
Exact-Head Evidence
Validated commit:
85edbc34a2705788f33e0869067df3e94b2ab8102026.8.1and exact commit85edbc34a27.legacy-fixed-storetoagent:ops:legacy-fixed-store, imported the Codex binding underops, archived the legacy sidecar, and emitted zero migration warnings./healthz,/startupz, and/readyzHTTP 200 with reachable, healthy RPC.mainandopswithagentHarnessId: codex.quick_check=ok, foreign-key check clean, migration checkpoints persisted.Direct Codex source inspection at sibling commit
000d2540ad73996f3589ae178bfe447bfd67cef2confirmed that app-server resumes and lists threads by Codex thread identity/history/path; it has no OpenClaw agent-owner contract. OpenClaw's migration layer owns this mapping (codex-rs/app-server-protocol/src/protocol/v2/thread.rs:310-325,1099-1148;codex-rs/app-server/src/request_processors/thread_processor.rs:1968-2068).Review Metrics
The production growth wires an existing durable ownership fact into the canonical store map and documents why competing configured agents must not override it.
Release note: fixes fixed-store session ownership during multi-agent gateway upgrades.