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 <noreply@anthropic.com>
This commit is contained in:
harshitsinghbhandari 2026-04-17 10:07:42 +05:30
parent 593eec441a
commit 0093e2b4e4
1 changed files with 4 additions and 3 deletions

View File

@ -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"
) {