-
-
Notifications
You must be signed in to change notification settings - Fork 80.3k
chore: typed error for cron delivery.channel="last" when no prior chat exists #80984
Copy link
Copy link
Open
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
No fields configured for issues without a type.
Follow-up to a forthcoming PR that introduces a typed
WebchatNotDeliverableErrorthrown fromresolveMessageChannelSelectionfordelivery.channel: "webchat"(the internal session-bound surface, not a deliverable channel plugin).The cron delivery resolver (
resolveDeliveryTargetinsrc/cron/jobs.ts, calling intosrc/infra/outbound/channel-selection.ts) has a sibling failure family that surfaces the same generic wrapped error string —"Channel is required (no configured channels detected). Set delivery.channel explicitly or use a main session with a previous channel."— but for a different root cause:delivery.channel: "last"(or omitted) when the resolved session key has no prior chat in the session store to anchor against.Today both failure modes wrap to the same string at
assertSupportedJobSpec/ the cron-runner delivery resolver, which makes them indistinguishable intask_runs.errorand inopenclaw cron listoutput (e.g.announce -> last (last -> no route, will fail-closed: Channel...)). Operators have to readcron show <id>and cross-reference session state to tell whether they configured a bad channel or just have a fresh session with no chat history.Proposal
Add a parallel typed error (working name:
NoPriorChatChannelError) thrown from the sameresolveMessageChannelSelectionsite (or from the cron-sideresolveDeliveryTargetif that is the cleaner seam) when:params.channelnormalizes to"last"(or is undefined/empty meaning "infer from session history"), ANDlastChannelrecorded, ANDparams.fallbackChannelresolvable.Message should name the actionable fixes: configure a real channel and switch
delivery.channelto it explicitly, or usesessionTarget: "session:agent:<id>:main"withpayload.kind: "agentTurn"anddelivery.mode: "none"so the agent turn output renders in its own session without an announce route.Why not include in the original PR
To keep the original diff focused. The webchat case is structurally non-deliverable (a property of the channel constant); the
"last"case is dependent on session state at fire time (a property of the session store). Different invariants, different message text, and the"last"case probably wants its own test fixtures around stale/empty session history.Source pointers (paths at the time of filing)
src/utils/message-channel-constants.ts—INTERNAL_MESSAGE_CHANNEL,WebchatNotDeliverableError(introduced in the original PR; the new error would live next to it).src/infra/outbound/channel-selection.ts—resolveMessageChannelSelection. The webchat check is at the top of the explicit-channel branch in the original PR.src/cron/jobs.ts—resolveDeliveryTarget, where the wrapping happens today.docs/automation/cron-jobs.md— the "Webchat is not an announce target" subsection added by the original PR.The original PR link will be added in a comment here once it is opened.