Skip to content

fix(agents): reject unbound legacy session keys - #123222

Merged
fuller-stack-dev merged 1 commit into
mainfrom
fix/session-agent-binding-strict
Aug 15, 2026
Merged

fuller-stack-dev merged 1 commit into
mainfrom
fix/session-agent-binding-strict

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where context-engine and plugin hooks with an arbitrary unscoped session key could inherit the default agent identity even though the key had no trusted agent binding.

This was the first product failure in the beta.2 plugin-prerelease run: https://github.com/openclaw/openclaw/actions/runs/31848220763

Why This Change Was Made

The host-owned binding resolver now accepts only explicit agent IDs, agent-scoped keys, canonical or configured main-session aliases, and persisted fixed-store ownership. It delegates those trusted forms to the canonical session resolver so owner conflicts and retired fixed-store errors retain their existing behavior; arbitrary bare keys return no authority.

The general session resolver remains unchanged because its non-authority callers intentionally support default-agent selection.

Production LOC: +23/-7 (net +16). Test LOC: +44/-0. The production growth restores the missing authority boundary while preserving the fixed-store ownership behavior introduced by the multi-agent refactor.

User Impact

Context-engine and plugin LLM capabilities now fail closed when a session reference does not prove its agent owner. Explicit agent IDs, agent-scoped session keys, main aliases, and fixed-store sessions continue to work.

Release-note context: reject unbound legacy session keys when resolving agent-scoped runtime authority.

Evidence

  • Pre-fix reproduction: node scripts/run-vitest.mjs src/agents/session-agent-binding.test.ts failed when the arbitrary key reached the default-capable general resolver.
  • Post-fix focused proof: node scripts/run-vitest.mjs src/agents/session-agent-binding.test.ts src/plugins/runtime/runtime-llm.runtime.test.ts — 2 files, 36 tests passed.
  • pnpm format src/agents/session-agent-binding.ts src/agents/session-agent-binding.test.ts — passed.
  • git diff --check origin/main...HEAD — passed.
  • Autoreview: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main — clean, no accepted/actionable findings.
  • Heavy changed gate: Blacksmith Testbox was unavailable because the client is not installed. Direct AWS Crabbox cbx_89c6dabe1325 passed the initial guards but lacked workspace dependencies; the single frozen-install retry on cbx_3e691f7a9a93 stalled after installation and was stopped. Exact-head PR CI remains required.

Co-authored with Vincent Koc, preserving the original PR author's implementation credit.

@clawsweeper

clawsweeper Bot commented Aug 13, 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: XS maintainer Maintainer-authored PR labels Aug 13, 2026
@vincentkoc vincentkoc self-assigned this Aug 13, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 13, 2026 15:17
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 8:56 PM ET / August 15, 2026, 00:56 UTC.

ClawSweeper review

What this changes

The PR makes agent-scoped runtime authority reject unbound legacy session keys while preserving explicit agent IDs, scoped keys, main aliases, and fixed-store ownership.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking findings. Keep this active maintainer PR open for exact-head CI and normal maintainer landing; likely related person: Peter Steinberger, who introduced the current authority boundary (high confidence).

Priority: P1
Reviewed head: 8c291c58f18e2f6aec0dda5cd78341cfa9bf0703

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused, owner-boundary repair and regression coverage are sound, with no discrete correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its body also records focused before/after test evidence.
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 PR is exempt from the external-contributor real-behavior-proof gate; its body also records focused before/after test evidence.
Evidence reviewed 6 items Current bug mechanism: Current main forwards every nonempty session key to the general resolver, which falls through to the default agent when no scoped or stored owner exists.
Patch owner boundary: The branch accepts only explicit IDs, parsed agent keys, stored fixed-store ownership, and normalized main aliases before delegating to the canonical resolver.
Runtime failure boundary: Both affected host callers require a bound agent, and the runtime LLM adapter rejects a missing authority agent before preparing a model.
Findings None None.
Security None None.

How this fits together

Context-engine and plugin command hooks pass a session reference into the runtime LLM adapter to select an agent. The changed resolver supplies that authority before the adapter allows model completion.

flowchart LR
  A[Context engine or plugin command] --> B[Session reference]
  B --> C[Trusted binding check]
  C -->|trusted key or agent ID| D[Canonical session resolver]
  C -->|unbound legacy key| E[No agent authority]
  D --> F[Runtime LLM completion]
  E --> F
Loading

Before merge

  • Resolve merge risk (P1) - Existing callers that provide arbitrary bare session keys will now receive an authorization failure instead of silently inheriting the default agent; this is intentional but compatibility-sensitive.
  • Resolve merge risk (P1) - Production is +16 lines because the general resolver intentionally remains default-capable for non-authority callers; changing it instead would alter unrelated session-resolution behavior.
  • Complete next step (P2) - This active maintainer-owned PR has no mechanical repair finding; await exact-head CI and ordinary maintainer landing review.
Agent review details

Security

None.

PR surface

Source +16, Tests +44. Total +60 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 23 7 +16
Tests 1 44 0 +44
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 67 7 +60

Review metrics

Metric Value Why it matters
Production versus test delta production +16 net; tests +44 The added authority policy is justified by the general resolver’s intentionally default-capable contract and is covered with focused trusted-form regressions.

Stored data model

Persistent data-model change detected: serialized state: src/agents/session-agent-binding.test.ts, serialized state: src/agents/session-agent-binding.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Land the strict authority boundary (recommended)
    Accept the intentional rejection of unbound legacy keys once exact-head CI is green, preserving explicit, scoped, main-alias, and fixed-store paths.

Technical review

Best possible solution:

Keep the dedicated authority resolver, retain the general resolver’s default behavior for non-authority callers, and merge after exact-head CI confirms the supported alias and fixed-store paths.

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

Yes—current main routes an arbitrary nonempty key through the default-capable resolver, while the existing runtime test defines the expected fail-closed outcome; this read-only review did not execute the test.

Is this the best way to solve the issue?

Yes—the separate authority resolver is the narrowest maintainable fix because the shared resolver intentionally supports default-agent selection for non-authority callers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 61bc6128a03e.

Labels

Label justifications:

  • P1: The PR prevents context-engine and plugin runtime calls from inheriting an agent identity without a trusted binding.
  • merge-risk: 🚨 compatibility: The intentional fail-closed behavior can stop existing integrations that supplied arbitrary bare session keys.
  • merge-risk: 🚨 security-boundary: This resolver determines whether plugin and context-engine hooks receive authority to perform LLM completion.
  • 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 PR is exempt from the external-contributor real-behavior-proof gate; its body also records focused before/after test evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the binding helper and adjacent host capability paths to the introducing commit. (role: introduced current authority boundary; confidence: high; commits: bf70d5ddb6ec; files: src/agents/session-agent-binding.ts, src/agents/embedded-agent-runner/context-engine-capabilities.ts, src/plugins/plugin-command-execution.ts)

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-13T20:01:52.002Z sha 9804b14 :: needs maintainer review before merge. :: none

@clawsweeper
clawsweeper force-pushed the fix/session-agent-binding-strict branch from 9804b14 to 8c291c5 Compare August 15, 2026 00:47
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 15, 2026
@fuller-stack-dev
fuller-stack-dev merged commit c00dd28 into main Aug 15, 2026
193 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/session-agent-binding-strict branch August 15, 2026 14:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
w3evolutions pushed a commit to W3EvolutionsLLC/openclaw that referenced this pull request Aug 16, 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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

3 participants