Skip to content

Warm hits respect the request's mode and the runtime the worker would pick #194

Closed

Description

@V3RON

Part of #173.

Scope

After this PR a warm device counts as a warm hit only when its mode fits the request and its runtime is the one the worker would pick. Status says, for each device, whether it would serve a request that names no mode. request.dispatched carries the requested mode.

Technical spec

File and line references are to main at 03c027f.

Modules touched

  • src/contract/schemas.ts (statusDeviceSchema, :102-119): required servesDefaultMode: boolean.
  • src/contract/protocol.ts: raise the range by one.
  • src/core/lease-acquisition-coordinator.ts, src/core/lease-ports.ts (:22-32): one method answers whether a device's pool mode (spec.mode, or full when absent) is the default mode of its platform. It lives where the default is resolved (ADR 0007 §2).
  • src/daemon/dispatcher.ts (#decorateDevice, :590): sets the field. It feeds both status.get and list.get, so the gateway view gets it through the existing parse.
  • src/cli/index.ts (formatStatus): show it.
  • src/gateway/routing.ts: RoutableRequest gains mode. src/gateway/fleet-coordinator.ts (routable(), :1031-1038) passes it, and request.dispatched carries it when the request named one.
  • src/gateway/routing/stages/warm-hit.ts: the rule of ADR 0009 §6. Mode: full needs mode: "full", slim needs mode: "slim", none needs servesDefaultMode. Runtime: the one requested; with none requested, the catalog's defaultRuntime if the model pairs with it, otherwise the model's only paired runtime, otherwise no hit.
  • src/gateway/test-support.ts: device fixtures fill the new field.
  • Docs: docs/CLI.md, docs/HTTP-API.md, docs/CLIENT.md (the status field), both EVENTS.md files, docs/internal/KNOWN-PITFALLS.md (the three accepted gaps of ADR 0009), and ADR 0009's Consequences (the third gap, below).

Third accepted gap (maintainer's decision, 2026-10-05)

A --mode slim request on a runtime that cannot be slimmed (Android, iOS below 18.5) is not a warm hit on a ready full device, although the worker itself would reuse that device. This is accepted as a third gap: warm-hit keeps requiring mode: "slim" for a slim request. The PR adds it to ADR 0009's Consequences beside the two existing warm-hit gaps ("Three accepted gaps in warm hits") and to docs/internal/KNOWN-PITFALLS.md.

Contract and event changes

  • status.get and list.get devices gain required servesDefaultMode. Protocol version as above.
  • request.dispatched gains optional mode. Update its row in both EVENTS.md files.

Rules in play

  • ADR 0009 §6 and §8. ADR 0007 §2, §4, §6, §8.
  • architecture.md rule 1, rule 10 (the default mode is still read in one module), rule 13.
  • safety.md rule 10.
  • events.md rules 6 and 8.
  • testing.md rules 1 to 3.

Tests

  • A slim warm device is not a warm hit for a full request while another worker has free capacity.
  • A full warm device is not a warm hit for a slim request.
  • A request with no mode is a warm hit only on a device that reports servesDefaultMode.
  • A device whose pool mode equals its platform's default reports servesDefaultMode: true, and one whose pool mode differs reports false.
  • A warm device on a runtime other than the one the worker would pick is not a hit for a request with no runtime.
  • With no defaultRuntime pairing and several paired runtimes, a request with no runtime gets no warm hit.
  • status.get and list.get return servesDefaultMode for every device.
  • request.dispatched carries the requested mode, and none when the request named none.
  • simlock status prints the field.

Done when

  • Every test above passes and pnpm check is green.
  • simlock status --json shows mode and servesDefaultMode for every device.

Out of scope

  • Storing the mode of the request that created a device.
  • Preferring slim or full workers when no device is warm.

Depends on

Approval

  • Approved for delivery

Written by an agent.

Activity

  1. added
    task:draft
    on Oct 1, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Oct 2, 2026
  3. github-actions commented on Oct 2, 2026

    @github-actions
    Contributor

    Now task:ready: approved, technical spec present, #191, #177, #178 closed.

  4. V3RON commented on Oct 4, 2026

    @V3RON
    ContributorAuthor

    Spec updated: Depends on gains #193 and #195 (overlapping files and protocol bump).

    Written by an agent.

  5. added
    task:draft
    and removed
    task:ready
    on Oct 4, 2026
  6. github-actions commented on Oct 4, 2026

    @github-actions
    Contributor

    Back to task:draft: waiting on #193, #195.

  7. added
    task:ready
    and removed
    task:draft
    on Oct 4, 2026
  8. github-actions commented on Oct 4, 2026

    @github-actions
    Contributor

    Now task:ready: approved, technical spec present, #191, #177, #178, #193, #195 closed.

  9. self-assigned this
    on Oct 4, 2026
  10. V3RON commented on Oct 4, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done

    • Branch task/194, draft PR feat(gateway): warm hits respect the request's mode and the runtime the worker would pick #325. All 9 spec tests green, pnpm check green, pnpm mutate 3 alive, all equivalent.
    • Review round 1: 0 blocking, 4 confirmed notes not yet fixed: KNOWN-PITFALLS heading says "two gaps"; pipeline.test.ts:133 "removes it again" half proves nothing; KNOWN-PITFALLS cites ADR 0007 §6 where §4 is meant; daemon-protocol/index.test.ts:21 history comment stops at 11.

    Not done

    • The four notes, review round 2, the merge.

    Findings

    Blocked on

    • Maintainer: a --mode slim request on a runtime that cannot be slimmed (Android, iOS below 18.5) misses a ready full device the worker would reuse, since warm-hit requires mode: "slim". Accept it as a third gap in ADR 0009 Consequences, or change ADR 0009 §6 and this spec.

    Written by an agent.

  11. added
    task:blocked
    and removed
    task:ready
    on Oct 4, 2026
  12. removed their assignment
    on Oct 4, 2026
  13. added
    task:ready
    and removed
    task:blocked
    on Oct 5, 2026
  14. self-assigned this
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions