fix: suppress teardown startup failures

This commit is contained in:
Tianyi Cui
2026-07-14 12:45:12 +08:00
parent 253f707c35
commit b47e4c5276
8 changed files with 14 additions and 9 deletions
+3 -1
View File
@@ -340,7 +340,8 @@ declare module 'cordis' {
/**
* A declarative agent entry failed before it could publish a live agent.
* Consumers that buffer work for the configured identity use this
* transient signal to reject that work instead of waiting forever.
* transient signal to reject that work instead of waiting forever. Normal
* factory teardown suppresses failures from the cancelled startup attempt.
* @param sessionId - exact shared agent/session identity that failed startup.
* @param error - persistence, setup, or publication failure.
* @mode emit
@@ -431,6 +432,7 @@ export class AgentLoop extends Service implements AgentFactory {
sessionId: SessionId,
error: unknown,
): void {
if (!this.ownership.isActive()) return
this.ctx.logger.warn(`agent "${configId}": config-driven ${action} of "${sessionId}" failed: ${renderThrown(error)}`)
const args: unknown[] = ['agent-loop/config-start-failed', sessionId, error]
for (const callback of this.ctx.events.dispatch('emit', args)) {