Skip to content

fix(plugins): wsl2 ollama error#55187

Closed
kinfey wants to merge 2 commits intoopenclaw:mainfrom
kinfey:main
Closed

fix(plugins): wsl2 ollama error#55187
kinfey wants to merge 2 commits intoopenclaw:mainfrom
kinfey:main

Conversation

@kinfey
Copy link
Copy Markdown
Contributor

@kinfey kinfey commented Mar 26, 2026

Summary

This pull request makes several important changes to the BlueBubbles extension, focusing on simplifying participant normalization logic, updating SSRF (Server-Side Request Forgery) policy handling, and cleaning up unused code. It also updates configuration defaults and test behaviors. The changes collectively improve maintainability, reduce complexity, and clarify group participant enrichment behavior.

Changes

  1. undici-global-dispatcher.ts — WSL2 autoSelectFamily fix
    Imported isWSL2Sync from the existing WSL detection module
    Modified resolveAutoSelectFamily() to return false when running on WSL2, even when the Node 22 system default is true
    This forces IPv4-only connections for all fetch() calls on WSL2, matching the Telegram extension's behavior

  2. ollama-stream.ts — Improved error diagnostics
    The catch block now unwraps err.cause (where undici puts the real network error) and appends it to the error message
    Logs the cause via the subsystem logger for diagnostic visibility
    Previously, only "fetch failed" was reported, making debugging impossible

  3. models-config.providers.discovery.ts — Better discovery error logging
    Appends err.cause.message to the discovery failure log, so the actual underlying network error is visible

  4. undici-global-dispatcher.test.ts — Test coverage
    Added mock for isWSL2Sync
    Added test: "disables autoSelectFamily on WSL2 to avoid IPv6 connectivity issues" All 11 tests pass

fixed #54498

@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation channel: bluebubbles Channel integration: bluebubbles channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram gateway Gateway runtime agents Agent runtime and tooling size: XL labels Mar 26, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 26, 2026

Greptile Summary

This PR bundles the targeted WSL2 Ollama fix (disabling autoSelectFamily on WSL2 in undici-global-dispatcher.ts) and improved error-cause logging in ollama-stream.ts / models-config.providers.discovery.ts with a much larger set of unrelated changes. The WSL2 fix itself is clean, well-commented, and well-tested.

However, the PR removes several sender-authorization gates across three different extensions without explaining the rationale, which introduces meaningful regressions:

  • Telegram: The !isGroup guard that forced DM callbacks into "callback-allowlist" mode is gone, allowing unpaired DM senders to interact with inline buttons under dmPolicy: "pairing".
  • Matrix: isVerificationNoticeAuthorized was deleted from verification-events.ts, bypassing DM policy / allow-store checks for all Matrix verification flows.
  • MSTeams: isFeedbackInvokeAuthorized was removed from monitor-handler.ts, so feedback invokes are no longer filtered by DM or group allowlist policy.
  • Session migration: migrateAndPruneGatewaySessionStoreKey no longer promotes the freshest case-variant entry, potentially restoring a stale session on startup.

Additionally, .vscode/settings.json now contains developer-local paths and a pinned extension version, and .work-folder-info is an editor-generated file that should be gitignored rather than committed.

Confidence Score: 2/5

Not safe to merge: the PR bundles a clean WSL2 fix with several unexamined access-control removals across Telegram, Matrix, and MSTeams that create sender-authorization regressions.

The WSL2/undici fix and improved error-cause logging are correct and well-tested. However, three separate authorization guards (Telegram DM callbacks, Matrix verification notices, MSTeams feedback invokes) were silently removed with no justification, and deleted tests confirm the regressions are real. A freshest-session promotion regression in session-utils and two stray editor files compound the concern. The PR title does not reflect the breadth of changes.

extensions/telegram/src/bot-handlers.runtime.ts, extensions/matrix/src/matrix/monitor/verification-events.ts, extensions/msteams/src/monitor-handler.ts, src/gateway/session-utils.ts

Important Files Changed

Filename Overview
src/infra/net/undici-global-dispatcher.ts Clean WSL2 fix: imports isWSL2Sync and returns false from resolveAutoSelectFamily() when the system default is true on WSL2, forcing IPv4-only connections.
src/agents/ollama-stream.ts Improved error diagnostics: unwraps err.cause for undici fetch failures, appending the real network error to the error message and logging it.
src/agents/models-config.providers.discovery.ts Appends err.cause.message to the Ollama discovery failure log so the underlying network error is surfaced alongside the outer error string.
extensions/telegram/src/bot-handlers.runtime.ts Removes !isGroup from the authorizationMode condition, creating a regression where unpaired DM users can interact with inline buttons regardless of dmPolicy.
extensions/matrix/src/matrix/monitor/verification-events.ts Removes isVerificationNoticeAuthorized and all call sites, eliminating DM policy/allowlist/pairing gating on Matrix verification notices.
extensions/msteams/src/monitor-handler.ts Removes isFeedbackInvokeAuthorized guard from handleFeedbackInvoke, allowing feedback invokes to be processed regardless of DM or group allowlist policy.
src/gateway/session-utils.ts Simplifies migrateAndPruneGatewaySessionStoreKey but removes freshest-wins logic, potentially promoting stale session entries when case-variant duplicates exist.

Comments Outside Diff (2)

  1. src/gateway/session-utils.ts, line 1823-1829 (link)

    P1 Freshest-session promotion logic removed

    migrateAndPruneGatewaySessionStoreKey previously selected the entry with the highest updatedAt across all case-variant duplicates and promoted it to the canonical key — ensuring the most recent session survived migration. The new code only copies any matching entry when the canonical key is absent.

    If a user has both a stale and a fresh case-variant entry, the new code may promote the stale one depending on storeKeys ordering, causing the user to lose their most recent session state on startup. The two deleted tests validated that the freshest entry always wins.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/gateway/session-utils.ts
    Line: 1823-1829
    
    Comment:
    **Freshest-session promotion logic removed**
    
    `migrateAndPruneGatewaySessionStoreKey` previously selected the entry with the highest `updatedAt` across all case-variant duplicates and promoted it to the canonical key — ensuring the most recent session survived migration. The new code only copies any matching entry when the canonical key is absent.
    
    If a user has both a stale and a fresh case-variant entry, the new code may promote the stale one depending on `storeKeys` ordering, causing the user to lose their most recent session state on startup. The two deleted tests validated that the freshest entry always wins.
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. .vscode/settings.json, line 10-19 (link)

    P2 User-specific VS Code settings committed to shared repo

    The added chat.agentSkillsLocations block contains user-machine-specific paths (~/.copilot/skills, ~/.agents/skills, ~/.claude/skills) and a hard-coded extension version (~/.vscode-server/extensions/synapsevscode.synapse-1.21.0/copilot/skills). Committing these to .vscode/settings.json will push personal tool configurations to every contributor who pulls this branch.

    Entries that are developer-specific should live in .vscode/settings.json.local (gitignored) or in VS Code's user settings, not in the project-level settings file.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: .vscode/settings.json
    Line: 10-19
    
    Comment:
    **User-specific VS Code settings committed to shared repo**
    
    The added `chat.agentSkillsLocations` block contains user-machine-specific paths (`~/.copilot/skills`, `~/.agents/skills`, `~/.claude/skills`) and a hard-coded extension version (`~/.vscode-server/extensions/synapsevscode.synapse-1.21.0/copilot/skills`). Committing these to `.vscode/settings.json` will push personal tool configurations to every contributor who pulls this branch.
    
    Entries that are developer-specific should live in `.vscode/settings.json.local` (gitignored) or in VS Code's user settings, not in the project-level settings file.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/telegram/src/bot-handlers.runtime.ts
Line: 1245-1248

Comment:
**DM callback authorization no longer enforced**

The `!isGroup` branch was removed from the `authorizationMode` condition. Before this change, DM callbacks _always_ selected `"callback-allowlist"` mode, which enforces the sender authorization gate (the now-removed comment explicitly said: _"DM callbacks must enforce the same sender authorization gate as normal DM commands"_).

With the new condition:
```typescript
const authorizationMode: TelegramEventAuthorizationMode =
  !execApprovalButtonsEnabled && inlineButtonsScope === "allowlist"
    ? "callback-allowlist"
    : "callback-scope";
```

DM callbacks will use `"callback-scope"` whenever `inlineButtonsScope` is not `"allowlist"` (e.g., `"dm"`), regardless of whether the sender is paired. This means an unpaired DM user can interact with inline buttons (e.g., trigger model selection) even when `dmPolicy: "pairing"` is configured — because `"callback-scope"` does not enforce the pairing/allowlist gate.

The deleted test `"blocks DM model-selection callbacks for unpaired users when inline buttons are DM-scoped"` covered exactly this scenario and confirmed the regression.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/matrix/src/matrix/monitor/verification-events.ts
Line: 309

Comment:
**Matrix verification sender authorization removed**

The `isVerificationNoticeAuthorized` function was deleted along with both of its call sites. These were the only guards that checked whether a sender was allowed to trigger verification flows based on `dmPolicy`, `dmEnabled`, and the pairing allow-store.

After this change, any Matrix user — including senders blocked under `dmPolicy: "pairing"`, `dmPolicy: "allowlist"`, or `dmEnabled: false` — can initiate a verification flow and receive SAS emoji/decimal notices forwarded by the bot. The deleted integration tests confirmed this authorization gate was behavioral, not aspirational.

If the intent is to simplify the verification path, the PR should explain why sender authorization is safe to skip here (e.g., because the Matrix protocol's own verification handshake already guards the flow). Without that justification, this is a regression.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/msteams/src/monitor-handler.ts
Line: 178

Comment:
**MSTeams feedback invoke authorization removed**

The `isFeedbackInvokeAuthorized` check that guarded `handleFeedbackInvoke` was deleted. That function validated three conditions before processing a feedback invoke: (1) the DM sender passes the allowlist/pairing gate, (2) the team/channel route allowlist allows the conversation, and (3) the group sender is on the group allowlist.

With the check removed, any Teams user — regardless of DM policy, team/channel allowlist, or group allowlist — can submit feedback invokes and have them processed. If this is intentional, please add a comment explaining the rationale so reviewers can verify the security model.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/gateway/session-utils.ts
Line: 1823-1829

Comment:
**Freshest-session promotion logic removed**

`migrateAndPruneGatewaySessionStoreKey` previously selected the entry with the highest `updatedAt` across all case-variant duplicates and promoted it to the canonical key — ensuring the most recent session survived migration. The new code only copies any matching entry when the canonical key is absent.

If a user has both a stale and a fresh case-variant entry, the new code may promote the stale one depending on `storeKeys` ordering, causing the user to lose their most recent session state on startup. The two deleted tests validated that the freshest entry always wins.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: .vscode/settings.json
Line: 10-19

Comment:
**User-specific VS Code settings committed to shared repo**

The added `chat.agentSkillsLocations` block contains user-machine-specific paths (`~/.copilot/skills`, `~/.agents/skills`, `~/.claude/skills`) and a hard-coded extension version (`~/.vscode-server/extensions/synapsevscode.synapse-1.21.0/copilot/skills`). Committing these to `.vscode/settings.json` will push personal tool configurations to every contributor who pulls this branch.

Entries that are developer-specific should live in `.vscode/settings.json.local` (gitignored) or in VS Code's user settings, not in the project-level settings file.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: .work-folder-info
Line: 1

Comment:
**Editor-generated file accidentally committed**

`.work-folder-info` is a VS Code/Synapse workspace metadata file (`{"version":1}`). It has no meaning to other contributors and should be added to `.gitignore` rather than committed to the repository.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Merge branch 'openclaw:main' into main" | Re-trigger Greptile

@kinfey kinfey changed the title Fix WSL 2 Ollama error fix(plugins): wsl2 ollama error Mar 26, 2026
@BradGroux
Copy link
Copy Markdown
Contributor

Thanks for the work here. I re-validated this PR against the stated scope (WSL2 + Ollama diagnostics) and I recommend Request Changes before merge.

Scope assessment

The PR title/body describe a focused fix around WSL2 networking behavior and Ollama/discovery error diagnostics.

Actual diff size is much broader:

  • 34 changed files
  • +173 / -1030

Files that are in scope

These are aligned with the stated objective:

  • src/infra/net/undici-global-dispatcher.ts
  • src/infra/net/undici-global-dispatcher.test.ts
  • src/agents/ollama-stream.ts
  • src/agents/models-config.providers.discovery.ts

Files that are out of scope for this fix

Large portions of the diff touch unrelated plugin and framework areas:

  • extensions/bluebubbles/* (10 files)
  • extensions/matrix/* (4 files)
  • extensions/msteams/* (3 files)
  • extensions/telegram/* (2 files)
  • src/gateway/session-utils.*
  • src/agents/tools/session-status-tool.ts and related test cleanup
  • docs/plugins/building-plugins.md
  • CHANGELOG.md
  • workspace/editor metadata (.vscode/settings.json, .work-folder-info)

Even if those edits are valid, combining them with a targeted networking/diagnostics fix makes review quality and rollback safety worse.

Recommendation

Please split this into focused PRs:

  1. WSL2 + Ollama diagnostics PR
  • Keep only the networking and diagnostics changes listed in the in-scope section
  • Include the WSL2 test additions
  1. BlueBubbles cleanup PR
  • Participant normalization and monitor/test cleanup
  1. Matrix/MSTeams/Telegram and other refactors PR(s)
  • Keep each area cohesive and independently reviewable
  1. Docs/changelog/editor metadata PR
  • Keep documentation and local workspace changes separate from runtime logic

Why this matters

  • Smaller PRs reduce regression risk
  • Reviewers can reason about behavior changes faster
  • Reverts are safer when changes are isolated by concern

Once split, the WSL2/Ollama fix can move quickly.

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

Labels

agents Agent runtime and tooling channel: bluebubbles Channel integration: bluebubbles channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram docs Improvements or additions to documentation gateway Gateway runtime size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants