Skip to content

Conversation

@yangsong-cnyn
Copy link
Contributor

@yangsong-cnyn yangsong-cnyn commented Sep 24, 2025

  1. Deleted the original # add calling of link_dongle.py script at startup to update symlink to the dongle misleading comment, as [ncs] bump submodules and update configs #18 has fixed the issue.

  2. This implementation creates a dedicated systemd service otbr-agent-restart-workaround.service that runs once after otbr-agent.service has started. This is a more robust and maintainable way to handle service dependencies and startup actions on systemd-based systems.

@yangsong-cnyn yangsong-cnyn self-assigned this Sep 24, 2025
@yangsong-cnyn yangsong-cnyn added the enhancement New feature or request label Sep 24, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @yangsong-cnyn, 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 refactors the otbr-agent restart mechanism from a legacy /etc/rc.local script to a modern systemd service. The change aims to significantly improve the reliability and maintainability of the otbr-agent startup sequence, particularly addressing situations where an nRF dongle might not be immediately available, ensuring the service starts correctly and consistently.

Highlights

  • Systemd Service Implementation: Replaced the legacy method of modifying /etc/rc.local with a dedicated systemd service (otbr-agent-restart-workaround.service) to handle the otbr-agent restart workaround.
  • Improved Reliability: The new systemd service ensures a more robust, modern, and maintainable approach to restarting otbr-agent, especially in scenarios where the nRF dongle might not be immediately ready at boot.
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 is a great improvement, replacing the legacy /etc/rc.local mechanism with a modern systemd service for the otbr-agent restart workaround. This makes the setup more robust and maintainable.

I have one suggestion to further improve the robustness of the new systemd service by adding a small delay, which should help ensure the workaround is effective even if the hardware takes a few moments to initialize.

Overall, this is a solid change.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@yangsong-cnyn
Copy link
Contributor Author

/gemini review

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 modernizes the otbr-agent restart workaround by replacing a legacy /etc/rc.local modification with a dedicated systemd service. This is a significant improvement in terms of reliability and maintainability. My review includes a suggestion to further refine the systemd service unit by using more idiomatic directives, which enhances readability and adheres to systemd best practices. I also noted that the fixed-delay sleep could be made more robust, though the proposed change is already a good step forward.

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 is a great improvement, replacing an outdated and fragile rc.local modification with a modern and robust systemd service to handle the otbr-agent restart workaround. The new approach is more maintainable and reliable. I have one suggestion to further refine the systemd service unit file to make it more idiomatic.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@bukepo bukepo requested a review from librasungirl September 29, 2025 06:16
grep -qxF 'sudo systemctl restart otbr-agent.service' /etc/rc.local || echo 'sudo systemctl restart otbr-agent.service' >>/etc/rc.local
echo 'exit 0' >>/etc/rc.local
# Restart otbr-agent as a workaround for nRF dongle not being ready.
cat <<EOF >/etc/systemd/system/otbr-agent-restart-workaround.service
Copy link
Member

Choose a reason for hiding this comment

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

I don't quite understand the root cause of that issue, and I don't see how this change would improve the reliability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the original comment is misleading: link_dongle.py is removed as ncs has fixed the USB filename issue.

the PR is 1. removing the misleading comment; 2. using systemd instead of rc

I have updated the PR description

Copy link
Member

Choose a reason for hiding this comment

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

if the issue is already fixed, so we still need th restart workaround?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will test and confirm if removing restart otbr-agent is neccesaary

@yangsong-cnyn yangsong-cnyn marked this pull request as draft September 30, 2025 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants