Skip to content

Always print full provisioning receipt and early quick-connect details on boot#300

Open
kmay89 wants to merge 3 commits intomainfrom
codex/display-api-token-in-serial-monitor
Open

Always print full provisioning receipt and early quick-connect details on boot#300
kmay89 wants to merge 3 commits intomainfrom
codex/display-api-token-in-serial-monitor

Conversation

@kmay89
Copy link
Copy Markdown
Owner

@kmay89 kmay89 commented Mar 10, 2026

Motivation

  • Reduce first-boot friction by making full provisioning credentials (including API token) available on every boot via the serial console.
  • Provide quick-connect information early in the init sequence so users can access the device without waiting for later initialization phases.
  • Make it explicit in the UI that the serial output is a local provisioning channel and present credentials consistently across boots.

Description

  • Removed first-boot gating and token redaction so the full provisioning JSON (including token) is printed on every boot.
  • Added an early quick-connect block that prints AP SSID, AP PASS, URL and API TOKEN immediately after WiFi AP startup when FEATURE_WIFI_AP is enabled.
  • Reordered some provisioning/quick-connect prints so credentials appear before longer init phases and updated the boot banner text to reflect the change.
  • Preserved TLS-related fields (tls_cert_fp) and conditional FEATURE_WIFI_AP handling.

Testing

  • Performed a CI/build compile of the arduino/canary_wap firmware (platform build for the target) and the build succeeded.
  • No module-specific automated unit tests were present for this change, so no unit test failures occurred.
  • Logging and serial output changes were verified via build-time checks; no runtime regressions were flagged by the CI build.

Codex Task

@gemini-code-assist
Copy link
Copy Markdown
Contributor

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 aims to significantly improve the first-boot experience and ongoing device accessibility by ensuring critical provisioning and quick-connect information is always readily available via the serial console. By removing first-boot gating and reordering print statements, users can now access device credentials and connection details much earlier and more consistently, streamlining the setup and management process.

Highlights

  • Provisioning Receipt: The full provisioning receipt, including the API token, is now printed on every boot via the serial console, removing the previous first-boot-only restriction and token redaction.
  • Early Quick-Connect Details: Quick-connect details (WiFi SSID, password, URL, and API token) are now printed earlier in the initialization sequence, immediately after WiFi AP startup, to facilitate quicker device access.
  • UI Consistency: The boot banner text has been updated to reflect that provisioning and WiFi credentials are consistently printed on every boot, improving user interface clarity.
Changelog
  • firmware/projects/canary-wap/arduino/canary_wap/canary_wap.ino
    • Added a new block to print quick-connect details (SSID, password, URL, API token) early in the setup() function, conditional on FEATURE_WIFI_AP.
    • Modified the provisioning receipt printing logic to remove the g_device.first_boot condition, ensuring the full JSON receipt with the API token is printed on every boot.
    • Removed the redacted API token message for subsequent boots.
    • Updated the boot banner text to inform users that token and WiFi credentials are printed on every boot, replacing the previous instruction about serving the receipt via HTTPS.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
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
Copy Markdown
Contributor

@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 updates the boot process to always print the full provisioning receipt and quick-connect details, which improves user experience by reducing first-boot friction. The changes are logical and align with the stated goals. I've identified an opportunity to improve maintainability by refactoring duplicated code into a helper function.

Note: Security Review did not run due to the size of the PR.

Comment on lines +4469 to +4478
#if FEATURE_WIFI_AP
Serial.println("[PROV] Quick connect:");
Serial.printf("[PROV] WiFi SSID : %s\n", g_device.ap_ssid);
Serial.printf("[PROV] WiFi PASS : %s\n", g_device.ap_password);
Serial.printf("[PROV] URL : %s://canary.local (or %s://%s)\n",
g_tls_enabled ? "https" : "http",
g_tls_enabled ? "https" : "http",
WiFi.softAPIP().toString().c_str());
Serial.printf("[PROV] API TOKEN : %s\n", g_device.api_token_str);
#endif
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.

medium

This block of code is nearly identical to the one added earlier in the setup() function (lines 4248-4259) for printing early quick-connect details. To avoid code duplication and improve maintainability, consider refactoring this logic into a helper function.

For example, you could create a function like print_quick_connect_details:

static void print_quick_connect_details(const char* title) {
  #if FEATURE_WIFI_AP
  if (g_device.initialized) {
    Serial.println(title);
    Serial.printf("[PROV]   WiFi SSID : %s\n", g_device.ap_ssid);
    Serial.printf("[PROV]   WiFi PASS : %s\n", g_device.ap_password);
    Serial.printf("[PROV]   URL       : %s://canary.local  (or %s://%s)\n",
                  g_tls_enabled ? "https" : "http",
                  g_tls_enabled ? "https" : "http",
                  WiFi.softAPIP().toString().c_str());
    Serial.printf("[PROV]   API TOKEN : %s\n", g_device.api_token_str);
  }
  #endif
}

Then you could replace both blocks with calls to this function:
print_quick_connect_details("[PROV] Quick connect (early):");
and
print_quick_connect_details("[PROV] Quick connect:");

This would make the code cleaner and easier to manage if the quick-connect details need to be changed in the future.

Copy link
Copy Markdown

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

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: 66c5c9fc19

ℹ️ 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".

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant