Skip to content

fix(core): WellKnown {env:} substitution reads through the prototype chain — "{env:constructor}" injects the Object function into remote-config URLs/headers #864

Closed

Description

@dezren39

Problem

packages/core/src/wellknown.ts:88: {env:NAME} substitution does variables[name] ?? process.env[name] ?? "" where variables is a caller-supplied plain Record<string,string> and name comes from a remote manifest's remote_config url/headers (remote-supplied). {env:constructor} resolves variables["constructor"] to the Object function through the prototype chain — the ?? "" fallback never fires and the function source is coerced into the fetched URL / headers. Same symptom class as #804, different file (the #804 fix covered packages/core/src/config/variable.ts only).

Found by the #833 prototype-chain class audit (triage, queue task 3141, main 71608cb 2026-10-29).

Fix shape

Own-property reads for both variables and process.env (match the fixed shape in config/variable.ts:107-108), or the shared guard from the #833 follow-up. Regression test: manifest url containing {env:constructor} with empty variables substitutes "" (or the real env value only when actually set).

agent-note:v1
state: filed
Agent: repo-worker-opencode (queue task 3141)
Found via: #833 sweep, pattern P-C (Record bracket read with ?? fallback)
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)
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
  3. added
    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 binding · openchamber-dispatcher run 2026-10-29 05:45 CDT

    • Queue task: 3396 (repo-health-opencode-pilot, small_fix) ↔ issue fix(core): WellKnown {env:} substitution reads through the prototype chain — "{env:constructor}" injects the Object function into remote-config URLs/headers #864 (fix(core): WellKnown {env:} substitution reads through the prototype chain — "{env:constructor}" injects the Object function into remote-config URLs/headers)
    • Session: ses_e5e78b3cafeffeHnUJhprdY6ie (laptop OpenChamber, agent build) — the launch POST returned this id with promptDispatched: true, the session activity registry independently shows it busy, and its messages engage this task directly (below).
    • Pool: Fast (opencode-route/speed — the launch payload's model field was the fleet route id, per Drew's 2026-10-29 route-only rule; the route resolved server-side to opencode-go.personal muse-spark-1.3-contributor, xhigh). Fresh quota read this run ~05:47 CDT: opencode-go 5h 10.72% (reset 7:47 AM) / weekly 53.66% (reset Sun Nov 1 6:00 PM) / monthly 89.31% (reset Fri Nov 6 11:55 PM) — monthly ≥85%, named per the rule (under the used-to-100% rule the pool stays OPEN; only a known 100% closes) — plan quota only, never PAYG. Mechanical, well-specified own-property fix, effort/s, low risk, timebox 45m. Meta was NOT used: its quota read failed again this run ("No quota data in response", pool CLOSED per the per-pool gate).
    • Worktree / branch: ~/git/fleet/3396-864-wellknown-own-property on the laptop, branch queue/3396-864-wellknown-own-property (from freshly fetched origin/main a6d7f78)
    • Verified engaged: session busy; dispatcher re-verified the defect in the worktree before launch (wellknown.ts substitute: variables[name] ?? process.env[name] ?? "", unguarded; fixed sibling shape at config/variable.ts using Object.hasOwn). The session's assistant messages show it editing packages/core/src/wellknown.ts and packages/core/test/wellknown.test.ts, adding prototype-name regression cases for url and header substitution ({env:constructor} / {env:toString}), running the wellknown tests on the laptop (5 pass per its report), and stash-verifying the new tests catch the original bug. Changes uncommitted at binding time; the session is briefed to commit, push, and open a PR referencing fix(core): WellKnown {env:} substitution reads through the prototype chain — "{env:constructor}" injects the Object function into remote-config URLs/headers #864 (no merge). The queue task itself remains queued in the fleet queue (no targeted claim/binding verb exists yet — fix(script): stats.ts fetches have no deadline and buffer unbounded .json() bodies — PostHog, npm downloads, and the GitHub releases pager #1337/fix(changelog): read upstream changelog through a 1 MiB capped reader #1272); the owning lane reconciles/harvests from here, and the babysitter shepherds the session.
  5. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    Checkpoint (queue task 3396):

    Changed (branch queue/3396-864-wellknown-own-property, PR #868):

    Verification (laptop):

    Not merged, per task discipline. Scope respected: no changes to config/variable.ts, no shared-guard work (#865), no remote_config fetch/protocol changes.

  6. dezren39 commented on Oct 29, 2026

    @dezren39
    Author

    🤖 Agent note · done — merged via PR #868

  7. removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
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