Skip to content

fix: keep subagent reconciliation case-sensitive - #122141

Closed
Leon-SK668 wants to merge 1 commit into
openclaw:mainfrom
Leon-SK668:fix/subagent-case-sensitive-reconciliation
Closed

Leon-SK668 wants to merge 1 commit into
openclaw:mainfrom
Leon-SK668:fix/subagent-case-sensitive-reconciliation

Conversation

@Leon-SK668

@Leon-SK668 Leon-SK668 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #122047

What Problem This Solves

Fixes an issue where a missing subagent session could be reconciled as completed from a different sibling session whose key differed only by letter case.

Why This Change Was Made

Subagent reconciliation now requires an exact session-key match, preserving the opaque, case-sensitive identity already used by the canonical SQLite session store. The reconciliation-only case-folded fallback is removed so a sibling cannot supply another run's terminal state.

User Impact

Parents no longer receive a false completion result when two subagent session keys collide under case folding and one exact child session is absent.

Evidence

  • Production-boundary SQLite trace on exact head 66e4ad147b312fbf4a43bb8dfee30e8ede2867d7 using Node 24.15.0. A temporary, uncommitted harness wrote both entries through production replaceSessionEntry, then queried production resolveSubagentSessionCompletion: a terminal case-colliding sibling could not complete the missing child, while a normal UUID child still reconciled successfully.

    exact_head=66e4ad147b312fbf4a43bb8dfee30e8ede2867d7
    sqlite_store=sessions.json -> openclaw-agent.sqlite
    case_collision_missing_child=NOT_TERMINAL
    normal_uuid_child=RECONCILED_OK
    
  • Focused exact-head contract validation passed:

    pnpm dlx [email protected] scripts/run-vitest.mjs \
      src/agents/subagents/registry/subagent-session-reconciliation.test.ts \
      src/sessions/session-key-case-preservation.test.ts
    
    Test Files  2 passed (2)
    Tests       43 passed (43)
    
  • Exact-head GitHub CI passed with no failed or pending checks: https://github.com/openclaw/openclaw/actions/runs/31513647931

  • PATH="$PWD/node_modules/.bin:$PATH" oxfmt --check src/agents/subagents/registry/subagent-session-reconciliation.ts src/agents/subagents/registry/subagent-session-reconciliation.test.ts

  • git diff --check upstream/main...HEAD

  • Fresh branch autoreview on 66e4ad147b312fbf4a43bb8dfee30e8ede2867d7: clean, no accepted/actionable findings, correctness 0.99.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 11, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. 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. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

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

Close as superseded: the merged canonical repair preserves opaque peer-key casing while retaining supported structural key normalization, which is stronger than this branch’s exact-only lookup.

Root-cause cluster
Relationship: superseded
Canonical: #127279
Summary: The merged canonical repair explicitly supersedes this branch and implements the same user-facing protection with broader key-normalization coverage.

Members:

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

Canonical path: Keep the merged canonical normalizer repair from #127279 and use it as the sole reconciliation path.

So I’m closing this here and keeping the remaining discussion on #127279.

Review details

Best possible solution:

Keep the merged canonical normalizer repair from #127279 and use it as the sole reconciliation path.

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

Yes. The submitted missing-child/case-colliding-sibling scenario is source-reproducible, and current main now covers the same Matrix and Signal cases without rerunning untrusted branch code.

Is this the best way to solve the issue?

No. The merged canonical repair is better because it rejects opaque-peer collisions while retaining structural session-key normalization that this exact-only branch removes.

Security review:

Security review cleared: No security or supply-chain surface is changed; the branch only alters session-key lookup logic and regression coverage.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • obviyus: Authored the merged replacement PR that explicitly supersedes this branch. (role: canonical repair author; confidence: high; commits: fcc0bb74900b; files: src/agents/subagents/registry/subagent-session-reconciliation.ts, src/agents/subagents/registry/subagent-session-reconciliation.test.ts)
  • kevin2966n: Current-main blame associates the active lookup and regression coverage with this history boundary. (role: recent area contributor; confidence: medium; commits: 34d7f44a348c; files: src/agents/subagents/registry/subagent-session-reconciliation.ts, src/agents/subagents/registry/subagent-session-reconciliation.test.ts)

Codex review notes: model internal, reasoning high; reviewed against a3f64c19b673; fix evidence: commit fcc0bb74900b, main fix timestamp 2026-08-22T02:41:41Z.

@Leon-SK668

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The exact head remains 66e4ad147b312fbf4a43bb8dfee30e8ede2867d7. The PR body now includes contributor-supplied production-boundary proof using the real SQLite session accessor and reconciliation resolver: the case-colliding terminal sibling did not terminalize the missing child, while a normal UUID child still reconciled successfully. Focused exact-head validation also passed 43/43 tests across reconciliation and the session-key case-preservation contract.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 11, 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. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 18, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 24, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@Leon-SK668

Copy link
Copy Markdown
Contributor Author

Closing this PR as superseded by #127279 (fcc0bb74900b2b7d93543012a9dea2430b4e4a59).

Current main now checks the exact stored key and then uses normalizeStoreSessionKey. That canonical repair preserves supported structural session-key casing normalization while rejecting case-distinct Matrix and Signal opaque peer IDs; its owner-boundary tests cover both opaque collision cases and the structural control. This is stronger than this branch's exact-only lookup, which would discard the supported structural normalization path.

The associated issue #122047 has also been closed against the same merged repair. This closure is based on current-main supersession evidence, not on issue priority.

@Leon-SK668 Leon-SK668 closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

[Bug]: Subagent reconciliation can infer completion from a case-colliding sibling session

1 participant