Skip to content

@usine/orchestrator/polling-triggers

Outcomes of one poll over all managed repositories, including isolated failures and backoff.

  • Schema.Class

new PollCycle(…args): PollCycle

Parameter Type
…args [props: object, options?: MakeOptions]

PollCycle

readonly changedItems: number

readonly failures: readonly RepositoryPollFailure[]

readonly nextPollAt: Option<Utc>

readonly preflightFindings: readonly LabelPreflightFinding[]

readonly repositories: number

readonly revokedRuns: number

How many Runs this cycle revoked because their item stopped matching.

readonly submissions: readonly (Claimed | Queued | Ignored | CycleBlocked)[]


Keeps managed repositories’ Boards current and evaluates their active Loops against changed Items.

  • Context.ServiceClass

readonly Service: object

The service’s operations: what yield* PollingTriggers returns.

readonly hint: (repository, item, backoffUntil?) => Effect.Effect<void>

Nudges an authoritative Item fetch after a self-write, retaining any request backoff from the writer. Pending duplicates coalesce; polling repairs loss.

Parameter Type
repository RepositoryName
item ChangedItem
backoffUntil? Option.Option<DateTime.Utc>

Effect.Effect<void>

readonly latest: Effect.Effect<Option.Option<PollCycle>>

The last completed cycle, including its isolated failures; absent until the first cycle completes.

readonly poll: (instance) => Effect.Effect<PollCycle, EnginePersistenceError>

Polls every managed repository, including those without active Loops. Label preflight precedes change detection; each changed Item is projected before its Run decisions. Known open pull requests are fetched again every cycle, changed or not, so mergeability that moves without an Item update still reaches the Board and Loops; changedItems counts detection only. A repository commits its cursor only after all Items finish. Repository failures are reported while siblings continue; failure to read Loop runtime state fails the whole cycle.

Parameter Type
instance LoadedInstance

Effect.Effect<PollCycle, EnginePersistenceError>

readonly run: (instance) => Effect.Effect<never>

Repeats cycles at the configured interval and processes self-write Hints, respecting GitHub request backoff.

Parameter Type
instance LoadedInstance

Effect.Effect<never>

readonly static layer: Layer<PollingTriggers, never, ConfigParser | ExpressionEngine | CycleBudgets | RunEngine | CursorStore | ItemProjectionWriter | LoopControl | RepositoryLabelProjectionReader | RepositoryLabelProjectionWriter | GitHubPolling | LabelReconciler>


One repository whose cycle failed; its siblings finished normally.

  • Schema.Class

new RepositoryPollFailure(…args): RepositoryPollFailure

Parameter Type
…args [props: object, options?: MakeOptions]

RepositoryPollFailure

readonly errorTag: string

readonly message: string

readonly repository: string & Brand<"RepositoryName">

const GitHubItemKey: Schema.compose<Schema.fromJsonString<Schema.Tuple<readonly [Schema.Literal<"github">, Schema.brand<Schema.String, "RepositoryName">, Schema.brand<Schema.Int, "ItemNumber">]>>, Schema.toType<Schema.brand<Schema.NonEmptyString, "ItemKey">>>

Identifies one GitHub issue or pull request across its changing snapshots. Encoding uses the canonical repository name and Item number; decoding lets Board consumers locate the Item associated with a Run. Schedule Runs identify the repository alone and do not decode as an Item.