Skip to content

Bug: Session not automatically reset after lock failure #833

Closed

Description

@arun-gupta

Description

When the Telegram bridge fails with a session file lock error #831, the session is left in a broken state with accumulated "Tool not found" errors in the conversation history. On the next message, the agent resumes that corrupted context and behaves erratically (e.g., responding to "Hello" with "Let me open a new shell")

Reproduction Steps

  1. Set up the Telegram bridge with nemoclaw start
  2. Send a message that triggers the session lock error (code 255)
  3. Send another message — the agent responds with unrelated tool invocations instead of a normal reply

Expected behavior:

After a lock failure, the bridge should either start a fresh session or discard the broken context before the next message.

Actual behavior:

The broken context persists and corrupts subsequent responses.

Workaround:

nemoclaw my-nemoclaw connect
rm /sandbox/.openclaw-data/agents/main/sessions/*.jsonl
rm /sandbox/.openclaw-data/agents/main/sessions/sessions.json
exit

Environment

  • NemoClaw: v0.1.0
  • OpenShell: 0.0.14
  • OpenClaw: 2026.3.11 (29dc654)
  • macOS: Apple M4 Pro (arm64)
  • Container runtime: Docker Desktop
  • Provider: nvidia-nim (NVIDIA Endpoint API)

Debug Output

Logs

Checklist

  • I confirmed this bug is reproducible
  • I searched existing issues and this is not a duplicate

Activity

  1. added
    integration: telegram
    on Mar 25, 2026
  2. wscurran commented on Mar 25, 2026

    @wscurran
    Contributor

    ✨ Thanks for submitting this issue with a detailed summary, it addresses a bug with the session not being automatically reset after a lock failure, which could be related to the Telegram integration or session management.


    Possibly related open PRs:
    #862 fix: auto-reset telegram bridge session after lock failure,
    #860 fix: queue telegram bridge messages per chat to prevent session lock contention,
    #750 fix(setup-spark): clarify that onboard must be re-run after setup (fixes #738)

  3. dknos commented on Mar 30, 2026

    @dknos
    Contributor

    Related to #831 — clearing lock files at startup prevents this state entirely

    The broken session state described here is a downstream effect of the lock failure in #831. If the lock files are cleared before the bridge starts, the agent never enters this broken state.

    See our workaround in #831 — running find /sandbox/.openclaw-data -name "*.lock" -delete via SSH before starting any bridge process prevents both the initial lock failure and this residual broken session state.

    If you're already in the broken state (accumulated "Tool not found" errors), deleting the session files directly resolves it:

    SSH_CONF=$(mktemp)
    openshell sandbox ssh-config my-assistant > "$SSH_CONF"
    ssh -T -F "$SSH_CONF" "openshell-my-assistant" \
      'rm -f /sandbox/.openclaw-data/agents/main/sessions/*.lock
       rm -f /sandbox/.openclaw/agents/main/sessions/sessions.json'
    rm -f "$SSH_CONF"

    The agent will start a fresh session on the next message. Note: this clears conversation history, so back up sessions.json first if you want to preserve it.

  4. self-assigned this
    on Mar 30, 2026
  5. prekshivyas commented on Apr 2, 2026

    @prekshivyas
    Collaborator

    Closing — this was the downstream consequence of #831, and both are eliminated by #1081.

    The corrupted session state described here (accumulated "Tool not found" errors, erratic agent behavior on subsequent messages) was caused by the host-side Telegram bridge spawning overlapping SSH-based openclaw agent invocations that competed for the same session lock. When a call failed mid-operation (code 255), it left partial writes in the session .jsonl file, and the next message resumed that broken context.

    With #1081, the host-side bridge is removed entirely. Messaging now runs as native OpenClaw channels inside the sandbox, where session access is serialized within the same process — there is no external mechanism to produce the lock contention that caused the corrupted session state in the first place.

  6. added theissue type on Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

integration: telegram

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions