Skip to content

fix: media replies fail after prompt lock release#100033

Closed
scotthuang wants to merge 3 commits into
openclaw:mainfrom
scotthuang:fix/session-lock-message-tool-mirror
Closed

fix: media replies fail after prompt lock release#100033
scotthuang wants to merge 3 commits into
openclaw:mainfrom
scotthuang:fix/session-lock-message-tool-mirror

Conversation

@scotthuang

@scotthuang scotthuang commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users sending multiple visible message-tool media replies could see the embedded agent fail with session file changed while embedded prompt lock was released after the media had already been delivered.

The affected workflow is embedded agent delivery through channel message tools, especially batched image/media sends that mirror visible deliveries into the session transcript while the prompt lock is released.

Why This Change Was Made

Prompt-lock recovery already preserves delivery mirror transcript appends, but the recovery classifier did not recognize side-append leaf controls written with those mirrors. This change treats only structurally valid appendMode: "side" leaf controls as prompt-released opaque entries so SessionManager can merge the delivery side branch, while active leaf controls remain takeover-triggering edits.

User Impact

Users can receive batched media replies without the agent falsely reporting a session takeover during cleanup. The session takeover fence still rejects prompt-affecting branch changes and malformed leaf controls.

Evidence

  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt.session-lock.test.ts -- --reporter=verbose passed, 110 tests.
  • pnpm build passed after adding the redacted prompt-release proof logs.
  • git diff --check passed.
  • .agents/skills/autoreview/scripts/autoreview --mode local passed with no accepted/actionable findings after the active-leaf guard was tightened.
  • Live local proof on fixed gateway 2026.7.1-beta.1 (5c30bcf), 2026-07-05 02:14 Asia/Shanghai, redacted Weixin direct chat:
    • message tool started batched visible media sends at 02:14:20.
    • 11 local image uploads were attempted: 5 hilton-* images and 6 yatu-* images.
    • 11 sendImageMessageWeixin: success entries were logged between 02:14:21 and 02:14:27.
    • prompt-released session change merged was logged repeatedly during those media deliveries, showing prompt-released transcript changes were merged instead of treated as takeover.
    • embedded run agent end ... isError=false and message processed ... outcome=completed were logged at 02:14:30-02:14:31.
    • No new session file changed while embedded prompt lock was released or EmbeddedAttemptSessionTakeoverError entries appeared during the fixed-gateway test window; the only matching entries in the same local log were from the pre-fix npm-global run at 01:03.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 7:02 PM ET / 23:02 UTC.

Summary
The branch expands embedded session-lock prompt-release handling for delivery-mirror side leaf controls with SessionManager active-leaf guards and tests, while the live head also carries broad unrelated UI/plugin/mobile/dependency/workflow changes.

Reproducibility: yes. source-level: current main rejects normal prompt-released side leaf controls, and the PR body provides live logs showing the fixed gateway merged media-delivery side branches without a takeover error.

Review metrics: 3 noteworthy metrics.

  • Live PR size: 586 files, +37322/-5559. The live diff is far larger than the described session-lock repair and needs narrowing before meaningful merge review.
  • Dependency graph changes: 1 package manifest added, 1 lockfile changed. The repository guard blocks dependency graph changes from this external PR unless admin/security approves the current head.
  • Workflow changes: 2 workflows changed. Release and Mantis workflow behavior changes have automation blast radius and are not covered by the session-lock proof.

Stored data model
Persistent data-model change detected: persistent cache schema: apps/android/app/src/main/java/ai/openclaw/app/chat/ChatTranscriptCache.kt, persistent cache schema: ui/src/pages/chat/chat-composer.test.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦐 gold shrimp
Patch quality: 🦪 silver shellfish
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Rebase and narrow the branch to the session-lock files and focused tests.
  • Remove dependency graph and workflow changes or obtain explicit admin/security and owner approval.
  • Refresh proof after narrowing so it covers the final merge diff.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: Redacted logs are sufficient for the session-lock fix, but the live head also changes dependency, workflow, UI, plugin, and mobile surfaces without matching real behavior proof. 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.

Risk before merge

  • [P1] The live head is conflicting and much broader than the session-lock fix, so maintainers cannot review or merge it as the narrow bugfix described in the PR body.
  • [P1] Dependency graph changes are present and the repository dependency guard blocks this head unless admin/security explicitly approves the current SHA.
  • [P1] The intended fix changes a session-state takeover boundary by admitting one prompt-released side leaf-control shape, which still needs maintainer acceptance.
  • [P1] Workflow changes to release and Mantis automation are unrelated to the session-lock proof and need separate owner review if they remain.

Maintainer options:

  1. Rebase and narrow before merge (recommended)
    Remove the dependency graph, workflow, plugin, UI, mobile, and generated-file drift so the PR contains only the session-lock repair and its tests.
  2. Approve broad dependency and workflow risk
    If these extra changes intentionally ride this PR, require explicit admin/security and workflow-owner approval for the current SHA before merge.
  3. Pause or replace the PR
    If the branch cannot be cleaned safely, pause this PR and land the useful session-lock fix through a narrow replacement.

Next step before merge

  • [P1] A maintainer should require a narrow rebase or explicitly approve the dependency/workflow risk before the useful session-lock fix can proceed.

Maintainer decision needed

  • Question: Should this PR be allowed to proceed only after it is rebased/narrowed to the session-lock fix, or should maintainers explicitly approve the unrelated dependency graph and workflow changes on this head?
  • Rationale: The central bugfix is plausible, but the current head includes supply-chain and automation surfaces that require maintainer/security intent rather than automated cleanup alone.
  • Likely owner: steipete — He owns the latest guard commit and is the assigned reviewer for the session-state boundary choice.
  • Options:
    • Require a narrow rebase (recommended): Keep the session-lock fix and tests, but remove stale-base dependency, workflow, plugin, UI, mobile, and generated-file changes before merge review.
    • Approve the broad head: A repository admin/security owner can explicitly approve the dependency graph and workflow changes and then review the full 586-file merge risk.
    • Replace the branch: If the contributor branch cannot be cleaned, close it after opening or adopting a narrow replacement that preserves the useful session-lock work.

Security
Needs attention: The central session-lock code is not security-sensitive, but the live head adds dependency graph and workflow changes that require supply-chain and automation review.

Review findings

  • [P1] Remove dependency graph changes from this bugfix — extensions/logbook/package.json:1
  • [P2] Drop unrelated release workflow edits — .github/workflows/openclaw-release-checks.yml:541
Review details

Best possible solution:

Rebase and narrow the branch to the session-lock classifier, SessionManager guard, and focused tests, then rerun the relevant session-state and dependency-guard checks.

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

Yes, source-level: current main rejects normal prompt-released side leaf controls, and the PR body provides live logs showing the fixed gateway merged media-delivery side branches without a takeover error.

Is this the best way to solve the issue?

Partly: the central classifier plus SessionManager guard is the right narrow layer, but the current broad/conflicting head is not the best merge vehicle until it is rebased and narrowed.

Full review comments:

  • [P1] Remove dependency graph changes from this bugfix — extensions/logbook/package.json:1
    The live PR diff includes extensions/logbook/package.json plus pnpm-lock.yaml, and the dependency graph guard blocks this head unless admin/security approves it. Since the stated fix is the session-lock media path, remove these package graph changes from the branch or get explicit approval before merge.
    Confidence: 0.92
  • [P2] Drop unrelated release workflow edits — .github/workflows/openclaw-release-checks.yml:541
    This changes release-check setup to install dependencies in a PR whose description and proof are about prompt-lock media delivery. Release workflow behavior has automation blast radius, so this should be removed during the rebase/narrowing or reviewed as an intentional workflow change with separate proof.
    Confidence: 0.86

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: The live head includes dependency graph and package-manifest changes that can alter install/package behavior and are guard-blocked.
  • add merge-risk: 🚨 automation: The diff changes release and Mantis workflow behavior, so green session-lock tests would not settle automation impact.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Redacted logs are sufficient for the session-lock fix, but the live head also changes dependency, workflow, UI, plugin, and mobile surfaces without matching real behavior proof. 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.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: The intended change fixes a focused session-lock media-delivery bug, while the current blockers are normal pre-merge cleanup and owner review.
  • merge-risk: 🚨 compatibility: The live head includes dependency graph and package-manifest changes that can alter install/package behavior and are guard-blocked.
  • merge-risk: 🚨 session-state: The intended fix changes which prompt-released transcript leaf controls are merged instead of treated as takeover.
  • merge-risk: 🚨 automation: The diff changes release and Mantis workflow behavior, so green session-lock tests would not settle automation impact.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Redacted logs are sufficient for the session-lock fix, but the live head also changes dependency, workflow, UI, plugin, and mobile surfaces without matching real behavior proof. 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

Security concerns:

  • [medium] Blocked dependency graph change — extensions/logbook/package.json:1
    The PR adds a package manifest and lockfile importer for Logbook, and GitHub's dependency graph guard says admin/security approval is required for this head.
    Confidence: 0.94
  • [medium] Unrelated release workflow behavior change — .github/workflows/openclaw-release-checks.yml:541
    The release checks workflow now installs dependencies in the release-package path, which is a CI/release execution surface not covered by the session-lock proof.
    Confidence: 0.84

Acceptance criteria:

  • [P1] After narrowing, rerun the focused session-lock tests named in the PR body.
  • [P1] Confirm the dependency graph guard no longer reports package or lockfile changes unless explicitly approved.
  • [P1] Confirm GitHub reports the rebased PR as clean or mergeable before merge review.

What I checked:

Likely related people:

  • steipete: Assigned to the PR and authored the latest active-leaf preservation guard commit on the affected session-state files. (role: reviewer and likely follow-up owner; confidence: high; commits: ed896d51ad5d; files: src/agents/embedded-agent-runner/run/attempt.session-lock.ts, src/agents/sessions/session-manager.ts, src/agents/sessions/session-manager.test.ts)
  • Wynne668: Current-main blame for the classifier and SessionManager merge surface maps to the grafted d405cda commit in this checkout. (role: current-main provenance; confidence: medium; commits: d405cda95acc; files: src/agents/embedded-agent-runner/run/attempt.session-lock.ts, src/agents/sessions/session-manager.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-04T18:10:44.030Z sha 5c30bcf :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T18:26:45.385Z sha 5c30bcf :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T18:34:14.838Z sha 5c30bcf :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T18:40:56.603Z sha 5c30bcf :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T20:50:49.591Z sha 5c30bcf :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T15:16:10.803Z sha fea5972 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T17:13:44.068Z sha 8f19101 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T19:23:15.907Z sha 8f19101 :: needs maintainer review before merge. :: none

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 4, 2026
@scotthuang

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 4, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 4, 2026
@scotthuang
scotthuang marked this pull request as ready for review July 4, 2026 18:35
@scotthuang
scotthuang force-pushed the fix/session-lock-message-tool-mirror branch from 5c30bcf to fea5972 Compare July 5, 2026 14:59
@steipete
steipete requested a review from a team as a code owner July 5, 2026 22:47
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call labels Jul 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling channel: irc extensions: openai extensions: minimax extensions: qa-lab extensions: codex extensions: google plugin: logbook Logbook automatic work journal plugin size: XL and removed size: S labels Jul 5, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/logbook/package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Dependency graph changes are blocked

OpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph.

Detected dependency graph changes:

  • pnpm-lock.yaml changed.
  • extensions/logbook/package.json changed devDependencies, peerDependencies, peerDependenciesMeta, name, version.

Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:

  • extensions/logbook/package.json changed devDependencies, peerDependencies, peerDependenciesMeta, name, version.

Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed.

To remove lockfile changes, restore them from the target branch:

git fetch origin
git checkout 'origin/main' -- 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git push

If this PR intentionally needs a dependency graph change, ask a repository admin or member of @openclaw/openclaw-secops to comment:

/allow-dependencies-change

The action will approve the current head SHA (ed896d51ad5d5a570ba98f7b0baed646f7c4d163) when it reruns. A later push requires a fresh approval.

@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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Jul 5, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Landed the corrected implementation through #100490 as a1f4aa4a3bb0de582b724c5f11df0c0f5f2f09ca.

The replacement was necessary because the original fork/current ancestry could not be updated safely after the deeper refactor. It preserves @scotthuang's contribution with Co-authored-by trailers, adds full-batch validation before mutation, and rejects active-branch changes plus explicit side-cursor resets. Proof includes 163 focused Testbox cases, the original 11-image live Weixin run, fresh autoreview, and exact-head hosted CI.

Thank you @scotthuang for the report, implementation, and live proof.

@steipete steipete closed this Jul 6, 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 app: android App: android app: ios App: ios app: macos App: macos app: web-ui App: web-ui channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: irc channel: matrix Channel integration: matrix channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo cli CLI command changes commands Command implementations dependencies-changed PR changes dependency-related files docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: codex extensions: google extensions: memory-core Extension: memory-core extensions: minimax extensions: openai extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. plugin: logbook Logbook automatic work journal plugin rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL 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.

2 participants