Backfill paired agent metadata for raw service ids

This commit is contained in:
ejclaw
2026-04-10 16:20:23 +09:00
parent 2e62e125ae
commit ce3854745d
4 changed files with 48 additions and 3 deletions

View File

@@ -92,6 +92,7 @@ import {
CLAUDE_SERVICE_ID,
CODEX_MAIN_SERVICE_ID,
CODEX_REVIEW_SERVICE_ID,
OWNER_AGENT_TYPE,
SERVICE_ID,
SERVICE_SESSION_SCOPE,
normalizeServiceId,
@@ -1091,6 +1092,34 @@ describe('paired task state', () => {
});
});
it('backfills configured owner agent type when creating a paired task with a raw non-shadow owner service id', () => {
createPairedTask({
id: 'paired-task-raw-owner-service',
chat_jid: 'dc:paired-raw-owner-service',
group_folder: 'paired-raw-owner-service',
owner_service_id: 'andy',
reviewer_service_id: CLAUDE_SERVICE_ID,
title: null,
source_ref: 'HEAD',
plan_notes: null,
review_requested_at: null,
round_trip_count: 0,
status: 'active',
arbiter_verdict: null,
arbiter_requested_at: null,
completion_reason: null,
created_at: '2026-03-28T00:00:00.000Z',
updated_at: '2026-03-28T00:00:00.000Z',
});
expect(getPairedTaskById('paired-task-raw-owner-service')).toMatchObject({
owner_service_id: 'andy',
reviewer_service_id: CLAUDE_SERVICE_ID,
owner_agent_type: OWNER_AGENT_TYPE,
reviewer_agent_type: 'claude-code',
});
});
it('preserves raw legacy paired task service ids during init when registered group metadata is present', () => {
const tempDir = fs.mkdtempSync('/tmp/ejclaw-paired-task-legacy-groups-');
const dbPath = path.join(tempDir, 'messages.db');