Skip to content

fix: improve reliability and room disambiguation#13

Merged
CybotTM merged 3 commits intomainfrom
fix/session-learnings
Mar 3, 2026
Merged

fix: improve reliability and room disambiguation#13
CybotTM merged 3 commits intomainfrom
fix/session-learnings

Conversation

@CybotTM
Copy link
Member

@CybotTM CybotTM commented Mar 3, 2026

Summary

Fixes 5 issues discovered during a real usage session in WSL2:

  • Dynamic skill path: Replace hardcoded 1.11.0 version in work-update.md command template with glob-based resolution that finds the latest installed version
  • Room disambiguation: When an exact room name match has no alias but other rooms also contain the search term in their name, return all candidates for disambiguation instead of silently picking the wrong room (e.g., "dxp" matching "DXP" instead of "DXP (Operations)")
  • IPv4 fallback: Add IPv4 preference for WSL2 environments where IPv6 routes fail with ENETUNREACH (errno 101/113). Stdlib http.py retries with IPv4-preferred DNS resolution; all E2EE scripts reorder getaddrinfo results to prefer IPv4
  • Suppress crypto noise: Set matrix-nio/peewee loggers to ERROR level by default, suppressing noisy megolm session warnings during sync. Full output still available with --debug
  • Source repo info: Add "Source & Contributing" section to SKILL.md pointing to this repository and the marketplace

Test plan

  • Verify work-update.md glob resolves to correct skill directory on a fresh install
  • Test room lookup with ambiguous names (room without alias + room with alias containing same term)
  • Test E2EE send in WSL2 environment with broken IPv6
  • Verify --debug still shows full nio crypto output
  • Verify normal (non-debug) send has clean stderr output

- Fix hardcoded version path in work-update.md command template;
  use glob-based dynamic resolution instead of pinned version
- Improve room disambiguation: when an exact name match has no alias
  but other rooms also contain the search term, return all candidates
  for user disambiguation instead of silently picking the wrong room
- Add IPv4 preference fallback for WSL2 environments where IPv6 routes
  are unreachable (errno 101/113); stdlib http.py retries with
  IPv4-preferred DNS, E2EE scripts reorder getaddrinfo results
- Suppress noisy matrix-nio megolm/crypto warnings unless --debug;
  set nio/peewee loggers to ERROR level by default
- Add source repository info to SKILL.md so agents and users know
  where to find and contribute to the skill source code
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness and user experience of the Matrix communication skill by addressing several critical issues. It introduces dynamic skill path resolution, refines room disambiguation logic, and implements an IPv4 preference for improved network reliability in WSL2 environments. Additionally, it reduces log verbosity for a cleaner user experience and clarifies source repository information for contributors.

Highlights

  • Dynamic skill path resolution: Replaced a hardcoded skill version in work-update.md with a glob-based approach to find the latest installed version dynamically.
  • Improved room disambiguation: Modified room lookup logic to return all potential candidates for disambiguation when an exact room name match without an alias exists alongside other rooms containing the search term.
  • IPv4 fallback for WSL2: Implemented a preference for IPv4 DNS resolution in WSL2 environments to mitigate ENETUNREACH errors, reordering getaddrinfo results to prioritize IPv4.
  • Suppressed crypto logging noise: Set matrix-nio and peewee loggers to ERROR level by default to suppress noisy megolm session warnings during sync, while retaining full output with the --debug flag.
  • Added source repository information: Included a "Source & Contributing" section in SKILL.md to direct users to the correct repository for issues and contributions.
Changelog
  • commands/work-update.md
    • Updated the command template to dynamically locate the skill directory using a glob pattern instead of a hardcoded version.
  • skills/matrix-communication/SKILL.md
    • Added a new section "Source & Contributing" with links to the source repository and marketplace, and guidance on where to file issues.
  • skills/matrix-communication/scripts/_lib/http.py
    • Introduced a context manager _prefer_ipv4 to temporarily prioritize IPv4 DNS resolution.
    • Refactored HTTP request execution and error parsing into helper functions _do_request and _parse_http_error.
    • Implemented a retry mechanism for OSError (ENETUNREACH, EHOSTUNREACH) to attempt the request with IPv4 preference.
  • skills/matrix-communication/scripts/_lib/rooms.py
    • Revised the find_room_by_name function to prioritize exact alias matches, then exact alias name matches, and finally exact room name matches, with special handling for disambiguation when exact name matches lack aliases but partial matches exist.
    • Updated the docstring to reflect the new room matching priority and disambiguation logic.
  • skills/matrix-communication/scripts/matrix-e2ee-setup.py
    • Added code to prefer IPv4 DNS resolution by reordering getaddrinfo results.
    • Included logic to suppress noisy matrix-nio and peewee crypto/sync warnings by setting their log levels to ERROR.
  • skills/matrix-communication/scripts/matrix-e2ee-verify.py
    • Added code to prefer IPv4 DNS resolution by reordering getaddrinfo results.
    • Included logic to suppress noisy matrix-nio and peewee crypto/sync warnings unless the --debug flag is used.
  • skills/matrix-communication/scripts/matrix-edit-e2ee.py
    • Added code to prefer IPv4 DNS resolution by reordering getaddrinfo results.
    • Included logic to suppress noisy matrix-nio and peewee crypto/sync warnings unless the --debug flag is used.
  • skills/matrix-communication/scripts/matrix-read-e2ee.py
    • Added code to prefer IPv4 DNS resolution by reordering getaddrinfo results.
    • Included logic to suppress noisy matrix-nio and peewee crypto/sync warnings unless the --debug flag is used.
  • skills/matrix-communication/scripts/matrix-send-e2ee.py
    • Added code to prefer IPv4 DNS resolution by reordering getaddrinfo results.
    • Included logic to suppress noisy matrix-nio and peewee crypto/sync warnings unless the --debug flag is used.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several fixes to improve reliability, including dynamic skill path resolution, better room disambiguation, and an IPv4 fallback for networking. My review focuses on improving the implementation of these fixes. I've pointed out an issue with error handling in the IPv4 fallback logic that could mask debug information. I've also suggested refactoring duplicated code for setting up networking and logging across multiple scripts into a shared library to improve maintainability. Finally, I noted that one script unconditionally suppresses logs, which should be made conditional for easier debugging, consistent with other scripts.

CybotTM added 2 commits March 3, 2026 15:56
Fix 28 pre-existing ruff check violations:
- Remove unused imports (json, struct, F401 suppressions)
- Remove unused variables (target_device, decrypted)
- Replace bare except with except Exception
- Auto-fix import sorting and other lint rules

Apply ruff format to all 21 Python scripts for consistent style.
- Fix retry error reporting in http.py: capture OSError as e2 instead
  of returning original error e (review comment on misleading errors)
- Add --debug flag to matrix-e2ee-setup.py so logging suppression is
  conditional, consistent with all other E2EE scripts
- Extract prefer_ipv4() and suppress_nio_logging() into _lib/utils.py
  to eliminate duplication across 5 E2EE scripts
@CybotTM CybotTM merged commit ab01668 into main Mar 3, 2026
5 checks passed
@CybotTM CybotTM deleted the fix/session-learnings branch March 3, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant