-
Notifications
You must be signed in to change notification settings - Fork 26
Bug: Session key case mismatch — project.name vs project.slug in dispatch #500
Description
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_finishcall 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
- Register a project with a mixed-case name (e.g.,
blECSd) - Let a worker get dispatched to an issue
- Worker completes work, creates PR, calls
work_finish work_finishfails — 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:
- Use
project.sluginstead ofproject.namewhen building session keys (since the slug is already lowercase and is the canonical identifier) - Normalize the key to lowercase in the key construction
- Use case-insensitive comparison in
work_finishslot 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