Skip to content

fix(security): phase-1 agent VM harden (keep NAT, defer private cutover) - #9261

Closed
Git-on-my-level wants to merge 5 commits into
mainfrom
fix/agent-vm-private-network
Closed

Git-on-my-level wants to merge 5 commits into
mainfrom
fix/agent-vm-private-network

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Phase-1, low-blast-radius harden for agent VM public :8080 exposure (#7326) — without removing public NAT or applying a public DENY firewall (those break prod today).

Why not private-only yet: agent VMs are on VPC default; agent-proxy is on GKE omi-prod-vpc-1 with no peering. Desktop still calls http://{vmIP}:8080 for upload/sync. Removing NAT or denying 0.0.0.0/0 would break chat + DB sync.

This PR (safe to merge)

  • Keep ONE_TO_ONE_NAT / public IP provisioning
  • Keep / contract-test omi-agent-vm network tag
  • Auth-gate VM /health (was publicly readable databaseReady); update desktop + agent-proxy callers
  • Land deferred phase-3 firewall IaC with apply refuse-by-default (AGENT_VM_FIREWALL_APPLY_PHASE3 gate)
  • Docs in AGENTS.md describing the deferred cutover

Explicitly deferred (do not apply yet)

Step Follow-up
Route desktop upload/sync through agent-proxy PR10c (required before firewall cutover)
Allowlist reserved Cloud NAT egress for proxy (or peer/move VMs) infra
Apply public DENY / remove NAT phase 3 after the above are proven

Related: #6611
Closes: partial progress on #7326 (auth harden + prepare surface; not full network isolation)

Test plan

cd desktop/macos/Backend-Rust && cargo test agent::contract
# 2 passed

cd backend && python3 -m pytest tests/unit/test_agent_vm_firewall_contract.py -v
# 4 passed (includes apply-script refuse gate)

bash backend/scripts/apply-agent-vm-firewall.sh
# must exit 1 with REFUSED (no gate env)

After merge / deploy (auth path):

  1. Publish updated desktop/macos/agent-cloud/agent.mjs to the agent GCS artifact bucket (VMs hot-reload from GCS).
  2. Deploy agent-proxy + desktop-backend as needed for caller header changes.
  3. Confirm unauthenticated GET http://<vm-public-ip>:8080/health → 401.
  4. Confirm authenticated health (Bearer / ?token=) → 200 with databaseReady.
  5. Smoke: desktop agent provision → DB upload/sync still works; chat via wss://agent.omi.me still works.

Do not run apply-agent-vm-firewall.sh or --live reachability against prod until PR10c + private reachability land.

Merge with a regular merge (no squash).

Made with Cursor

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5ad7e46dc

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

@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.

4 issues found across 6 files

Confidence score: 2/5

  • In desktop/macos/Backend-Rust/src/routes/agent.rs, removing accessConfigs means create_gce_vm can no longer produce an external IP while its Result<String> contract and downstream consumers still treat it as reachable over public network; merging as-is is likely to break agent provisioning/reachability flows — either restore external IP assignment or change the return contract and all callers before merging.
  • AGENTS.md describes agent-vm-firewall as denying only public tcp:8080, but backend/charts/agent-vm-firewall/firewall-rule.yaml uses sourceRanges: [0.0.0.0/0] on a DENY ingress rule, which effectively blocks that port from everywhere and can cut off intended internal access paths — align the rule or documentation to the intended policy and verify expected traffic still works.
  • backend/scripts/agent-vm-reachability-check.sh relies on Python assert for firewall contract checks, and backend/scripts/apply-agent-vm-firewall.sh validates only DENY while not enforcing full contract fields (like ingress/public source ranges), so CI/deploy validation can silently pass unsafe or incorrect rules in some environments — replace assert with explicit runtime checks and enforce all security-critical fields before merging.

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

Re-trigger cubic

Comment thread AGENTS.md Resolved
@Git-on-my-level
Git-on-my-level marked this pull request as draft July 8, 2026 02:13
Git-on-my-level and others added 3 commits July 8, 2026 14:55
Remove ONE_TO_ONE_NAT accessConfigs from GCE insert payload so new
agent VMs are private-network only. Add Rust contract test guarding
the provision JSON shape.

Verification: cd desktop/macos/Backend-Rust && cargo test provision

Related #7326

Co-authored-by: Cursor <[email protected]>
Add GCP firewall IaC for tag omi-agent-vm that denies public tcp:8080,
with apply/reachability scripts and hermetic contract tests. Extend the
Rust provision JSON contract to assert omi-agent-vm tagging and no public
IP fields in the insert payload.

Verification:
  cd desktop/macos/Backend-Rust && cargo test provision
  cd backend && python3 -m pytest tests/unit/test_agent_vm_firewall_contract.py -v
  backend/scripts/agent-vm-reachability-check.sh

Closes #7326

Related #6611

Co-authored-by: Cursor <[email protected]>
@Git-on-my-level
Git-on-my-level force-pushed the fix/agent-vm-private-network branch from f5ad7e4 to d77624e Compare July 8, 2026 08:03
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor follow-up for PR #9261:

  • Updated agent VM readiness/restart recovery to store the VM's private networkIP instead of falling back to missing public natIP / unknown after removing NAT.
  • Split the firewall contract into a higher-priority private tcp:8080 ALLOW plus public 0.0.0.0/0 DENY so agent-proxy/VPC traffic remains reachable.
  • Replaced optimized-away live-check assert statements with explicit SystemExit failures and expanded apply-time firewall contract validation.
  • Resolved the five addressed review threads.

Verification passed:

  • backend/scripts/agent-vm-reachability-check.sh under PYTHONOPTIMIZE=1: 6 passed
  • cargo test agent: 2 passed
  • cargo fmt --check
  • git diff --check
  • post-push GitHub checks all completed successfully or skipped as expected
  • post-push trusted-thread re-scan found no unresolved trusted bot threads

Git-on-my-level and others added 2 commits July 12, 2026 00:57
Keep public NAT and tag omi-agent-vm; gate firewall apply as deferred
phase-3. Auth-gate VM /health and update desktop + agent-proxy callers.

Verification:
  cargo test agent::contract
  python3 -m pytest backend/tests/unit/test_agent_vm_firewall_contract.py -v

Related #7326

Co-authored-by: Cursor <[email protected]>
@Git-on-my-level Git-on-my-level changed the title fix(agent): provision agent VMs without public NAT fix(security): phase-1 agent VM harden (keep NAT, defer private cutover) Jul 12, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Superseded by #10391

Rebuilt from current main with the final phase-1 intent of this PR (auth-gate /health, keep ONE_TO_ONE_NAT, deferred phase-3 firewall IaC with refuse-by-default). Earlier NAT-removal commits are intentionally not carried forward — they would break prod today (VMs on default, agent-proxy on omi-prod-vpc-1, no peering).

Closing this draft as CONFLICTING/stale since Jul 12.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Superseded by #10391 (phase-1 /health auth, keep NAT).

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

Git-on-my-level added a commit that referenced this pull request Jul 23, 2026
Records the #7326 phase-1 contract: public agent VM /health must not
expose readiness without the VM token. Evidence: prior attempt #9261.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
Git-on-my-level added a commit that referenced this pull request Jul 24, 2026
Records the #7326 phase-1 contract: public agent VM /health must not
expose readiness without the VM token. Evidence: prior attempt #9261.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
Git-on-my-level added a commit that referenced this pull request Jul 24, 2026
Records the #7326 phase-1 contract: public agent VM /health must not
expose readiness without the VM token. Evidence: prior attempt #9261.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
Git-on-my-level added a commit that referenced this pull request Jul 24, 2026
Records the #7326 phase-1 contract: public agent VM /health must not
expose readiness without the VM token. Evidence: prior attempt #9261.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
Git-on-my-level added a commit that referenced this pull request Jul 25, 2026
)

## Summary

Fixes the **cost half** of #7326: stopped `omi-agent-*` VMs keep billing
~50 GB `pd-balanced` boot disks because `autoDelete: true` only fires on
instance **delete**, not stop.

**Approach:** enable/fix the existing `backend/charts/agent-vm-reaper`
CronJob (it was written but never deployed — no GSA, no CronJob in
`prod-omi-backend`). Prefer reusing that machinery over new systems.

- Extract selection/delete into `backend/scripts/agent_vm_reaper.py`
(dry-run default; live gated)
- Add refuse-by-default `backend/scripts/apply-agent-vm-reaper.sh`
(creates GSA + WI + ConfigMap + CronJob)
- TERMINATED grace: `lastStopTimestamp` ≥ **12h** (preserves same-day
`start_stopped_vm` resume; after delete, status `NOT_FOUND` → clear
Firestore → client re-provisions + DB upload)
- RUNNING older than **2d** still reaped as abandoned
- Checked-in CronJob default `DRY_RUN=true` so bare apply is log-only

**Not in this PR:** public NAT removal / firewall cutover (phase-1
health-auth PR / #9261 lane). No network changes.

## Live evidence (2026-07-23, project `based-hardware`)

| Metric | Value |
|--------|-------|
| Fleet | ~183 TERMINATED + ~104 RUNNING `omi-agent-*` |
| Disk | 50 GB `pd-balanced` each |
| Idle disk burn | ~183 × $5 ≈ **~$915/mo** |
| Prod CronJob | **missing** (`kubectl -n prod-omi-backend get cronjob`
— no reaper) |
| GSA `agent-vm-reaper@…` | **NOT_FOUND** |
| Node default SA | `roles/compute.viewer` only — dedicated WI SA
required |

Dry-run of this PR's script (`python3 backend/scripts/agent_vm_reaper.py
--dry-run`):

- **137** reapable now (85 TERMINATED ≥12h + 52 RUNNING ≥2d)
- Immediate idle-disk savings from those TERMINATED ≈ **~$425/mo**
- Remaining TERMINATED age into the 12h window → full idle-disk fleet
bounded toward ~$0 beyond grace; steady-state savings ≈ **~$800–915/mo**
once LIVE, plus abandoned RUNNING compute

## Manual steps after merge (required — no CD for this chart)

```bash
# 1) Install IAM + CronJob in dry-run (log-only)
AGENT_VM_REAPER_APPLY=1 bash backend/scripts/apply-agent-vm-reaper.sh

# 2) Manual job + inspect logs
kubectl -n prod-omi-backend create job --from=cronjob/prod-agent-vm-reaper agent-vm-reaper-manual-$(date +%s)
kubectl -n prod-omi-backend logs job/<job-name>

# 3) Enable deletes
AGENT_VM_REAPER_APPLY=1 AGENT_VM_REAPER_LIVE=1 bash backend/scripts/apply-agent-vm-reaper.sh
```

Local inventory only (no mutation): `python3
backend/scripts/agent_vm_reaper.py --dry-run`

## Test plan

- [x] `python3 -m pytest backend/tests/unit/test_agent_vm_reaper.py -v`
→ 9 passed (selection, dry-run, refuse gates, manifest defaults)
- [x] `bash backend/scripts/apply-agent-vm-reaper.sh` without gate →
REFUSED exit 1
- [x] Live dry-run against GCP inventory → 137 targets logged, zero
deletes
- [ ] After merge: apply dry-run CronJob, review logs, then LIVE=1
- [ ] Confirm TERMINATED count drops over ~24h; disks deleted with
instances

## Relationship

- **#7326** — progresses **cost** half only (partial). Full close still
needs private networking / remove public NAT (deferred; depends on proxy
routing + peer/move VMs).
- **Health-auth / superseding #9261** — separate PR; this change does
not touch agent-proxy, NAT, or firewall.

Failure-Class: new



<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10390?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Git-on-my-level added a commit that referenced this pull request Aug 4, 2026
… cutover) (#10391)

## Summary

Phase-1, low-blast-radius harden for agent VM public `:8080` exposure
(#7326) — **without** removing public NAT or applying a public DENY
firewall (those break prod today).

**Why not private-only yet:** agent VMs are on VPC `default`;
`agent-proxy` is on GKE `omi-prod-vpc-1` with **no peering**. Desktop
still calls `http://{vmIP}:8080` for upload/sync. Removing NAT or
denying `0.0.0.0/0` would break chat + DB sync.

### This PR (safe to merge)
- Keep `ONE_TO_ONE_NAT` / public IP provisioning
- Keep / contract-test `omi-agent-vm` network tag
- Auth-gate VM `/health` (was publicly readable `databaseReady`); update
desktop + agent-proxy callers
- Land deferred phase-3 firewall IaC with **apply refuse-by-default**
(`AGENT_VM_FIREWALL_APPLY_PHASE3` gate)
- Deferred cutover docs live in
`backend/charts/agent-vm-firewall/firewall-rule.yaml` + apply script
(refuse-by-default)

### Explicitly deferred (do not apply yet)
| Step | Follow-up |
|------|-----------|
| Route desktop upload/sync through agent-proxy | **PR10c** (required
before firewall cutover) |
| Allowlist reserved Cloud NAT egress for proxy (or peer/move VMs) |
infra |
| Apply public DENY / remove NAT | phase 3 after the above are proven |
| Terminated-disk / storage cost leak | later slice of #7326 |

**Partial progress on #7326** (auth harden + prepare surface; not full
network isolation or cost fix).

**Supersedes #9261** (stale/CONFLICTING since Jul 12).

## Product invariants affected

- INV-AUTH-1 (path-matched via `AgentSyncService.swift`; this PR only
adds Bearer/`?token=` on VM `/health` probes — no Firebase session-death
policy change)

## Failure-Class

Failure-Class: new

Registers `FC-agent-vm-public-health-unauth`: public agent VM `/health`
must not expose readiness metadata without the VM auth token. Evidence:
#9261 / #7326.

## Manual steps (post-merge; current Python runtime)

This is a **phase-1 health-auth rollout only**. Keep public
`ONE_TO_ONE_NAT` / public IP provisioning. Do not remove NAT, apply a
public DENY firewall, or run the deferred phase-3 firewall script.

PR #10686 retired the Node `agent.mjs` and Rust agent runtime in favor
of the Python Agent VM image. Do **not** publish `agent.mjs` or update
`version.txt` as the rollout mechanism. Use the current versioned
image/startup workflow on merged `main`.

**Safe order (callers before gate):**

1. **Deploy `agent-proxy` from merged `main` first.** Dispatch
`.github/workflows/gcp_backend_agent_proxy.yml` with `environment=prod`.
The workflow checks out `main`, builds/pushes `agent-proxy`, deploys it
to `prod-omi-gke`, and waits for the GKE rollout to complete.
2. **Ship a desktop build with the Swift health-auth callers.** Use a
beta/candidate containing the `AgentSyncService.swift` and
`AgentVMService.swift` changes from this PR. Do not let VMs enforce the
new health gate before this caller is available; otherwise desktop
health checks receive `401` and may false-trigger DB re-upload paths.
3. **Choose the VM-image publication path deliberately.** The current
`.github/workflows/desktop_backend_prod.yml` is a **combined
desktop-backend production release**: in addition to building/publishing
`gcr.io/based-hardware/agent-vm:<first-12-of-release-sha>` and
`gs://based-hardware-agent/startup.sh`, it deploys and probes a
desktop-backend candidate, then routes 100% of production traffic and
can roll back. **Do not dispatch it solely to publish the VM image.**
Use it only after separately approving that combined desktop-backend
release, with the exact merged `release_sha`, normal release-eligibility
proof, `confirm=deploy-desktop-backend-prod`, and a non-empty operator
`reason`. There is no dedicated VM-only publisher currently; create and
approve that path before a VM-only rollout.
4. **Verify before declaring the rollout complete:**
- `curl -sS -i http://<vm-public-ip>:8080/health` returns `401` and no
readiness metadata.
- `curl -sS -i -H "Authorization: Bearer <vmToken>"
http://<vm-public-ip>:8080/health` returns `200` with the expected
`databaseReady` field.
- Confirm the `agent-proxy` GKE rollout, the VM runtime/image identity,
and desktop provision → upload/sync plus chat via `wss://agent.omi.me`.
5. **Stop and roll back** if unauthenticated health returns readiness
data, an authenticated caller receives `401`, or upload/sync/chat
regresses. Do not change firewall or NAT state while investigating.

**Do not run** `backend/scripts/apply-agent-vm-firewall.sh`, remove
public NAT, or use `--live` reachability against production until PR10c
plus private reachability and the reserved Cloud NAT allowlist are
proven.

## Test plan

- [x] `cd backend && python3 -m pytest
tests/unit/test_agent_vm_firewall_contract.py
tests/unit/test_agent_vm_health_auth_contract.py
tests/unit/test_agent_vm_protocol.py -v` → PR-specific backend contract
tests pass
- [x] `bash backend/scripts/apply-agent-vm-firewall.sh` → exit 1
`REFUSED`
- [x] `bash backend/scripts/agent-vm-reachability-check.sh` → passed
(hermetic; no production `--live` check)
- [x] Swift recovery test asserts `/health` sends Bearer + `?token=`
(`AgentSyncBatchQueryTests`)

Merge with a **regular merge** (no squash). Do not auto-merge —
coordinate the caller-before-gate deployment order above.



<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10391?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
…edHardware#10390)

## Summary

Fixes the **cost half** of BasedHardware#7326: stopped `omi-agent-*` VMs keep billing
~50 GB `pd-balanced` boot disks because `autoDelete: true` only fires on
instance **delete**, not stop.

**Approach:** enable/fix the existing `backend/charts/agent-vm-reaper`
CronJob (it was written but never deployed — no GSA, no CronJob in
`prod-omi-backend`). Prefer reusing that machinery over new systems.

- Extract selection/delete into `backend/scripts/agent_vm_reaper.py`
(dry-run default; live gated)
- Add refuse-by-default `backend/scripts/apply-agent-vm-reaper.sh`
(creates GSA + WI + ConfigMap + CronJob)
- TERMINATED grace: `lastStopTimestamp` ≥ **12h** (preserves same-day
`start_stopped_vm` resume; after delete, status `NOT_FOUND` → clear
Firestore → client re-provisions + DB upload)
- RUNNING older than **2d** still reaped as abandoned
- Checked-in CronJob default `DRY_RUN=true` so bare apply is log-only

**Not in this PR:** public NAT removal / firewall cutover (phase-1
health-auth PR / BasedHardware#9261 lane). No network changes.

## Live evidence (2026-07-23, project `based-hardware`)

| Metric | Value |
|--------|-------|
| Fleet | ~183 TERMINATED + ~104 RUNNING `omi-agent-*` |
| Disk | 50 GB `pd-balanced` each |
| Idle disk burn | ~183 × $5 ≈ **~$915/mo** |
| Prod CronJob | **missing** (`kubectl -n prod-omi-backend get cronjob`
— no reaper) |
| GSA `agent-vm-reaper@…` | **NOT_FOUND** |
| Node default SA | `roles/compute.viewer` only — dedicated WI SA
required |

Dry-run of this PR's script (`python3 backend/scripts/agent_vm_reaper.py
--dry-run`):

- **137** reapable now (85 TERMINATED ≥12h + 52 RUNNING ≥2d)
- Immediate idle-disk savings from those TERMINATED ≈ **~$425/mo**
- Remaining TERMINATED age into the 12h window → full idle-disk fleet
bounded toward ~$0 beyond grace; steady-state savings ≈ **~$800–915/mo**
once LIVE, plus abandoned RUNNING compute

## Manual steps after merge (required — no CD for this chart)

```bash
# 1) Install IAM + CronJob in dry-run (log-only)
AGENT_VM_REAPER_APPLY=1 bash backend/scripts/apply-agent-vm-reaper.sh

# 2) Manual job + inspect logs
kubectl -n prod-omi-backend create job --from=cronjob/prod-agent-vm-reaper agent-vm-reaper-manual-$(date +%s)
kubectl -n prod-omi-backend logs job/<job-name>

# 3) Enable deletes
AGENT_VM_REAPER_APPLY=1 AGENT_VM_REAPER_LIVE=1 bash backend/scripts/apply-agent-vm-reaper.sh
```

Local inventory only (no mutation): `python3
backend/scripts/agent_vm_reaper.py --dry-run`

## Test plan

- [x] `python3 -m pytest backend/tests/unit/test_agent_vm_reaper.py -v`
→ 9 passed (selection, dry-run, refuse gates, manifest defaults)
- [x] `bash backend/scripts/apply-agent-vm-reaper.sh` without gate →
REFUSED exit 1
- [x] Live dry-run against GCP inventory → 137 targets logged, zero
deletes
- [ ] After merge: apply dry-run CronJob, review logs, then LIVE=1
- [ ] Confirm TERMINATED count drops over ~24h; disks deleted with
instances

## Relationship

- **BasedHardware#7326** — progresses **cost** half only (partial). Full close still
needs private networking / remove public NAT (deferred; depends on proxy
routing + peer/move VMs).
- **Health-auth / superseding BasedHardware#9261** — separate PR; this change does
not touch agent-proxy, NAT, or firewall.

Failure-Class: new



<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10390?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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