Skip to content

feat(engine): per-intent LLM chain-head rotation (opt-in llm_rotate) - #114

Merged
BaaRai merged 1 commit into
mainfrom
feat/per-intent-llm-rotation
Oct 21, 2026
Merged

BaaRai merged 1 commit into
mainfrom
feat/per-intent-llm-rotation

Conversation

@BaaRai

@BaaRai BaaRai commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Opt-in per-intent rotation of the task LLM chain heads (#85, per-intent rotation shape).

  • POST /api/tasks accepts llm_rotate (default false = unchanged ordered failover); tasks.llm_rotate column with idempotent ALTER; DTO exposes it
  • when enabled, each claimed WORKER intent pins the next chain head (strict round-robin) into the run context; the pin flows through the provider resolver (taskLLMStreamHooks.current now receives ctx)
  • a pin is a dispatch preference only: it must be a member of the task chain, and an exhausted chain (no active head) stays exhausted - failover semantics untouched; planner/goals/mainagent always use the active head
  • unit tests: pin roundtrip, round-robin sequence, empty-chain guard; existing failover tests updated to the new hook signature

Use case: chain [A, B] with llm_rotate=true puts lane 1 on model A and lane 2 on model B for different lenses on the same hunt, which the manual per-role bindings could not do for parallel worker lanes.

Implements the per-intent rotation shape from #85: a task created with
llm_rotate=true distributes worker intents round-robin over its LLM chain
heads, so lane A can hunt on one model while lane B hunts on another
(different lenses per intent, no extra tokens). Default stays the classic
ordered failover from the active head; planner/goals/mainagent keep the
active head always.

Mechanics: the engine pins the next chain head into the run context when a
worker claims an intent; the pin travels through the provider resolver
(hooks.current now takes ctx). A pin is only a dispatch preference - it must
belong to the task chain and never bypasses failover state (an exhausted
chain stays exhausted). Schema: tasks.llm_rotate boolean, default false,
idempotent ALTER; exposed on the create payload and the task DTO.

Closes #85 (the ensemble/P4 shape stays parked as before)
@BaaRai
BaaRai merged commit 7f14805 into main Oct 21, 2026
3 checks passed
murilosoave pushed a commit to murilosoave/ARTEX that referenced this pull request Oct 25, 2026
murilosoave pushed a commit to murilosoave/ARTEX that referenced this pull request Oct 25, 2026
feat(engine): per-intent LLM chain-head rotation (opt-in llm_rotate)
murilosoave pushed a commit to murilosoave/ARTEX that referenced this pull request Oct 25, 2026
Seam fix after merging BaaRai#111 (escalation) with BaaRai#114 (ctx-threaded
hooks.current): the escalation test predates the signature change and kept
compiling on its own branch, so the merge left main red.
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