Skip to content

firmware: add CV1 contributor checks that need no jig - #24354

Merged
Git-on-my-level merged 6 commits into
mainfrom
fw/cv1-contributor-checks
Nov 2, 2026
Merged

Git-on-my-level merged 6 commits into
mainfrom
fw/cv1-contributor-checks

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Requested by David

What changed and why

Adds checks a CV1 contributor can run without a jig: host tests, key-free application compilation, offline artifact preflight, and startup replay. Also adds the OTA design docs. The owner-OTA research code goes in a separate held change. No firmware behavior changes: audio_packet_logic.c is a tested seam that is not linked until transport.c switches to it in a separate change.

Also documents a bench trap: the mainboard has no antenna part, so an opened board barely radiates and weak advertising from it is not a firmware fault.

Product invariants affected

  • INV-CAP-1

Not changed in practice: the new lib/core seam is not linked into the firmware by this PR, so the capture path is unchanged. The change that links it needs its own BLE audio evidence.

How it was verified

All on head f322521, from a clean clone on the bench Mac, with no device access:

  • python3 omi/firmware/tools/cv1/contributor.py quick-host --output <new-file> passes.
  • python3 -m unittest discover -p 'test_*.py' in omi/firmware/tools/cv1: 191 tests pass.
  • source_review tests: 14 pass with the pinned NCS 2.9.0 source, and skip cleanly without it.
  • contributor.py compile-only against pinned NCS 2.9.0: application_compile_only passes.

Not verified: none of this exercises hardware, BLE or a real OTA. No release claim is made.

Replaces #24353, whose first commit contained a telemetry fixture of unverifiable consent. Every Cubic finding is dispositioned in the PR comments. Findings on the research code move with it to its own held change.

Tests

The PR is mostly tests. omi/tests/host/audio_packet_logic_test.c covers the new seam.

UI evidence

UI-Evidence: none -- firmware tooling and docs only

🤖 Generated with Claude Code

Add host checks, key-free application compilation, offline artifact preflight,
startup replay, the OTA design docs and the owner OTA research code. None of it
flashes, signs, publishes or changes device trust, and no firmware source
changes: audio_packet_logic.c is a tested seam that is not linked until
transport.c switches to it separately.

Imported receipts and captures are labelled operator_supplied because the tools
only check that their bytes are unchanged. Document that an opened board may
have no antenna contact, since the mainboard relies on pogo pad PP1 and the BOM
has no antenna part.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-02T06:27:09.121084Z
We couldn’t complete this review. Comment @codex review to try again.
ae4dce1 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

CI runs clang-format 18 and newer releases format compound literals and casts
differently, so avoid those constructs in the owner OTA research code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

6 issues found and verified against the latest diff

Confidence score: 1/5

  • validation-model.md identifies a tracked PEM as an RSA private signing key, creating a serious signing-key custody risk. Remove it from release signing and history, and use a secret-managed production key.
  • compile_only.py checks application .config for sysbuild-only settings, so normal compile-only runs stop before 08-compile-app. Read the SB_CONFIG_* settings instead.
  • bootstrap_matrix.py treats a rejected downgrade like a torn-primary failure, which can prevent booting a valid current primary and leave the candidate intact. Keep the primary bootable when its version is valid and the candidate is older.
  • checkout_contributor.py can report the toolchain as pinned without verifying the CMake and Ninja executables the compile path launches. Verify those exact executables before reporting the toolchain as pinned.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="omi/firmware/docs/ota-bootstrap-contract.md">

<violation number="1" location="omi/firmware/docs/ota-bootstrap-contract.md:72">
P3: Add spaces between prose, numbers, units, and identifiers throughout this contract. For example, write `advertises 64 KiB`, `requires 4 KiB`, and `a 400 KiB caller request`; the same cleanup is needed in the RAM and HCI rows.</violation>
</file>

<file name="omi/firmware/docs/validation-model.md">

<violation number="1" location="omi/firmware/docs/validation-model.md:29">
P1: This paragraph understates the custody risk: the configured, tracked PEM is an RSA private signing key, not merely an unverified key path. Remove it from release signing and history, use a secret-managed production key, and explicitly mark this repository key as compromised/development-only before relying on MCUboot trust.</violation>
</file>

<file name="omi/firmware/tools/cv1/source_review/bootstrap_matrix.py">

<violation number="1" location="omi/firmware/tools/cv1/source_review/bootstrap_matrix.py:65">
P2: This branch conflates a rejected downgrade with the torn-primary hazard: a valid current primary must remain bootable and the candidate must remain intact when its version is lower. Return `primary` for a valid primary here, retaining the source-erased result only for an invalid torn primary.</violation>
</file>

<file name="omi/firmware/tools/cv1/compile_only.py">

<violation number="1" location="omi/firmware/tools/cv1/compile_only.py:53">
P1: This validation requires sysbuild-only settings from the application `.config`, so every normal compile-only run stops before `08-compile-app` with “lacks skip strategy” instead of compiling. Use `SB_CONFIG_*` in an actual sysbuild invocation, or remove these sysbuild-only requirements from the plain application-object check.</violation>
</file>

<file name="omi/firmware/tools/cv1/checkout_contributor.py">

<violation number="1" location="omi/firmware/tools/cv1/checkout_contributor.py:6">
P2: The documented `quick-host` command fails before running any checks when the pinned baseline object is not present in the checkout. Ship or require the baseline object, or pin a reachable baseline and document the required history; otherwise contributors receive a false failed prerequisite instead of host results.</violation>

<violation number="2" location="omi/firmware/tools/cv1/checkout_contributor.py:85">
P2: The toolchain stage can pass without verifying the CMake and Ninja executables that the compile path actually launches. Hash or resolve those exact `<toolchain_root>/bin` paths before reporting the toolchain as pinned; otherwise a changed link or file can silently select different build tooling.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread omi/firmware/tools/cv1/FIXTURES.json Resolved

## Key custody and phone trust

The app key source is a tracked repository PEM path selected by product `omi/firmware/omi/sysbuild.conf`; only path existence was checked, never private bytes. This does not establish a production secret or custody. Network build defaults generate development-key material in a fresh build directory; SDK warns against production use. No inference is made about shipped devices or the erased factory application.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: This paragraph understates the custody risk: the configured, tracked PEM is an RSA private signing key, not merely an unverified key path. Remove it from release signing and history, use a secret-managed production key, and explicitly mark this repository key as compromised/development-only before relying on MCUboot trust.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At omi/firmware/docs/validation-model.md, line 29:

<comment>This paragraph understates the custody risk: the configured, tracked PEM is an RSA private signing key, not merely an unverified key path. Remove it from release signing and history, use a secret-managed production key, and explicitly mark this repository key as compromised/development-only before relying on MCUboot trust.</comment>

<file context>
@@ -0,0 +1,33 @@
+
+## Key custody and phone trust
+
+The app key source is a tracked repository PEM path selected by product `omi/firmware/omi/sysbuild.conf`; only path existence was checked, never private bytes. This does not establish a production secret or custody. Network build defaults generate development-key material in a fresh build directory; SDK warns against production use. No inference is made about shipped devices or the erased factory application.
+
+SMP transport has plain GATT read/write permissions in this baseline; encryption/authenticated SMP permissions are off. Pairing availability does not establish paired-only OTA authorization and does not replace boot signatures. A low-cost stable local/offline maintainer signer is a proposal; KMS can follow later. No new key has been created, and existing devices cannot be assumed to trust a new key without a migration design.
</file context>

return records
def validate_config(text):
forbidden=['CONFIG_SECURE_BOOT=y','CONFIG_NCS_INCLUDE_RPMSG_CHILD_IMAGE=y','CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y','CONFIG_BUILD_OUTPUT_BIN=y','CONFIG_BUILD_OUTPUT_HEX=y','CONFIG_SIGN_IMAGES=y','CONFIG_MCUBOOT_BUILD_STRATEGY_FROM_SOURCE=y','CONFIG_BOOTLOADER_PROVISION_HEX=y']
required=['CONFIG_BOOT_SIGNATURE_KEY_FILE=""','CONFIG_MCUBOOT_BUILD_STRATEGY_SKIP_BUILD=y']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: This validation requires sysbuild-only settings from the application .config, so every normal compile-only run stops before 08-compile-app with “lacks skip strategy” instead of compiling. Use SB_CONFIG_* in an actual sysbuild invocation, or remove these sysbuild-only requirements from the plain application-object check.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At omi/firmware/tools/cv1/compile_only.py, line 53:

<comment>This validation requires sysbuild-only settings from the application `.config`, so every normal compile-only run stops before `08-compile-app` with “lacks skip strategy” instead of compiling. Use `SB_CONFIG_*` in an actual sysbuild invocation, or remove these sysbuild-only requirements from the plain application-object check.</comment>

<file context>
@@ -0,0 +1,107 @@
+ return records
+def validate_config(text):
+ forbidden=['CONFIG_SECURE_BOOT=y','CONFIG_NCS_INCLUDE_RPMSG_CHILD_IMAGE=y','CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y','CONFIG_BUILD_OUTPUT_BIN=y','CONFIG_BUILD_OUTPUT_HEX=y','CONFIG_SIGN_IMAGES=y','CONFIG_MCUBOOT_BUILD_STRATEGY_FROM_SOURCE=y','CONFIG_BOOTLOADER_PROVISION_HEX=y']
+ required=['CONFIG_BOOT_SIGNATURE_KEY_FILE=""','CONFIG_MCUBOOT_BUILD_STRATEGY_SKIP_BUILD=y']
+ if any(x in text.splitlines() for x in forbidden) or any(x not in text.splitlines() for x in required):raise ValueError('compile-only config enables image/key/child behavior or lacks skip strategy')
+def validate_commands(text):
</file context>

Comment thread omi/firmware/docs/ota-development.md Resolved
Git-on-my-level and others added 4 commits November 2, 2026 13:44
The repo's *.log ignore rule dropped two pinned startup fixtures, so quick-host
failed on any clean checkout. Track them explicitly.

Move the owner OTA research code to its own change: it isn't built, and it has
known defects that shouldn't land under a contributor-checks title.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fix review findings in the contributor tools. Evidence and job checks now
reject malformed or inconsistent input instead of passing or crashing. SDK
checks reject stray files other than Python bytecode, which any used SDK has.
Shallow clones get their own error, tested against real git.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test compared Python tuples with JSON lists, so it could never pass when the
pinned SDK was present.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Exercise the SDK tree-state and toolchain launch checks without mocks, and
reject non-integer UART byte counts, which compared equal to real sizes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Disposition of all 53 Cubic findings on this PR, as of head f322521. Cubic has not reviewed anything after 5269183, so a later independent review covered the fixes; its two findings are listed last.

Moved out, not fixed (20). Everything on omi/firmware/research/owner_ota/ and docs/ota-recovery-link-research.md. That code left this PR in 3d031e1 and isn't built here. These findings stay open and go with it to its own held change.

Rejected (2), with evidence:

  • compile_only.py:53 (claimed every compile-only run stops before compiling). A clean clone of f322521 ran compile-only against pinned NCS 2.9.0, and application_compile_only passed.
  • bootstrap_matrix.py:67 (claimed a rejected downgrade leaves the candidate intact). Pinned MCUboot loader.c at 12e5ee10, in boot_validate_slot, logs "insufficient version in secondary slot", erases the secondary area and continues from the primary. The model's primary_source_erased result matches that; the suggested primary would be wrong.

Left open, out of scope (1): docs/validation-model.md:29 (signing-key custody). This PR neither uses nor changes the key. It needs an owner decision and migration design, and is tracked separately.

Fixed (30):

  • FIXTURES.json:96: fixed in 3d031e1, startup fixtures are now tracked. Clean-clone quick-host passes.
  • checkout_contributor.py:6, :77, :95
  • evidence.py:15, :39, :105, :106
  • job_dry_run.py:9, :23
  • artifact_preflight.py:114, bench.py:123
  • ota_development_model.py:16, :56, :102
  • radio_packet.py:8
  • run_shared_c.py:11, :16
  • bootstrap_matrix.py:38
  • test_bootstrap_matrix.py:7, :31
  • matrix-result.json
  • test_checkout_contributor.py:48, test_ota_development_model.py:102
  • Docs: tests/host/README.md:28, ota-development.md:26, :85, updater-source.md:6, source_review/README.md:17, ota-bootstrap-contract.md:72

The ota-bootstrap-contract.md:72 fix is partial: the cited spot is corrected, but the finding said "throughout", and other spacing in that doc may remain. It's cosmetic.

Later independent review of e82f566 (2), both fixed in f322521: evidence.py accepted non-integer UART byte counts, and the toolchain and SDK tree-state tests were fully mocked. They now run against real git and real executables.

Verified on f322521 from a clean clone on the bench Mac, with no device access: quick-host passed, 191 tool tests OK, 14 source_review tests OK with the pinned SDK, compile-only passed. CI is green on this head.

@Git-on-my-level
Git-on-my-level merged commit 270a0e6 into main Nov 2, 2026
55 checks passed
@Git-on-my-level
Git-on-my-level deleted the fw/cv1-contributor-checks branch November 2, 2026 11:34
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