fix: make session numbering per-case instead of global

The w1/w2/s1/s2 session counter was scanning all sessions regardless
of case name, causing cross-case number inflation. Now only counts
sessions belonging to the same case when determining the next number.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-23 22:22:27 +01:00
co-authored by Claude Opus 4.5
parent a41240049e
commit 9c322f7506
+6 -6
View File
@@ -1122,11 +1122,11 @@ class ClaudemanApp {
if (!workingDir) throw new Error('Case path not found');
let firstSessionId = null;
// Find the highest existing w-number for this case to avoid duplicates
// Find the highest existing w-number for THIS case to avoid duplicates
let startNumber = 1;
for (const [, session] of this.sessions) {
const match = session.name && session.name.match(/^w(\d+)-/);
if (match) {
const match = session.name && session.name.match(/^w(\d+)-(.+)$/);
if (match && match[2] === caseName) {
const num = parseInt(match[1]);
if (num >= startNumber) {
startNumber = num + 1;
@@ -1202,11 +1202,11 @@ class ClaudemanApp {
const workingDir = caseData.path;
if (!workingDir) throw new Error('Case path not found');
// Find the highest existing s-number for shells to avoid duplicates
// Find the highest existing s-number for THIS case to avoid duplicates
let startNumber = 1;
for (const [, session] of this.sessions) {
const match = session.name && session.name.match(/^s(\d+)-/);
if (match) {
const match = session.name && session.name.match(/^s(\d+)-(.+)$/);
if (match && match[2] === caseName) {
const num = parseInt(match[1]);
if (num >= startNumber) {
startNumber = num + 1;