Skip to content

fix(core): Variant PROTOCOLS table reads through the prototype chain — a model package named "constructor" resolves to the Object function #862

Closed

Description

@dezren39

Problem

packages/core/src/variant.ts:30 reads PROTOCOLS[model.package] where PROTOCOLS (variant.ts:606) is a plain-object Readonly<Record<string, Protocol>> and model.package is externally supplied (model/catalog config). A package named constructor / toString / __proto__ resolves through the prototype chain to an inherited value (truthy) instead of missing, so the if (!protocol) return [] guard at line 31 does not fire and the inherited function is called as a protocol factory.

Found by the #833 prototype-chain class audit (triage, queue task 3141, main 71608cb 2026-10-29). Same class as #774/#791 et al.; this site was not among the ten known instances.

Fix shape

Own-property read, following the pattern already used at the fixed sites: Object.hasOwn(PROTOCOLS, model.package) ? PROTOCOLS[model.package] : undefined — or the shared guard if the #833 guard follow-up lands first. Add a regression test with model.package = "constructor" (and toString) expecting no variants / no throw.

agent-note:v1
state: filed
Agent: repo-worker-opencode (queue task 3141)
Found via: #833 sweep, pattern P-A (uppercase plain-object table, externally-keyed bracket read, no Object.hasOwn guard)
Parent: #833

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
  3. added
    queue/queuedHas a queued task in the Supabase agent queue
    app/corePackage: core (pkgs/ or apps/ in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 29, 2026
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    🤖 Dispatcher hand-back — executor-saturated · openchamber-dispatcher run 2026-10-29 07:15 CDT

  5. added
    queue/claimedA queue worker has claimed the task for this item
    work/assignedAn agent holds this item via the queue (claimed task)
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
  6. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    Claimed by Lane A (opencode) — task 3393. Implementing the own-property guard for the PROTOCOLS[model.package] read in packages/core/src/variant.ts, with a regression test for package names constructor/toString.

  7. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    🤖 Agent note · picked up

    • Agent: issue sweep (issue-sweep-rotating)
    • Session / ID: issue-sweep-rotating run 2026-10-29T12:24Z
    • Found via: sweep pickup (queue/queued only; dispatcher hand-back 12:20Z said executor-saturated — taking it via the lifecycle protocol §2(c) cancel-out)
    • Task: Fix the Variant PROTOCOLS prototype-chain read at packages/core/src/variant.ts:30 — own-property read + regression tests for package "constructor"/"toString".
    • Expectation: effort/xs — done = branch sweep/862-variant-protocols pushed, PR opened referencing fix(core): Variant PROTOCOLS table reads through the prototype chain — a model package named "constructor" resolves to the Object function #862, targeted variant tests pass on the laptop, merged when CI green.
  8. 20 remaining items

  9. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedA queue worker has claimed the task for this item
    on Oct 29, 2026
  10. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    🤖 Agent note · parked (CI rerun still pending)

  11. added
    queue/claimedA queue worker has claimed the task for this item
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 29, 2026
  12. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    🤖 Agent note · picked up (resumed as shepherd)

  13. removed
    queue/claimedA queue worker has claimed the task for this item
    work/assignedAn agent holds this item via the queue (claimed task)
    on Oct 29, 2026
  14. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    🤖 Agent note · done (merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/corePackage: core (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions