Skip to content

fix(gateway): attribute ephemeral connections in normal logs - #174406

Merged
steipete merged 3 commits into
mainfrom
steipete/perf-micro-internal-connect-churn-20260919
Oct 16, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/perf-micro-internal-connect-churn-20260919

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Normal Gateway journals cannot attribute successful ephemeral connections: CLI/backend client metadata was verbose-only, while authenticated-user and webchat connection records overlapped.

User Impact

Operators get one client connected record per admitted operator/node connection, including client ID/name, mode, role, authentication method, version/platform/build, remote address, and an authenticated user when present. Request content and credentials are excluded. Log consumers matching the old authenticated user connected or webchat connected messages should use the new record.

Why This Change Was Made

This consolidates the existing three connection-log paths into one at the same admission boundary. No new registry, timer, cache, configuration, transport, authentication, or pairing path is introduced. Gateway-hosted node services and plugin requests already use in-process dispatch; their transport should not be rewritten without caller evidence. The docs explain persistent external polling and the existing plugin runtime APIs. The bundled node-connect skill now recognizes the unified admission record, including its distinction from hello delivery, and retains guidance for older deployed builds.

Evidence

A read-only 30-minute diagnostic sample measured approximately 1,855 connects (61.85/min; 5.714 seconds of total handler time), 1,898 chat.history requests, and only 22 authenticated-user / 20 webchat connects (overlapping categories). Five-minute bursts closely tracked history requests; successful non-user client metadata was absent, so that correlation does not identify the caller. Four CPU profiles totaling about 20 seconds provided no sampled outgoing Gateway-client handshake and did contain existing in-process dispatch.

Before/after connection rate: unchanged by design; this fixes the missing attribution needed to select a transport change. No production deployment or same-services before/after load test was performed, and no connection-rate or latency improvement is claimed. A later deployed journal sample must identify the caller before reducing or batching its connects.

Production delta: 12 lines deleted net. The duplicate verbose/user/webchat emission paths are removed; backend admission visibility and authenticated-user attribution remain covered.

Validation: the backend regression failed before the change because there was no attributable normal-level connection record. After the change, all 49 tests in src/gateway/server/ws-connection/message-handler.post-connect-health.test.ts passed (75.25 s Vitest wall time, 82.48 s wrapper total; the new case took 530 ms). Changed-file oxfmt and core oxlint passed; git diff --check passed. An invalid unpaired CLI fixture was removed before final proof. The initial unscoped lint wrapper began unrelated plugin declaration preparation and was stopped; the explicit core-config run passed. No Testbox/Crabbox lease was allocated; broad gates are delegated to PR CI.

Independent Codex autoreview: scoped-clean through P2, no accepted/actionable findings. Review and simplification preserved the admission boundary, existing redaction, and authenticated-user attribution. The focused skill correction also passed independent autoreview through P2. The production code and its 49-test proof are unchanged. Documentation scopes the record to operator/node connections: dedicated worker ingress does not use this admission path and its handshake does not contribute to the ordinary connect handler metric.

CI attribution: check-guards in run 38930368454 fails because duplicate-scan target coverage omits cli-parent-lifetime.mjs. The automatic classifier labeled it new based on an older passing main job without comparing selected scope. The exact focused command node scripts/check-duplicates.mjs --coverage exits 1 with the same single uncovered filename on PR head 83a6f67b5310b09a426dd1e08ae291a581e66ece and CI main parent bb642e181e130153894a45f141a5368123bcd487. The checker and omitted file are byte-identical between those revisions. Baseline execution used a task-owned temporary Git index populated with the exact parent via git read-tree; the checker reads only the tracked path inventory in coverage mode. No full duplicate scan or unrelated source repair was run. This is inherited baseline failure, not duplicated code added by this PR.

The first CI attempt also failed checks-fast-baseline-ratchets at src/flows/doctor-plugin-source-captures.test.ts:32: its closed mock for ../process/supervisor/darwin-bun-process-census.js is absent from the mock-export baseline. A focused diagnostic using the production native parser, import resolver, and scanClosedMockFactories on that single test produced the same fingerprint (0f314816d50228e6240f1048998f802dd80d499ba91277a72f2a366e9c574dd2), absent from the ledger, on both the PR and exact CI main parent. The failing test, scanner, and ledger are unchanged by this PR. The newer commit only fixes the bundled skill reference identified by review; it does not rerun CI merely to chase green.

Final validation: CI run 38932919144 completed successfully on exact head 271226ce67ecc7c6482766bdd1ce226c82dd77b6: all 34 executed jobs passed, including changed Node tests, UI E2E, docs, guards, lint, production/test types, security-fast, and the aggregate gate. Dependency and security-sensitive reviews also passed. The earlier inherited guard failures did not recur; no inherited-failure exception or CI rerun is needed. The final documentation scope correction passed independent autoreview through P2.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T16:17:32.135471Z 83a6f67 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 271226ce67ecc7c6482766bdd1ce226c82dd77b6
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server/ws-connection/connect-session.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Oct 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83a6f67b53

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@steipete
steipete merged commit 5b4824b into main Oct 16, 2026
130 of 132 checks passed
@steipete
steipete deleted the steipete/perf-micro-internal-connect-churn-20260919 branch October 16, 2026 16:52
vincentkoc added a commit that referenced this pull request Oct 16, 2026
* commit 'a4c73619a5c': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…157433

* commit '2e8bfec53fc1cf06c9e438f42b027a82e04ace9a': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…/decision-onnx-v2-proof-20261016

* commit '2e8bfec53fc1cf06c9e438f42b027a82e04ace9a': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…ision-accounting-native

* commit '2e8bfec53fc1cf06c9e438f42b027a82e04ace9a': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…158510

* commit '26cbd409b9753a9318a6dc09f97b2f0b4b776a09': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…esafe-decision-native

* commit '26cbd409b9753a9318a6dc09f97b2f0b4b776a09': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…/decision-tool-v2-proof-20261016

* commit '26cbd409b9753a9318a6dc09f97b2f0b4b776a09': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…w#174406)

* fix(gateway): attribute ephemeral connections in normal logs

* docs(node-connect): recognize unified connection admission logs

* docs(gateway): scope connection attribution to operator and node clients
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime security-sensitive-changed size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant