feat(eve): stamp schedule-dispatched sessions with $eve.schedule#709
Open
warmwind wants to merge 1 commit into
Open
feat(eve): stamp schedule-dispatched sessions with $eve.schedule#709warmwind wants to merge 1 commit into
warmwind wants to merge 1 commit into
Conversation
Sessions started by a schedule dispatch carry no record of which schedule fired: the markdown form only gets $eve.trigger="schedule", and sessions a handler starts through args.receive(...) carry the target channel's kind, so trigger-based filtering cannot attribute runs to a schedule at all. The ScheduleDispatcher now wraps the dispatch in an eve context scope carrying the schedule name under the new ScheduleIdKey. buildRunContext inherits the key from the ambient scope into each run started inside the dispatch — covering RunInputs built out of the dispatcher's hands by authored channel receive hooks — and buildSessionAttributes emits it as $eve.schedule. $eve.trigger semantics are unchanged. Closes vercel#708 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0164WUaSv9mN58wgnnoN2vKG Signed-off-by: Oscar Jiang <pengj0520@gmail.com>
Contributor
|
@warmwind is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #708
Problem
Sessions started by a schedule dispatch carry no record of which schedule fired. The markdown form only gets
$eve.trigger = "schedule", and sessions a handler starts throughargs.receive(...)carry the target channel's kind instead — so trigger-based filtering can neither attribute runs to a specific schedule nor see channel-dispatched schedule work at all.Change
ScheduleIdKey(eve.scheduleId) context key.ScheduleDispatcher.triggerwraps the whole dispatch in an eve context scope (the unifiedcontextStorage, per the rule-19 invariant — no newAsyncLocalStorage) carrying the schedule name.buildRunContextinherits the key from the ambient scope into every run started inside the dispatch. This is what covers theargs.receive(...)path: thoseRunInputs are built by the target channel's authoredreceivehook, out of the dispatcher's hands, so the value cannot be threaded through explicitly.buildSessionAttributesemits it as$eve.schedule.$eve.triggersemantics are unchanged — channel-dispatched sessions keep the channel kind and carry provenance alongside it.Pure metadata addition, backward compatible:
attributes ->> '$eve.schedule' = <name>now yields a schedule's complete run history regardless of dispatch path.Testing
ScheduleDispatchertests assert the scope is active whenruntime.runfires for both the markdown form and theargs.receive(...)path, and cleared after the dispatch.readScheduleIdwell-formed/missing/malformed slots and the stamped session payload.pnpm test:unit(4435),pnpm test:integration(385), packagetypecheck,lint,guard:invariants,docs:checkall pass.🤖 Generated with Claude Code
https://claude.ai/code/session_0164WUaSv9mN58wgnnoN2vKG