Skip to content

Match session and group names ignoring case - #112

Open
thomwolf wants to merge 5 commits into
mainfrom
fix/case-insensitive-session-lookup
Open

Match session and group names ignoring case#112
thomwolf wants to merge 5 commits into
mainfrom
fix/case-insensitive-session-lookup

Conversation

@thomwolf

@thomwolf thomwolf commented Aug 25, 2026

Copy link
Copy Markdown
Member

Problem

Group and session lookups by name compared with ===:

  • the cron runner looked its session up with candidate.name === job.agent.name, so a job pointing at "Reviewer" spawned a second session next to the existing "reviewer" instead of reusing it;
  • POST /api/agents group= only case-folded, without trimming or unicode-normalizing;
  • GET /api/agents had no way to narrow the roster to one group at all.

Fix

  • New server/src/agent-list.js: normalizeName() (trim, case-fold, NFC), sameName(), findByName(), filterAgentsByGroup(). The normalization runs on both the query side and the stored side, so the rule lives in one place.
  • Cron session lookup and groups.resolveSpawnGroup() use it.
  • GET /api/agents?group=<name> filters the roster by group name, matched ignoring case (documented in the environment skill text).

Tests

server/test/agent-list.test.mjs (32 checks): case/whitespace/unicode folding, roster filter (exact, lower, upper, padded, decomposed accent, unknown → empty, ungrouped rows never match), cron lookup (exact match wins; ambiguous folded matches or duplicate exact names fail clearly; blank/undefined never match), spawn group target (NONE still ungrouped, unknown still an error). Picked up automatically by run-suites.mjs.

Follow-up review and Space validation (2026-09-09)

Name resolution no longer silently chooses the first colliding session or group.
Ambiguity is reported before spawning or cron delivery. Updated group regressions
and isolated the cron scheduler fixture from stale scheduled jobs.

Current main (ef08e84) is merged. At
d5bd3e1cd9a4f40a55ffbb83a3e0e16eff22f660, the agent-list, spawn-group,
crons and cron-api suites passed locally and in the private testing Space
thomwolf/agent-manager.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NPZfnyKjzDrzq5pYt44dVk

thomwolf and others added 5 commits August 25, 2026 17:45
Group and session lookups by name compared with ===: a cron pointing at
"Reviewer" spawned a duplicate next to "reviewer", and group targets
were only case-folded, not trimmed or unicode-normalized.

Add agent-list.js with normalizeName() (trim, case-fold, NFC) applied on
both the query and the stored side; use it for the cron session lookup,
the spawn route's group target, and a new `?group=<name>` filter on
GET /api/agents (documented in the environment skill). Covered by
test/agent-list.test.mjs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPZfnyKjzDrzq5pYt44dVk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant