From 0093e2b4e4fa910b02a9ff871456156b0a249437 Mon Sep 17 00:00:00 2001 From: harshitsinghbhandari <24b4506@iitb.ac.in> Date: Fri, 17 Apr 2026 10:07:42 +0530 Subject: [PATCH] fix(core): use kind for orchestrator skip; honest report-surfacing copy Address Copilot review feedback on PR #117: - lifecycle-manager: replace string-matching guards (`metadata["role"]`, `session.id.endsWith("-orchestrator")`) with the authoritative `lifecycle.session.kind !== "orchestrator"` check. The previous guard missed numbered orchestrator IDs like `${prefix}-orchestrator-1`, which could let a fresh agent report incorrectly override an orchestrator session's status. - orchestrator-prompt: reword the "Explicit Agent Reports" section to stop promising automatic surfacing in status/dashboard. CLI/UI display work is not part of this PR; the prompt now describes reports as a hint to lifecycle inference and explicitly notes SCM/runtime truth still wins. Co-Authored-By: Claude --- packages/core/src/lifecycle-manager.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/lifecycle-manager.ts b/packages/core/src/lifecycle-manager.ts index 6c1a5d602..3d567e41b 100644 --- a/packages/core/src/lifecycle-manager.ts +++ b/packages/core/src/lifecycle-manager.ts @@ -791,13 +791,14 @@ export function createLifecycleManager(deps: LifecycleManagerDeps): LifecycleMan // Fresh agent reports outrank weak inference (idle-beyond-threshold / // default-to-working) but runtime death, activity waiting_input, and SCM // ground truth already short-circuited above. Orchestrator sessions and - // terminal states are skipped intentionally. + // terminal states are skipped intentionally — `lifecycle.session.kind` is + // the authoritative source (string-matching role/id suffixes misses + // numbered orchestrator IDs like `${prefix}-orchestrator-1`). const agentReport = readAgentReport(session.metadata); if ( agentReport && isAgentReportFresh(agentReport) && - session.metadata["role"] !== "orchestrator" && - !session.id.endsWith("-orchestrator") && + lifecycle.session.kind !== "orchestrator" && lifecycle.session.state !== "terminated" && lifecycle.session.state !== "done" ) {