Skip to content

[apscheduler] fail preview chains safe when the idle deadline is lost - #289

Open
ricardo-agz wants to merge 1 commit into
ricardo/aps-declared-only-jobsfrom
ricardo/aps-preview-idle-failsafe
Open

[apscheduler] fail preview chains safe when the idle deadline is lost#289
ricardo-agz wants to merge 1 commit into
ricardo/aps-declared-only-jobsfrom
ricardo/aps-preview-idle-failsafe

Conversation

@ricardo-agz

@ricardo-agz ricardo-agz commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Prevent runaway preview environment chains:

An opted-in preview whose driver document was evicted lost its idle deadline, and the next wake adopted the chain from the message and kept it running with no traffic requirement until the deployment was deleted.

The core intuition: the idle deadline lives only in the document, so for an idle-bounded chain, document absence must mean stop, not run. Start and wake payloads now carry a config-derived idle_bounded marker (canonical across racing publishers), and a claim refuses to adopt an idle-bounded chain into a document without a deadline. The next real request re-activates the preview and skips the inactive interval — the already-documented expiry behavior.

Production and development are untouched: they are never idle-bounded, so their adoption rule (message is the authority, absence never strands the chain) is unchanged, including the vercel dev sidecar's per-process memory.

Also makes eviction observable: the driver logs whenever it rebuilds state from a message or refuses an idle-bounded adoption. Old messages without the payload field parse as unbounded.

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Aug 12, 2026 2:20am

Request Review

@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-preview-idle-failsafe branch from 221de82 to d704b3b Compare August 12, 2026 02:04
@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-preview-idle-failsafe branch from d704b3b to 8a5bf74 Compare August 12, 2026 02:16
@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-preview-idle-failsafe branch from 8a5bf74 to c83c0fc Compare August 12, 2026 02:20
The idle deadline lives only in the driver document. When that
document was evicted, the next wake adopted the chain from the
message and rebuilt it with no deadline, so an abandoned preview
kept invoking Functions until its deployment was deleted.

Start and wake payloads now carry a config-derived idle_bounded
marker, and a claim refuses to adopt an idle-bounded chain into a
document without a deadline: for a disposable preview, absence maps
to stopped, and the next real request re-activates it. Adoption and
refusal both log, making cache eviction observable in production.
Old messages without the field parse as unbounded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant