Skip to content

37598 跟进:MCP 入口的故障日志改用内核日志器,主机的脱敏设置才生效 #37666

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Filing gate: ② follow-up out of #37598. The source is seat 5's REWORK 7200856706 on PR #37652, which marks this out of scope and offers a p3 card under #37598. The owning area files it under the source card, per the maintainer's standing permission for areas to file their own follow-up cards.
Grading: area:ai · Task · p3 · reach: every 5xx fault line the MCP doors write (/mcp and stdio) · evidence: read.

维护者速读

  • 做什么:MCP 入口记录 5xx 故障时用的是内置的控制台兜底,而不是主机配置的日志器,所以主机自己的脱敏词和日志输出设置不生效。让 MCP 入口拿到内核的日志器。
  • 谁受益:运维;配置了自己脱敏规则的主机。
  • 不做会怎样:MCP 的故障日志只按默认脱敏词处理,且不进主机的日志管道。
  • 需要你做的:无。

What

After PR #37652, logServerFault falls back to the console sink, with only the default redact words, when no logger is handed to it. The MCP doors (packages/runtime/src/domains/mcp.ts, the stdio bridge in packages/mcp) call it without the kernel's ObjectLogger. Hand them the kernel logger so their fault lines go through the host's sink and its configured redact list.

Acceptance

  • A test per door: a 5xx fault line goes to the kernel logger, and a host redact word is applied to a cause.
  • No response body change.
  • Clause-②: no, Metadata-protocol: none.

Blocked-by: #37598 (PR #37652)
Parent: #37598
Size: XS
Dedupe (objectstack, is:issue): mcp door kernel logger fault 0 · logServerFault logger mcp 0.

Activity

  1. added
    pm:blocked
    area:ai
    domain:server
    on Nov 26, 2026
  2. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:ai · domain:server · Task · priority:p2 · pm:blocked · size S; rationale: the MCP doors' fault lines should go through the kernel logger, so that the host's logging policy applies to them. A log-handling consistency gap, raised to p2 (filed p3). Blocked by #37598.

  3. added
    priority:p2
    and removed on Nov 26, 2026
  4. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Unblocked: PR #37652 merged at 6b7b3051c1; the cause-chain printing this card builds on is on main. pm:blocked → pm:queue.

  5. added
    pm:queue
    and removed
    pm:blocked
    on Nov 26, 2026
  6. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim: PM loop round 12 · area ai-36996 (topic #36996 non-cloud rows; the maintainer, verbatim, 2026-11-25T12:57Z project thread: 「开一个 36996 专题,接手剩余任务」; area concurrency 3 under the maintainer's total of 10, 2026-11-26T13:44Z: 「后续并发降到10」) · 2026-11-26T19:55Z
    Session: session_01Utp6CbeF2saT6wUBV4E9uc
    Account: os-bill
    Area: ai-36996
    Branch: claude/issue-37666-mcp-kernel-logger
    Worktree: objectstack-issue-37666
    Domain: domain:server
    Seat: repo:objectstack#5
    File surface: the MCP doors' logServerFault call sites and the wiring that hands them the kernel ObjectLogger: packages/mcp/src/mcp-http-tools.ts, packages/mcp/src/mcp-server-runtime.ts, the stdio bridge in packages/mcp/src/, packages/runtime/src/domains/mcp.ts, and their tests; root .changeset/. ⛔ No packages/spec/**, packages/types/**, packages/core/**, skills/**, docs/adr/**, ui/**; no response body changes. Stop on breach and report.
    Container & model: XS, mode:subagent, model: default — dispatch-gates --tier: "no path-derived mandate", effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: packages/mcp (the doors call logServerFault with no logger, so it falls back to the console sink) produces fault lines outside the host's sink and redact list | no platform path covers it | every operator reading a 5xx fault line from /mcp or stdio on a host with its own logger or redact words
    Premise: holds — on origin/main dedc16c103: PR #37652 merged; mcp-http-tools.ts:1776 and mcp-server-runtime.ts:2473 call logServerFault({...}) with no second argument (logger?: Logger, server-fault-log.ts:514).
    Serial constraints cleared: #37598 (PR #37652) merged. In flight: #37562 (PR #37646, ui/**), #37611 (skills/**): disjoint.
    Pre-claim deps: #37598 closed
    Prior rulings read: seat REWORK 7200856706 on PR #37652 (this card's source)

  7. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 26, 2026
  8. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
    os-dev-report

    {
      "issue": 37666,
      "status": "done",
      "branch": "claude/issue-37666-mcp-kernel-logger",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37694",
      "head": "952a61b9b5",
      "session": "session_01Utp6CbeF2saT6wUBV4E9uc",
      "premise_still_valid": true,
      "summary": "MCPServerRuntime now passes its configured logger to every logServerFault call in the MCP doors. The calls are dataDoorErrorResult and recordReadErrorResult (6 record data tools plus delete_records), metaDoorErrorResult (list_objects, describe_object, validate_expression, list_actions), and the stdio record resource resources/read. The logger travels through new optional RegisterObjectToolsOptions.logger and RegisterActionToolsOptions.logger, which withFaultLogger fills from this.config.logger in bridgeDataTools (stdio) and handleHttpRequest (/mcp). MCPServerPlugin already builds the runtime with ctx.logger, the kernel ObjectLogger handed in by kernel-base, so both doors reach it with no new dependency edge and no change to packages/runtime/src/domains/mcp.ts. A caller with no logger keeps the console fallback, and answers are byte-identical. The existing runtime test that drives the real MCPServerPlugin stdio session counted the stdio door fault lines on the console. It now reads them off the plugin-context logger, which also shows end to end that the plugin hands the kernel logger to the door.",
      "tests": "New packages/mcp/src/mcp-fault-log-host-logger.test.ts, run as pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/mcp-fault-log-host-logger.test.ts: Tests 12 passed (12). It covers the /mcp door (handleHttpRequest) and the stdio door (bridgeDataTools plus bridgeResources over InMemoryTransport). Four tools (get_record, create_record, list_objects, list_actions) run per tool door, plus the record resource. Each test checks four things: the line reaches a real ObjectLogger created with redact [dsn] and format json, console.error is not called, the cause is rendered {\"dsn\":\"***REDACTED***\",\"pool\":\"primary\"}, and the answer equals the INTERNAL_ERROR/500 envelope byte-identically to a runtime with no logger. CONTROL rows cover the console fallback, where the DSN is kept. packages/runtime/src/mcp-record-context-tools-bridge.test.ts first went red as predicted (expected length 4 but got 2), then passed after the update: Tests 28 passed (28). Package suites at 952a61b9b5 ran under the lock, VERDICT command-exit 0. @objectstack/mcp test: Test Files 87 passed (87), Tests 1587 passed (1587). @objectstack/mcp typecheck: OK, with test-typecheck-debt unchanged at 6 files / 53 errors. @objectstack/runtime typecheck: OK, at 27 files / 183 errors held. @objectstack/runtime test: Test Files 651 passed (651), Tests 12110 passed and 25 skipped (12135). Ablation, one run through scripts/ablation-replace.mjs: in handleHttpRequest, withFaultLogger(opts.toolOptions, this.config.logger) was replaced with opts.toolOptions. The anchor went x1 to x0 and the blob 490ae0f61d5b to 650f9e3ad8c4. The 4 /mcp rows went red (expected \"error\" to not be called at all, but actually been called 1 times), giving Tests 4 failed / 8 passed (12). The restore was verified: blob == HEAD 490ae0f61d5b and git diff HEAD empty. The subject resolves from src through a relative import, so no dist build was involved.",
      "gates": "Local: all 68 families from dispatch-gates --commands --repo objectstack-ai/objectstack at 952a61b9b5 exit 0. Two families needed a second run. check:dual-build-cjs-loads first exited 3 (PREREQUISITE NOT MET, no dist) and then exited 0 after a full build: 126 entry points across 74 packages load. check:type-check-debt first exited 3 (lock queue-timeout, NOT MEASURED) and then exited 0 under the lock: re-measure OK, 0 raw tsc errors. dispatch-gates --ran: 68 derived, 68 run, 0 NOT-MEASURED, 0 UNRUN, exit 0. overlap-check --branch=HEAD before each push: VERDICT clean exit 0. check:commit-card-trailers on push: pass. CI on PR head 952a61b9b5: 53 check-runs, 37 success and 16 skipped, 0 failed. The successful runs include Build Core, Check Changeset, Lint & Repo Gates, all Lint lanes, Test Core 1-10/10, Test UI, Live E2E UI, Dogfood Regression Gate, all Type Check lanes, TypeScript Type Check, Governed Surface Queue Guard, and PR-body guards.",
      "dogfood_battery": "n/a — no ! in the PR title and Clause-②: no (no narrowing arm)",
      "line_budget": "+324 / -28 across 5 files (352 changed lines; human-merge threshold 3000: under). No skills/** touched.",
      "files_changed": [
        ".changeset/37666-mcp-fault-lines-host-logger.md (+12, @objectstack/mcp patch)",
        "packages/mcp/src/mcp-http-tools.ts (+34 -16)",
        "packages/mcp/src/mcp-server-runtime.ts (+17 -3)",
        "packages/mcp/src/mcp-fault-log-host-logger.test.ts (+232, new)",
        "packages/runtime/src/mcp-record-context-tools-bridge.test.ts (+29 -9)"
      ],
      "acceptance": [
        "Every logServerFault call in packages/mcp/src gets the kernel logger: PASS. git grep finds 3 calls (mcp-http-tools.ts dataDoorErrorResult and metaDoorErrorResult, mcp-server-runtime.ts resources/read), and all 3 now pass the logger. The helpers take it as a required positional argument, so tsc rejects any call site that omits it. All 12 tool call sites pass faultLogger.",
        "Optional option, so a caller without a logger keeps the console fallback: PASS. RegisterObjectToolsOptions.logger and RegisterActionToolsOptions.logger are optional, and the CONTROL rows pin the console fallback.",
        "A test per door, with the 5xx line on the injected logger and not the console, and the host redact word applied to the cause: PASS for /mcp (4 tools) and stdio (4 tools plus the record resource).",
        "Answer body unchanged, with no cause text and the same envelope: PASS. Each row asserts the INTERNAL_ERROR/500 envelope, absent cause words, and byte equality with a runtime that has no logger.",
        "One ablation on handing the logger at a door: PASS. The /mcp handoff was removed, 4 rows went red, and the restore was proven.",
        "No reachable kernel logger without a new edge or public API change: not triggered. The runtime already holds ctx.logger. The only API change is the additive optional logger member on two exported options interfaces, which the order asked for.",
        "Clause-②: no and Metadata-protocol: none were copied into the PR body and the changeset."
      ],
      "readings": "Base dedc16c103 (origin/main at fetch; is-ancestor of the requested base exit 0). PR #37694 is draft, assigned os-bill, with no labels. The relay read-back of the body was identical (6073 bytes sent and stored). Container & model as ordered: XS, mode:subagent, model default, effort medium.",
      "deviations": [
        "AGENTS.md was read in its relevant sections (communication, build and test, prime directives, the body-bytes rule) after the first edit rather than before. No rule it states was broken.",
        "The first background gate loop let a gate consume the loop stdin, so it stopped after 36 families. The remaining families were rerun with stdin closed, and all 68 are accounted for.",
        "The dispatch order requires waiting for CI. That is the per-card exception os-dev.md allows, and it was done by foreground polling of the check-runs.",
        "The harness attribution reminder names a model. Per the dispatch order, commits carry the model-free pair Co-Authored-By: Claude plus Claude-Session, and the PR body uses the os-dev session-URL footer plus the signed line."
      ],
      "mcp_calls": "0",
      "api_writes": "2 relay writes: pr_create, which made 2 requests (POST /repos/objectstack-ai/objectstack/pulls draft, then POST /repos/objectstack-ai/objectstack/issues/37694/assignees), and the os-dev-report comment through post-stamped (POST /repos/objectstack-ai/objectstack/issues/37666/comments). git push to the branch 4 times (not REST).",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed. ObjectLogger redaction is keyed on field names, so a host redact word cannot reach the message text of an Error cause on either sink (logger or console fallback). This is by design of the shared redactor and not part of this card. Dedupe words: logger redact error message text, cause message redaction."
      ]
    }

    Generated by Claude Code

  9. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim amendment · 2026-11-26T21:18Z · claim 7202126962 · Clause-② corrected at area L1 on PR #37694.

  10. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
    os-dev-report

    {
      "issue": 37666,
      "status": "done",
      "branch": "claude/issue-37666-mcp-kernel-logger",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37694",
      "head": "efd4c102bc",
      "base_of_rework": "045f5fd4ff (built on, not reset or rewritten; fast-forward push 045f5fd4ff..efd4c102bc)",
      "session": "session_01Utp6CbeF2saT6wUBV4E9uc",
      "rework_of": "REWORK 7204156259 over contract record 7204109922",
      "premise_still_valid": true,
      "summary": "One fix commit, efd4c102bc, on top of 045f5fd4ff. S1: errorResultFromThrown in mcp-http-tools.ts now takes the tools' faultLogger, used for run_action (registerActionTools) and resume_run. It writes the actions door's operator lines with logger.error when a logger is handed and falls back to console.error when none is. Its logger parameter is required-positional, so tsc checks both call sites. N1: withFaultLogger now sits above the [#31836] doc comment, which is attached to logNativeToolServed again. N2: the changeset's redaction sentence now says the host's logger handles the line with its configured redact list, which replaces the default four words rather than adding to them, and that object members of a cause are redacted by field name. The RegisterObjectToolsOptions.logger jsdoc was aligned to the same wording. The Clause-②: yes (widening) line is kept. The stale roll-up lines in landedWriteResultOrError and deleteEach stay on the console.",
      "checks": {
        "S1": "PASS. errorResultFromThrown(err, request, objectName, logger) writes each operatorLines entry through logger.error, or console.error when no logger is handed. Both callers pass faultLogger: run_action through landedWriteResultOrError's fallback, and resume_run directly. mcp-fault-log-host-logger.test.ts adds one run_action row per door (/mcp handleHttpRequest and stdio bridgeDataTools). An in-process TypeError crash is used, which the /actions door answers as a fault. Each row asserts that the host ObjectLogger got exactly [{ level: error, msg: [MCP] run_action complete: unexpected fault (TypeError): ... }], that console.error was not called, that the answer equals the INTERNAL_ERROR/500 envelope with no crash text, and that the answer is byte-identical to a runtime with no logger. In the no-logger leg the line is on the console. Ablation, through scripts/ablation-replace.mjs on the committed head: the logger branch was disabled (if (logger) to if (logger && false)), with anchor x1 to x0 and blob a42f9ee0f464 to 1480752c016e. Both run_action rows went red (Tests 2 failed / 12 passed (14)). The restore was proven: blob == HEAD a42f9ee0f464 and git diff HEAD empty. landedWriteResultOrError and deleteEach are unchanged.",
        "N1": "PASS. mcp-server-runtime.ts now reads, in order: the withFaultLogger jsdoc, withFaultLogger, the [#31836] jsdoc, then logNativeToolServed. There are no stacked doc comments.",
        "N2": "PASS. The changeset now says: 'So the host's logger handles the line, with its configured redact list, which replaces the default words (password, token, secret, key) rather than adding to them. Object members of a cause are redacted by field name.' Matching code: config.redact ?? the default four in core/logger.ts, and key-based redaction in causeLine/redactSensitive."
      },
      "tests": "pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/mcp-fault-log-host-logger.test.ts: Tests 14 passed (14), up from 12 with the 2 run_action rows. Full @objectstack/mcp suite at efd4c102bc, under the lock: Test Files 87 passed (87), Tests 1589 passed (1589), VERDICT command-exit 0. pnpm --filter @objectstack/mcp typecheck: exit 0, check:test-typecheck OK (6 files / 53 errors held, unchanged). The fresh worktree first needed pnpm --filter '@objectstack/mcp^...' build (VERDICT command-exit 0). The @objectstack/runtime suite was not re-run, because this commit does not touch packages/runtime. It last ran green at 952a61b9b5 (651/651 files) and runs in CI Test Core.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at efd4c102bc derives the same 68 families as before. Each was run with stdin closed and its exit code recorded. Result: 67 exit 0, and 1 exit 3 (check:dual-build-cjs-loads, PREREQUISITE NOT MET: the fresh worktree has no full dist, so it is NOT MEASURED locally; it was measured green at 952a61b9b5, and CI builds it). dispatch-gates --ran: 68 derived, 67 run, 1 NOT-MEASURED (DERIVED from the recorded exit 3), 0 UNRUN, exit 0. overlap-check --branch=HEAD: VERDICT clean exit 0 (origin/main and #37694 merge cleanly). check:commit-card-trailers on push: pass. CI on efd4c102bc: 53 check-runs, all completed, 37 success, 16 skipped, 0 failed. That includes Build Core, Check Changeset, Lint & Repo Gates, every Lint lane, Test Core 1-10/10, Test UI, Live E2E UI, Dogfood Regression Gate, every Type Check lane, TypeScript Type Check, Governed Surface Queue Guard and PR-body guards. The names match the previous head's set; the previous head carried a second run of 3 body-triggered checks.",
      "dogfood_battery": "n/a: no ! in the PR title, and Clause-②: yes (widening) has no narrowing arm",
      "line_budget": "this commit +62 / -22 across 4 files; PR total +368 / -32 across 5 files (under the 3000 human-merge threshold). skills/** not touched.",
      "files_changed": [
        ".changeset/37666-mcp-fault-lines-host-logger.md (+1 -1, N2; the Clause-② line is kept)",
        "packages/mcp/src/mcp-http-tools.ts (+15 -11, S1 plus jsdoc wording)",
        "packages/mcp/src/mcp-server-runtime.ts (+5 -5, N1)",
        "packages/mcp/src/mcp-fault-log-host-logger.test.ts (+41 -5, S1 rows)"
      ],
      "pr_body_replacement": "Not patched, per the order. Suggested replacement for the first bullet of '## What changes': 'MCPServerRuntime hands its configured logger to every such line: the data tools (dataDoorErrorResult / recordReadErrorResult), the metadata tools and list_actions (metaDoorErrorResult), the stdio record resource (resources/read), and run_action / resume_run, whose actions-door operator lines (errorResultFromThrown) now go to the same logger. MCPServerPlugin already builds the runtime with ctx.logger, the kernel's logger, so both doors now reach it without a new dependency edge, and packages/runtime/src/domains/mcp.ts is unchanged: it calls the plugin's runtime (mcp.handleHttpRequest). The stale roll-up lines for a write that landed (landedWriteResultOrError / deleteEach) stay on the console.' Suggested addition to '## Tests': 'One run_action row per door: the operator line lands on the injected logger, console.error is not called, and the answer is byte-identical to a runtime with no logger. Ablation on efd4c102bc: disabling the logger branch in errorResultFromThrown turned both rows red (2 failed / 12 passed), restore proven by blob.' The Verification line's expected count becomes 'Tests 14 passed (14)'.",
      "deviations": [
        "The branch is checked out in another worktree (scratchpad wt-37694, clean, not mine), so git worktree add on the branch name was refused. ../objectstack-issue-37666 was created detached at 045f5fd4ff instead, and the fix was pushed with git push origin HEAD:claude/issue-37666-mcp-kernel-logger, a fast-forward 045f5fd4ff..efd4c102bc. The other worktree was not touched.",
        "The @objectstack/runtime full suite was not re-run, because this commit does not touch packages/runtime. CI Test Core covers it and is green."
      ],
      "mcp_calls": "0",
      "api_writes": "1 REST write via the relay: the rework report comment on #37666 through post-stamped (POST /repos/objectstack-ai/objectstack/issues/37666/comments). 1 git push (not REST). The PR body was not patched.",
      "open_questions": [],
      "security_findings": "withheld",
      "out_of_scope_findings": []
    }

    Generated by Claude Code

  11. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    ACCEPT → PR #37694 comment 7204820474 (delta record 7204814813 over 7204109922, PASS)

  12. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Merged: PR #37694 at aca4960f66 closed this card by Fixes. Delivered: the /mcp and stdio doors write every 5xx fault line through MCPServerRuntime's configured logger (the kernel ObjectLogger via MCPServerPlugin): the data tools, the metadata tools and list_actions, the stdio record resource, and the run_action / resume_run operator lines. Optional logger on RegisterObjectToolsOptions / RegisterActionToolsOptions; with no logger the line keeps the console fallback; answers unchanged byte for byte. pm:dispatched removed.

  13. removed
    pm:dispatched
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions