Skip to content

MCP validate_expression: inScope.fields lists the hidden __search companion field #33338

Closed

Description

@objectstack-fleet

triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

Source: v18.4.0 sweep close-out, #32908 comment 6881136418 (devx#4 ledger, read at 87330e89), routed by triage.

What is wrong

Row 184 (record #33081, comment 6850173588): validate_expression answers an inScope.fields list that includes the hidden __search companion field. search.field-scoped-narrowing A2 says that field is invisible. An agent that reads the list can write an expression against a field it is not meant to see or use.

Do

  • Drop search companions, and any other hidden system companion, from inScope.fields in packages/formula (validate) or in the MCP domain that builds the scope (packages/runtime/src/domains/mcp.ts). Keep one list of what counts as hidden. Don't add a second filter.
  • Pin it: a field-scoped search object's inScope.fields has no __search entry.

Grade

p2 (wrong information to the caller, no data written), raised once for MCP focus → p1.

Reader

domain:server, pilot Area A4 (formula).

Activity

  1. added
    bug
    priority:p1
    pm:queue
    domain:server
    on Nov 14, 2026
  2. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: +lease:A4 · 2026-11-14T18:45Z

    ⛔ Not a claim; claim, grade and state unchanged.

    Area A4 under the area-lease pilot (#33059, table on #28677). The label replaces the text Area: line now that lease: labels exist. Decisions go area → domain:server#5.

  3. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC

    Claim: area-lease pilot #33059, area thread A4 (data layer) · p1 · dispatched to an os-dev subagent of this area thread
    Session: session_016WV4cw787kMeaX7oyz7DDC (area thread; subagent of it)
    Account: os-elon-musk
    Branch: claude/area-A4-33338
    Worktree: objectstack-a4-33338
    Domain: domain:server
    Seat: domain:server#5
    File surface: the code that builds validate_expression's inScope.fields (MCP domain and/or packages/formula validate), the shared hidden-field predicate it should reuse, one pin test, one changeset. Stop on breach.
    Container & model: M, mode:subagent, model: default, effort: high
    Clause-②: no (expected; re-read after the diff)
    Metadata-protocol: none
    Responsibility: validate_expression lists only fields a caller may see in inScope.fields; hidden system companions such as __search are not offered
    Thread-read: none
    Premise: re-measured at origin/main before any edit; premise_still_valid: false is a valid result
    Serial constraints cleared: the area's other in-flight cards (#33352 test doors, #32976 cli test) do not touch the MCP domain or formula validate

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 14, 2026
  5. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC
    os-dev-report

    {
     "issue": 33338,
     "status": "done",
     "branch": "claude/area-A4-33338",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/33451",
     "session": "session_016WV4cw787kMeaX7oyz7DDC",
     "premise_still_valid": true,
     "summary": "Premise re-measured at origin/main b4624440e: with the pin committed first (a3baf4688), inScope.fields carried __search and record.__search answered ok:true, while os validate (validateStackExpressions) refused it with unknown-field. The scope builder is packages/mcp/src/mcp-http-tools.ts (validate_expression handler), not packages/runtime/src/domains/mcp.ts: it built the hint fields from bridge.describeObject, whose served object carries the registry-stamped companion. Fix: the handler skips SEARCH_COMPANION_FIELD (objectql's own constant, lazily imported like @objectstack/lint) when it builds the fields it judges and lists, so list and acceptance now agree and match os validate on both transports. The only hidden companion is __search; other hidden system columns (organization_id, owning_business_unit_id, queue) are injected columns os validate accepts and stay listed. New dependency: @objectstack/mcp to @objectstack/objectql (workspace, lockfile updated, mcp vitest alias added).",
     "tests": "pnpm --filter @objectstack/mcp exec vitest run src/mcp-validate-expression.test.ts -t 'search companion' on the unfixed source: Tests 2 failed | 1 passed ('expected [ organization_id, …(10) ] to not include __search'; 'validation: expected true to be false'). Final head 8fd19455f: typecheck (tsc + check:test-typecheck OK) and full mcp vitest: Test Files 64 passed (64), Tests 1177 passed (1177). Ablation at 8fd19455f via scripts/ablation-replace.mjs --delete of the filter line: anchor 1 to 0, blob 53858a178b6c to 5a31c30501fa, Tests 2 failed | 1 passed, restored blob == HEAD with an empty git diff HEAD. The subject is mcp src reached by relative import, so no dist rebuild was involved.",
     "gates": "Local at 8fd19455f: dispatch-gates --commands derived 81 families; all 81 run with exit codes recorded, and --ran reconciled them as 80 exit 0 plus 1 NOT MEASURED (check:dual-build-cjs-loads, exit 3, PREREQUISITE NOT MET because it needs a full-repo pnpm build, so CI's Lint & Repo Gates reads it). check:test-source-alias was exit 1 before the alias commit (an unaliased objectql value import) and is exit 0 at 8fd19455f. Re-run at 8fd19455f after that commit, each exit 0: console-intercept-disarm, test-source-alias, cross-package-test-inputs, tier-file-adoption, undeclared-dep-imports, workspace-manifest-cycles, nul-bytes. eslint --no-inline-config on the 3 changed source files: exit 0. PR check-runs, read once at open: Lint, Type Check, Check Changeset, Governed Surface Queue Guard and Validate Package Dependencies all in_progress; the opt-in and queue jobs skipped.",
     "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "2 — fleet-write relay pr_create (POST pulls with the assignees leg, read back identical, 5531 of 5531 bytes) and this os-dev-report comment through post-stamped.mjs on #33338; git pushes are not REST writes",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "class: a · reach: named producer: describeServedObject (packages/mcp/src/mcp-server-runtime.ts and its twin in packages/runtime/src/domains/mcp.ts) projects every served field, so describe_object lists the hidden __search companion (as readonly/system) on both transports. Measured here: the pre-fix red listed __search from exactly that projection's output. Same family as this card (the hidden companion leaking into MCP introspection), so fold it into this family's close-out rather than a single-point card · dedupe words: describe_object __search, search companion MCP, hidden companion introspection",
      "carrier: none · noted, not filed: the gate-pass definition handed to the lint passes (servedObjectDefinitionOf) still carries __search. It is harmless, since the shared validator refuses the read first, and no answer lists it."
     ]
    }
  6. added a commit that references this issue on Nov 16, 2026
    615c67f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdomain:serverpm:dispatchedpriority:p1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions