Skip to content

Bug: Session key case mismatch — project.name vs project.slug in dispatch #500

@Kadajett

Description

@Kadajett

The Problem

work_finish fails with "worker not active" for any project whose name differs in casing from its slug. The worker completes its task, creates a PR, but the dev-to-review transition never happens because work_finish cannot match the worker's session to its slot in projects.json.

Root Cause

Session key construction in the dispatch path uses project.name (mixed case), but the OpenClaw session runtime lowercases keys when creating sessions.

Line 29047 in dist/index.js (dispatch worker):

const sessionKey = `agent:${agentId ?? "unknown"}:subagent:${project.name}-${role}-${level}-${botName.toLowerCase()}`;

For a project with slug: "blecsd" and name: "blECSd", this produces:

Stored in projects.json: agent:lorene-whatsapp-gated:subagent:blECSd-developer-senior-lauree
Actual session key:      agent:lorene-whatsapp-gated:subagent:blecsd-developer-senior-lauree

Line 27536 (work_finish slot matching) does a strict === comparison:

if (slots[i].active && slots[i].issueId && 
    (!toolCtx.sessionKey || !slots[i].sessionKey || slots[i].sessionKey === toolCtx.sessionKey))

Since toolCtx.sessionKey comes from the runtime (lowercase) and slots[i].sessionKey comes from projects.json (mixed case), this never matches. The worker is skipped, and work_finish throws "worker not active."

Impact

  • Every work_finish call fails for affected projects
  • Issues never transition from "Doing" to "To Review"
  • PRs pile up with no review cycle
  • Workers show as permanently "active" in stale slots
  • Only projects with all-lowercase names are unaffected

Reproduction

  1. Register a project with a mixed-case name (e.g., blECSd)
  2. Let a worker get dispatched to an issue
  3. Worker completes work, creates PR, calls work_finish
  4. work_finish fails — slot not found

Workaround

Patched line 29047 to lowercase the entire session key:

const sessionKey = `agent:${agentId ?? "unknown"}:subagent:${project.name}-${role}-${level}-${botName.toLowerCase()}`.toLowerCase();

And manually fixed existing projects.json entries. This needs to be re-applied after every devclaw update.

Suggested Fix

Either:

  1. Use project.slug instead of project.name when building session keys (since the slug is already lowercase and is the canonical identifier)
  2. Normalize the key to lowercase in the key construction
  3. Use case-insensitive comparison in work_finish slot matching

Option 1 seems cleanest — the slug is already used everywhere else for lookups.

Environment

  • OpenClaw gateway v2026.3.2
  • DevcClaw (latest as of 2026-03-07)
  • Bare metal Ubuntu, systemd-managed gateway

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions