Skip to content

[codex] Add deploy-scoped noter sync installer slice - #372

Merged
nicu-chiciuc merged 19 commits into
mainfrom
codex/noter-sync-installer-rfc
Mar 30, 2026
Merged

nicu-chiciuc merged 19 commits into
mainfrom
codex/noter-sync-installer-rfc

Conversation

@nicu-chiciuc

@nicu-chiciuc nicu-chiciuc commented Mar 29, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The installer slice and RFC 073 had drifted into two overlapping stories: an older multi-install/per-source model and the simpler product model we actually want for the MVP. This update resets both the docs and the implementation around the current intent.

For this first-user slice, the hosted deploy-scoped noter.js file is the real path because it is the fastest way to iterate across prod, preview, and local worktrees. @noter-md/sync still matters, but as the later public wrapper around the same underlying file rather than as something we pretend is already published.

Summary

  • simplify the installer bootstrap model to one local Noter config file at ~/.noter/config.json instead of per-source installation records
  • keep packages/sync/noter.js as the canonical installer source and mirror it byte-for-byte into hosted apps/noter/public/noter.js
  • make the production direct-file path rely on the built-in default source URL, while preview and local iteration keep the explicit source override form
  • leave the current /machines/connect UI on the explicit-URL command for now, even though the runtime now supports the shorter production command
  • remove redundant browser handoff params so the CLI now opens /machines/connect?openedByCli and the app derives the script URL from the current origin
  • rewrite RFC 073 around the single-install, hosted-file-first model and add spec 075 as a concrete local walkthrough for the current slice
  • keep machine auth explicitly separate from MCP OAuth and preserve the thin browser approval checkpoint model

Validation

  • pnpm exec vitest --run packages/sync/noter.test.ts
  • pnpm --filter noter exec vitest --run src/lib/noterSync.test.ts src/lib/noterSyncPublicScript.test.ts
  • PLAYWRIGHT=1 pnpm --filter noter build:ci
  • PLAYWRIGHT=1 pnpm --filter noter exec playwright test -c playwright.config.ts e2e/machine-connect-visual.spec.ts --update-snapshots
  • commit hooks ran repo lint, script typecheck/lint, and full vitest --run
  • make anon was required locally so the worktree backend was available at http://127.0.0.1:14440 for the commit hooks

First Message

write/update a spec about how you would do it, push to pr

Requested Codex Runtime

  • requestedModel: gpt-5
  • requestedReasoningEffort: medium

@coderabbitai

coderabbitai Bot commented Mar 29, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an RFC and implements a deploy-scoped installer and CLI flow plus UI, tests, and build tooling: new public sync script (/noter.js) and @noter-md/sync CLI, a /machines/connect page and header actions, installation-state persistence, Vite asset sync, and associated tests/fixtures.

Changes

Cohort / File(s) Summary
RFC
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md
New RFC defining the onboarding gap, installer URL-scoped artifact, CLI invocation patterns, registration mechanics, UX states, MVP scope, and acceptance criteria.
Public sync script / CLI package
apps/noter/public/noter.js, packages/sync/noter.js, packages/sync/package.json
Adds deploy-scoped public installer artifact and source CLI implementing connect [--from <url>]: URL validation, codex detection, deterministic installationId, machineConnect URL construction, install-state writes under ~/.noter/sync/installations, and browser handoff.
Noter sync helpers & tests
apps/noter/src/lib/noterSync.ts, apps/noter/src/lib/noterSync.test.ts, apps/noter/src/lib/noterSyncPublicScript.test.ts
New helper constants/functions for script URL/command generation and query parsing; tests ensure command/script URL behavior and that checked-in public asset matches package source.
UI: route, page, fixtures, header actions
apps/noter/src/App.tsx, apps/noter/src/components/MachineConnectPage.tsx, apps/noter/src/components/MachineConnectVisualFixture.tsx, apps/noter/src/components/VaultDashboard.tsx, apps/noter/src/components/VaultDashboardChrome.tsx, apps/noter/src/components/VaultDashboardVisualFixture.tsx, apps/noter/src/visualFixture.tsx
Adds /machines/connect route, MachineConnectPage and visual fixture, injects “Connect machine” button into dashboard header, updates header to accept actions prop, and exposes visual fixture mode.
Page metadata & tests
apps/noter/src/lib/pageMetadata.ts, apps/noter/src/lib/pageMetadata.test.ts
Adds MACHINE_CONNECT_PAGE_METADATA and returns new title/metadata for /machines/connect; includes unit test for title resolution.
E2E / visual tests
apps/noter/e2e/machine-connect-visual.spec.ts
Playwright visual regression test for the machine-connect fixture with deterministic screenshot options.
Vite asset sync
apps/noter/vite.config.ts
Adds plugin to copy/format packages/sync/noter.js → apps/noter/public/noter.js when differing; refactors file-format helper.
Install-state CLI tests
packages/sync/noter.test.ts
Tests CLI parsing, URL validation rules, installationId/path generation, machineConnect URL format, and help text examples.

Sequence Diagram(s)

sequenceDiagram
  participant Browser as Browser
  participant Hosted as Deploy (/noter.js)
  participant Auth as MCP Auth Service
  participant Installer as Installer CLI
  participant Local as Local Machine Agent

  Browser->>Hosted: Navigate to /machines/connect (or open URL with params)
  Hosted->>Auth: Obtain short-lived registration URL / token
  Auth-->>Browser: Auth success + registration token/URL
  Browser->>Installer: User copies/runs bootstrap command (includes source URL)
  Installer->>Hosted: Fetch installer bootstrap (/noter.js)
  Installer->>Local: Write installation state (~/.noter/sync/...) and spawn agent step
  Local->>Hosted: Register machine using token / one-time code
  Hosted-->>Browser: Confirm machine connected (UI state)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

implementation

Poem

🐇 I hopped from browser to shell with delight,

A tiny token clutched in the moonlit night,
One script, one command, a click and a ping,
Machines wake and chatter — what joy they bring,
A rabbit and CLI danced into the light.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title directly and specifically describes the main change: implementing a deploy-scoped installer slice for the noter sync product component, which is the core focus of the changeset across multiple files and directories.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/noter-sync-installer-rfc

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 29, 2026 •

Copy link
Copy Markdown

Deploying noter with  Cloudflare Pages  Cloudflare Pages

Latest commit: 797530c
Status: ✅  Deploy successful!
Preview URL: https://6740d1d3.noter-ax1.pages.dev
Branch Preview URL: https://codex-noter-sync-installer-r.noter-ax1.pages.dev

View logs

@nicu-chiciuc
nicu-chiciuc marked this pull request as ready for review March 29, 2026 22:59

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (1)

435-446: Add explicit headless/remote auth fallback in registration mechanics.

The fallback currently mentions one-time code entry, but this RFC should explicitly define device code authorization for environments where browser handoff is unavailable (SSH/remote/headless). That keeps onboarding viable for non-GUI machine setups.

Proposed RFC text adjustment
 Preferred pattern:
 
 1. browser issues a short-lived machine-registration token or URL
 2. local installer consumes it
 3. installer exchanges it for durable machine credentials
 
 Acceptable fallback:
 
 1. copy a one-time code from Noter into the CLI
+2. support device code authorization for headless/remote environments where
+   browser handoff is unavailable

Based on learnings: "Enable device code authorization for Codex when running in headless or remote environments where normal browser flow isn't available".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines
435 - 446, The RFC's registration mechanics lack an explicit headless/remote
auth fallback; update the "install" and "registration mechanics" sections to add
a clear device code authorization flow (device code URL + short code) as the
primary fallback for SSH/headless setups: describe how the browser issues a
short-lived machine-registration token/URL, how the local installer/CLI (install
command) can detect headless mode and instead request a device code, how the
operator enters that code in a browser to authorize the machine, and how the
installer exchanges the device-code grant for durable machine credentials; also
update the acceptable fallback paragraph that currently mentions "one-time code"
to explicitly reference "device code authorization" and include token lifetime
and polling/exchange behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 452: Replace the non-hyphenated compound adjective in the sentence
referencing the public_ts repo: change the phrase "GitHub Actions based" to the
hyphenated form "GitHub Actions-based" so the compound modifier before "npm
publish flow" is grammatically correct.
- Around line 450-483: The RFC's "Minimal Publish Shape" omits
integrity/provenance requirements for the installer; update the document to
require artifact authenticity checks for the MVP by adding explicit requirements
that the published package (`@noter-md/sync`) and its single executable
(noter.mjs) include verifiable provenance (e.g., npm provenance metadata or
signed release artifacts) and/or pinned checksums, and describe where and how
verification is performed (CLI behavior for `npx `@noter-md/sync` connect` and
documentation steps), plus failure modes and UX (warn/fail on mismatch) so
implementers know to verify signatures/checksums before executing the installer.
- Line 7: Update the document metadata in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md by changing the
"Last updated: 2026-03-30" line to "Last updated: 2026-03-29" (or leave a TODO
comment and update to the true March 30 date when that edit is actually made);
locate the exact "Last updated:" header line in the file and replace the date
string to avoid future-dated metadata.

---

Nitpick comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Around line 435-446: The RFC's registration mechanics lack an explicit
headless/remote auth fallback; update the "install" and "registration mechanics"
sections to add a clear device code authorization flow (device code URL + short
code) as the primary fallback for SSH/headless setups: describe how the browser
issues a short-lived machine-registration token/URL, how the local installer/CLI
(install command) can detect headless mode and instead request a device code,
how the operator enters that code in a browser to authorize the machine, and how
the installer exchanges the device-code grant for durable machine credentials;
also update the acceptable fallback paragraph that currently mentions "one-time
code" to explicitly reference "device code authorization" and include token
lifetime and polling/exchange behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6f84be3e-a869-4bd8-963b-a2ea60435145

📥 Commits

Reviewing files that changed from the base of the PR and between 6637131 and a4e3e92.

📒 Files selected for processing (1)
  • rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md


- Status: Proposed implementation
- Owner: connected machine onboarding UX
- Last updated: 2026-03-30

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix document metadata date drift (future “Last updated”).

Line 7 says 2026-03-30, but this PR was opened on March 29, 2026. Please either set it to 2026-03-29 or update it when the actual March 30 edit lands to avoid audit confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 7,
Update the document metadata in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md by changing the
"Last updated: 2026-03-30" line to "Last updated: 2026-03-29" (or leave a TODO
comment and update to the true March 30 date when that edit is actually made);
locate the exact "Last updated:" header line in the file and replace the date
string to avoid future-dated metadata.

Comment on lines +450 to +483
## Minimal Publish Shape

The current `public_ts` repo proves that a GitHub Actions based npm publish flow
works fine for scoped public packages, but the connected-machine installer does
not need the full monorepo release shape used there.

Recommended packaging shape:

1. package name: `@noter-md/sync`
2. one executable source file: `noter.mjs`
3. one `package.json` with `type: "module"`, `publishConfig.access: "public"`,
and a single `bin` entry
4. no runtime dependencies unless the installer truly needs them

Recommended invocation:

```bash
npx @noter-md/sync connect
```

Recommended reason:

1. it preserves the "single polished script" feeling
2. it works with stock Node today
3. it avoids `curl ... | node` trust concerns as the primary instruction
4. it is much simpler than asking users to copy a local `noter.mjs` file by hand

Suggested release automation:

1. keep the package in its own small package folder or repo
2. publish from GitHub Actions when the package version changes or when a tag is
pushed
3. use `npm publish --access public` or an equivalent publish action
4. avoid introducing Turbo/workspace complexity unless more packages actually

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Define installer integrity and provenance requirements for MVP.

This section defines packaging/release flow, but it does not require artifact authenticity checks. For machine registration tooling, add explicit requirements for package integrity/provenance (e.g., npm provenance, pinned checksums/signatures for noter.mjs, and verification behavior in docs/CLI). Without this, supply-chain risk remains under-specified for implementation.

🧰 Tools
🪛 LanguageTool

[grammar] ~452-~452: Use a hyphen to join words.
Context: ...ic_ts` repo proves that a GitHub Actions based npm publish flow works fine for sc...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines
450 - 483, The RFC's "Minimal Publish Shape" omits integrity/provenance
requirements for the installer; update the document to require artifact
authenticity checks for the MVP by adding explicit requirements that the
published package (`@noter-md/sync`) and its single executable (noter.mjs) include
verifiable provenance (e.g., npm provenance metadata or signed release
artifacts) and/or pinned checksums, and describe where and how verification is
performed (CLI behavior for `npx `@noter-md/sync` connect` and documentation
steps), plus failure modes and UX (warn/fail on mismatch) so implementers know
to verify signatures/checksums before executing the installer.


## Minimal Publish Shape

The current `public_ts` repo proves that a GitHub Actions based npm publish flow

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use hyphenated compound adjective.

At Line 452, change GitHub Actions based to GitHub Actions-based.

🧰 Tools
🪛 LanguageTool

[grammar] ~452-~452: Use a hyphen to join words.
Context: ...ic_ts` repo proves that a GitHub Actions based npm publish flow works fine for sc...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 452,
Replace the non-hyphenated compound adjective in the sentence referencing the
public_ts repo: change the phrase "GitHub Actions based" to the hyphenated form
"GitHub Actions-based" so the compound modifier before "npm publish flow" is
grammatically correct.

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

♻️ Duplicate comments (2)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (2)

456-490: ⚠️ Potential issue | 🟠 Major

Specify installer integrity/provenance requirements in MVP publish rules.

This section defines package shape and publish flow but still omits explicit authenticity checks for @noter-md/sync / noter.mjs. Add concrete requirements for provenance/checksum/signature verification and expected failure UX (warn vs fail) before execution.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines
456 - 490, Add explicit installer integrity and provenance requirements for the
suggested package shape: require a signed release artifact for `@noter-md/sync`
(noter.mjs) and publish a verifiable checksum (e.g., SHA256) alongside releases,
document expected verification steps the installer must perform when running
`npx `@noter-md/sync` connect` (verify checksum and signature against repo or
tag-signed metadata), and specify the failure UX policy (treat signature
mismatch or missing provenance as a hard fail by default with an optional
--allow-unsafe flag that only emits a warning when explicitly supplied). Ensure
these rules are added to the "Minimal Publish Shape" and "Suggested release
automation" sections and reference the package name "@noter-md/sync", the
executable "noter.mjs", and the `connect` invocation so reviewers can locate the
change.

7-7: ⚠️ Potential issue | 🟡 Minor

Fix future-dated metadata on Line 7.

Last updated is set to 2026-03-30, but this PR is from March 29, 2026. Please use the actual edit date to avoid audit/date-trace ambiguity.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 7,
Update the "Last updated: 2026-03-30" metadata in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md to the actual
edit date (replace 2026-03-30 with 2026-03-29) so the "Last updated:" line
accurately reflects the PR date and avoids future-dated metadata.
🧹 Nitpick comments (1)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (1)

39-39: Hyphenate compound adjective on Line 39.

Use Short-term instead of Short term.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 39,
Fix the compound adjective on Line 39 of the RFC: change the phrase "Short term,
make the installer origin URL-scoped..." to use a hyphenated compound adjective
"Short-term, make the installer origin URL-scoped..." so the file
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md uses "Short-term"
instead of "Short term".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Around line 456-490: Add explicit installer integrity and provenance
requirements for the suggested package shape: require a signed release artifact
for `@noter-md/sync` (noter.mjs) and publish a verifiable checksum (e.g., SHA256)
alongside releases, document expected verification steps the installer must
perform when running `npx `@noter-md/sync` connect` (verify checksum and signature
against repo or tag-signed metadata), and specify the failure UX policy (treat
signature mismatch or missing provenance as a hard fail by default with an
optional --allow-unsafe flag that only emits a warning when explicitly
supplied). Ensure these rules are added to the "Minimal Publish Shape" and
"Suggested release automation" sections and reference the package name
"@noter-md/sync", the executable "noter.mjs", and the `connect` invocation so
reviewers can locate the change.
- Line 7: Update the "Last updated: 2026-03-30" metadata in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md to the actual
edit date (replace 2026-03-30 with 2026-03-29) so the "Last updated:" line
accurately reflects the PR date and avoids future-dated metadata.

---

Nitpick comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 39: Fix the compound adjective on Line 39 of the RFC: change the phrase
"Short term, make the installer origin URL-scoped..." to use a hyphenated
compound adjective "Short-term, make the installer origin URL-scoped..." so the
file rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md uses
"Short-term" instead of "Short term".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ce931010-7273-48e2-8f47-64e65a0ffbf7

📥 Commits

Reviewing files that changed from the base of the PR and between a4e3e92 and f3170f6.

📒 Files selected for processing (1)
  • rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md

@nicu-chiciuc
nicu-chiciuc force-pushed the codex/noter-sync-installer-rfc branch from f3170f6 to 827c66d Compare March 29, 2026 23:29

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (3)

458-458: ⚠️ Potential issue | 🟡 Minor

Hyphenate “GitHub Actions-based”.

Use the hyphenated form for the compound adjective before npm publish flow.

Suggested edit
-The current `public_ts` repo proves that a GitHub Actions based npm publish flow
+The current `public_ts` repo proves that a GitHub Actions-based npm publish flow
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 458,
The phrase "GitHub Actions based npm publish flow" in the RFC text should be
written as a compound adjective, so update the wording to "GitHub Actions-based
npm publish flow" wherever it appears (e.g., the line containing `public_ts` and
the string "GitHub Actions based npm publish flow") to apply the correct
hyphenation.

7-7: ⚠️ Potential issue | 🟡 Minor

Fix future-dated document metadata.

Last updated is set to 2026-03-30, which is ahead of this PR’s current date context. Please set it to the actual edit date to avoid audit ambiguity.

Suggested edit
-- Last updated: 2026-03-30
+- Last updated: 2026-03-29
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 7,
Update the document metadata line that currently reads "Last updated:
2026-03-30" to the actual edit date for this PR (replace the 2026-03-30 value
with the correct current date) to avoid future-dated metadata; locate the
header/metadata section where "Last updated" appears in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md and change only
that date string so the rest of the document remains unchanged.

456-490: ⚠️ Potential issue | 🟠 Major

Add explicit installer integrity/provenance requirements for MVP.

The publish section defines packaging/release mechanics but still doesn’t require authenticity verification (provenance/signature/checksum + failure behavior). For installer execution, this is an important security requirement to specify in the RFC.

Suggested RFC additions (example)
 ## Minimal Publish Shape

@@
 Recommended reason:

@@
 5. it is much simpler than asking users to copy a local `noter.js` file by hand
+
+Integrity and provenance requirements (MVP):
+
+1. published `@noter-md/sync` artifacts must include verifiable provenance
+   (for example, npm provenance / signed CI release attestations)
+2. the fetched installer payload (`noter.js`) must be version-pinned and
+   checksum-verifiable
+3. docs must show how users/operators can verify artifact authenticity
+4. CLI behavior must define mismatch handling explicitly:
+   - fail closed on checksum/signature mismatch
+   - print actionable remediation steps
+   - never execute unverified payloads
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines
456 - 490, Add explicit installer integrity and provenance requirements to the
"Minimal Publish Shape" / publish section: require that releases of
`@noter-md/sync` (the published package containing noter.js and package.json)
include a machine-verifiable provenance (e.g., detached signature and SHA-256
checksum for noter.js and package.json, and a signed release manifest or
provenance file published alongside the npm artifact), define the install-time
verification algorithm the installer must perform when invoked via "npx
`@noter-md/sync` connect --from https://<current-deploy>/noter.js" (verify
checksum, verify signature chain and trusted key(s), and abort with a clear
error if verification fails), and specify expected failure behavior and
developer key-rotation/compromise procedures to be documented in the RFC.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 39: Change the list item starting with "Short term, make the installer
origin URL-scoped..." to use the hyphenated compound modifier "Short-term"
(i.e., replace "Short term" with "Short-term") so the phrasing is grammatically
correct in the RFC text.

---

Duplicate comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 458: The phrase "GitHub Actions based npm publish flow" in the RFC text
should be written as a compound adjective, so update the wording to "GitHub
Actions-based npm publish flow" wherever it appears (e.g., the line containing
`public_ts` and the string "GitHub Actions based npm publish flow") to apply the
correct hyphenation.
- Line 7: Update the document metadata line that currently reads "Last updated:
2026-03-30" to the actual edit date for this PR (replace the 2026-03-30 value
with the correct current date) to avoid future-dated metadata; locate the
header/metadata section where "Last updated" appears in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md and change only
that date string so the rest of the document remains unchanged.
- Around line 456-490: Add explicit installer integrity and provenance
requirements to the "Minimal Publish Shape" / publish section: require that
releases of `@noter-md/sync` (the published package containing noter.js and
package.json) include a machine-verifiable provenance (e.g., detached signature
and SHA-256 checksum for noter.js and package.json, and a signed release
manifest or provenance file published alongside the npm artifact), define the
install-time verification algorithm the installer must perform when invoked via
"npx `@noter-md/sync` connect --from https://<current-deploy>/noter.js" (verify
checksum, verify signature chain and trusted key(s), and abort with a clear
error if verification fails), and specify expected failure behavior and
developer key-rotation/compromise procedures to be documented in the RFC.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f8afca92-57ca-4597-9998-0c7c12089726

📥 Commits

Reviewing files that changed from the base of the PR and between f3170f6 and 827c66d.

📒 Files selected for processing (1)
  • rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md


1. Do not ask the user to edit a repo `package.json`.
2. Do not make Homebrew the default onboarding path.
3. Short term, make the installer origin URL-scoped so every production deploy

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Hyphenate the compound modifier.

Use Short-term instead of Short term in this list item.

Suggested edit
-3. Short term, make the installer origin URL-scoped so every production deploy
+3. Short-term, make the installer origin URL-scoped so every production deploy
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
3. Short term, make the installer origin URL-scoped so every production deploy
3. Short-term, make the installer origin URL-scoped so every production deploy
🧰 Tools
🪛 LanguageTool

[grammar] ~39-~39: Use a hyphen to join words.
Context: ...ew the default onboarding path. 3. Short term, make the installer origin URL-scop...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 39,
Change the list item starting with "Short term, make the installer origin
URL-scoped..." to use the hyphenated compound modifier "Short-term" (i.e.,
replace "Short term" with "Short-term") so the phrasing is grammatically correct
in the RFC text.

@nicu-chiciuc nicu-chiciuc changed the title [codex] Add noter sync installer RFC [codex] Add deploy-scoped noter sync installer slice Mar 29, 2026

@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: 3060ccf156

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

Comment thread packages/sync/noter.js Outdated
Comment on lines +161 to +165
const child = spawn(openerCommand.command, openerCommand.args, {
detached: true,
stdio: 'ignore',
})
child.unref()

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 Badge Handle browser opener spawn failures without crashing

When the opener binary is missing (for example xdg-open on headless Linux/WSL), spawn(...) emits an asynchronous error event; because openBrowser does not attach an error handler, Node treats it as unhandled and the CLI exits with a runtime error. The surrounding try/catch in main cannot catch this async failure, so npx @noter-md/sync connect --from ... can crash instead of degrading to “copy this URL and open it manually.”

Useful? React with 👍 / 👎.

Comment on lines +38 to +40
try {
return new URL(sourceUrl).origin;
} catch {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject non-http(s) source URLs before deriving deploy origin

resolveDeployOrigin accepts any parseable URL and returns .origin without validating scheme/host, so a link like /machines/connect?source=javascript:alert(1) produces deployOrigin === "null". That value is then used to build the script URL/command, which throws Invalid URL and breaks the connect page for that request. The source param should be validated as an expected http(s) Noter script URL before it is trusted.

Useful? React with 👍 / 👎.

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
apps/noter/src/App.tsx (1)

534-537: Use the shared route constant here too.

The dashboard link, page metadata, and CLI handoff already depend on MACHINE_CONNECT_ROUTE; leaving the router on a literal string adds an easy drift point in the middle of a new public flow.

♻️ Small cleanup
+import { MACHINE_CONNECT_ROUTE } from "@/lib/noterSync";
...
-                  <Route
-                    path="/machines/connect"
-                    element={<MachineConnectPage />}
-                  />
+                  <Route
+                    path={MACHINE_CONNECT_ROUTE}
+                    element={<MachineConnectPage />}
+                  />

As per coding guidelines, "Prefer one explicit source of truth for configuration; if expected env var/config/command is missing, fail with a clear error instead of probing backup names or future-facing alternatives."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/noter/src/App.tsx` around lines 534 - 537, Replace the hard-coded route
string in the Route element with the shared constant: change the path prop from
"/machines/connect" to use MACHINE_CONNECT_ROUTE (i.e.,
path={MACHINE_CONNECT_ROUTE}) for the Route that renders MachineConnectPage;
also add the proper import for MACHINE_CONNECT_ROUTE from its module where other
route constants live so the router uses the single source of truth used by the
dashboard, metadata, and CLI handoff.
apps/noter/public/noter.js (1)

105-110: Use a key-only openedByCli flag.

This introduces a second spelling of the same boolean state (?openedByCli=1 vs ?openedByCli). Please emit it by presence only and let the receiver check has("openedByCli").

♻️ Proposed refactor
 export function buildMachineConnectUrl(args) {
   const machineConnectUrl = new URL(MACHINE_CONNECT_ROUTE, args.sourceUrl);
   machineConnectUrl.searchParams.set("source", args.sourceUrl);
   machineConnectUrl.searchParams.set("installation", args.installationId);
-  machineConnectUrl.searchParams.set("openedByCli", "1");
-  return machineConnectUrl.toString();
+  const separator = machineConnectUrl.search ? "&" : "?";
+  return `${machineConnectUrl.toString()}${separator}openedByCli`;
 }
As per coding guidelines, "For boolean URL query params, prefer key-only flags (e.g. `?diff`) instead of assigning values (`?diff=1`); treat key presence as enabled."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/noter/public/noter.js` around lines 105 - 110, The
buildMachineConnectUrl function currently sets openedByCli as a value pair
("1"); change it to a key-only flag by using URLSearchParams/URL.searchParams to
append the key without a value (e.g., call .set or .append in a way that yields
a key-only param) so the generated URL uses ?openedByCli instead of
?openedByCli=1; update the code that uses MACHINE_CONNECT_ROUTE, args.sourceUrl
and args.installationId to keep those params unchanged and only modify how
openedByCli is emitted so receivers can check
url.searchParams.has("openedByCli").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/noter/e2e/machine-connect-visual.spec.ts`:
- Around line 3-8: In the "machine connect fixture" test (test("machine connect
fixture", async ({ page }) => { ... })), remove the explicit call to
page.setViewportSize({ width: 1280, height: 860 }) so the test uses the shared
Playwright project viewport/presets (e.g., Desktop Chrome) instead of a one-off
size; leave the navigation and waitForLoadState calls intact.

In `@apps/noter/public/noter.js`:
- Around line 49-67: validateSourceUrl currently allows non-canonical URL
variants (user:pass@host, query string, fragment) which leak data; update
validateSourceUrl to reject any URL that contains a username, password, search
(query) or hash (fragment) by checking sourceUrl.username, sourceUrl.password,
sourceUrl.search, and sourceUrl.hash and throwing an Error with a clear message
if any are present; keep the existing protocol/hostname and pathname checks
(NOTER_SYNC_SCRIPT_PATHNAME) but add this additional validation to ensure only
canonical URLs are accepted.
- Around line 153-165: openBrowser currently spawns a child process but doesn't
listen for the child 'error' event or return a Promise, so failures to start the
opener are silent; change export function openBrowser(url) to return a Promise
that calls spawn(openerCommand.command, openerCommand.args, {detached: true,
stdio: "ignore"}) and resolves once the child is successfully spawned (and
detached/unref'ed) and rejects if the child emits an 'error' event, then update
callers to await openBrowser(url) before logging success so the log only happens
on resolved Promise.

In `@packages/sync/noter.js`:
- Around line 105-109: In buildMachineConnectUrl, stop emitting openedByCli=1
and instead add a key-only flag (just ?openedByCli) to the handoff URL: locate
the machineConnectUrl creation (new URL(MACHINE_CONNECT_ROUTE, args.sourceUrl))
and replace the searchParams.set('openedByCli', '1') step with appending the raw
flag token (e.g. add "openedByCli" to machineConnectUrl.search or otherwise
concatenate '?openedByCli' / '&openedByCli' so the URL contains the key without
a value); keep the other params (source and installationId) as-is and update any
related tests/consumers that expect the previous =1 form.
- Around line 153-165: The openBrowser function currently calls
spawn(openerCommand.command, openerCommand.args, ...) and relies on an outer
try/catch, but spawn emits an "error" event on the ChildProcess instead of
throwing; add a child.on('error', ...) handler right after spawn to catch spawn
failures (e.g., missing xdg-open) and invoke the same fallback warning/logging
behavior used in the existing catch block, then return/short-circuit so the
success path (child.unref() and success log) is not executed on error; keep
child.unref() for the normal path and ensure the handler covers both
packages/sync/noter.js and apps/noter/public/noter.js openBrowser
implementations.

---

Nitpick comments:
In `@apps/noter/public/noter.js`:
- Around line 105-110: The buildMachineConnectUrl function currently sets
openedByCli as a value pair ("1"); change it to a key-only flag by using
URLSearchParams/URL.searchParams to append the key without a value (e.g., call
.set or .append in a way that yields a key-only param) so the generated URL uses
?openedByCli instead of ?openedByCli=1; update the code that uses
MACHINE_CONNECT_ROUTE, args.sourceUrl and args.installationId to keep those
params unchanged and only modify how openedByCli is emitted so receivers can
check url.searchParams.has("openedByCli").

In `@apps/noter/src/App.tsx`:
- Around line 534-537: Replace the hard-coded route string in the Route element
with the shared constant: change the path prop from "/machines/connect" to use
MACHINE_CONNECT_ROUTE (i.e., path={MACHINE_CONNECT_ROUTE}) for the Route that
renders MachineConnectPage; also add the proper import for MACHINE_CONNECT_ROUTE
from its module where other route constants live so the router uses the single
source of truth used by the dashboard, metadata, and CLI handoff.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b1fb9576-547b-44d7-98d5-607e5a855afa

📥 Commits

Reviewing files that changed from the base of the PR and between 827c66d and 3060ccf.

⛔ Files ignored due to path filters (1)
  • apps/noter/e2e/machine-connect-visual.spec.ts-snapshots/machine-connect-page.png is excluded by !**/*.png
📒 Files selected for processing (18)
  • apps/noter/e2e/machine-connect-visual.spec.ts
  • apps/noter/public/noter.js
  • apps/noter/src/App.tsx
  • apps/noter/src/components/MachineConnectPage.tsx
  • apps/noter/src/components/MachineConnectVisualFixture.tsx
  • apps/noter/src/components/VaultDashboard.tsx
  • apps/noter/src/components/VaultDashboardChrome.tsx
  • apps/noter/src/components/VaultDashboardVisualFixture.tsx
  • apps/noter/src/lib/noterSync.test.ts
  • apps/noter/src/lib/noterSync.ts
  • apps/noter/src/lib/noterSyncPublicScript.test.ts
  • apps/noter/src/lib/pageMetadata.test.ts
  • apps/noter/src/lib/pageMetadata.ts
  • apps/noter/src/visualFixture.tsx
  • apps/noter/vite.config.ts
  • packages/sync/noter.js
  • packages/sync/noter.test.ts
  • packages/sync/package.json
✅ Files skipped from review due to trivial changes (1)
  • packages/sync/package.json

Comment thread apps/noter/public/noter.js Resolved
Comment thread apps/noter/public/noter.js Resolved
Comment thread packages/sync/noter.js Resolved
Comment thread packages/sync/noter.js Resolved

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/sync/noter.js (1)

165-176: Prefer template literals over array.join for multi-line strings.

As per coding guidelines: "When constructing multi-line JavaScript/TypeScript source snippets, prefer template literals over arrays of one-line strings joined with '\n'."

♻️ Suggested refactor
 export function formatHelpText() {
-  return [
-    'Usage:',
-    '  noter-sync connect [--from https://<current-deploy>/noter.js]',
-    '',
-    'Examples:',
-    '  npx `@noter-md/sync` connect',
-    '  npx `@noter-md/sync` connect --from https://preview.noter.md/noter.js',
-    '  node ./noter.js connect',
-    '  curl -fsSL https://noter.md/noter.js | node --input-type=module - connect --from https://noter.md/noter.js',
-  ].join('\n')
+  return `Usage:
+  noter-sync connect [--from https://<current-deploy>/noter.js]
+
+Examples:
+  npx `@noter-md/sync` connect
+  npx `@noter-md/sync` connect --from https://preview.noter.md/noter.js
+  node ./noter.js connect
+  curl -fsSL https://noter.md/noter.js | node --input-type=module - connect --from https://noter.md/noter.js`
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/sync/noter.js` around lines 165 - 176, The function formatHelpText
currently builds the multi-line help string by returning an array joined with
'\n'; replace that with a single template literal containing the same lines
(preserving spacing and blank line) to follow the guideline. Edit the export
function formatHelpText() to return a backtick-delimited multi-line string
instead of the array.join call so callers receive identical output while using
template literals.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/sync/noter.js`:
- Around line 46-65: validateSourceUrl currently allows URLs containing
username, password, search (query) or hash fragments which can leak credentials
and create duplicate installation records; update validateSourceUrl to
explicitly reject any sourceUrl that has non-empty username, password, search,
or hash components by throwing an Error (similar to the existing
pathname/protocol checks). Locate the function validateSourceUrl and add checks
against sourceUrl.username, sourceUrl.password, sourceUrl.search, and
sourceUrl.hash, producing a clear error message referencing
NOTER_SYNC_SCRIPT_PATHNAME so callers know the URL must be canonical and free of
credentials, queries, or fragments.

---

Nitpick comments:
In `@packages/sync/noter.js`:
- Around line 165-176: The function formatHelpText currently builds the
multi-line help string by returning an array joined with '\n'; replace that with
a single template literal containing the same lines (preserving spacing and
blank line) to follow the guideline. Edit the export function formatHelpText()
to return a backtick-delimited multi-line string instead of the array.join call
so callers receive identical output while using template literals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 74fc47ae-bc76-4415-b26a-2815d54d6823

📥 Commits

Reviewing files that changed from the base of the PR and between 3060ccf and e46ebbd.

⛔ Files ignored due to path filters (1)
  • apps/noter/e2e/machine-connect-visual.spec.ts-snapshots/machine-connect-page.png is excluded by !**/*.png
📒 Files selected for processing (8)
  • apps/noter/public/noter.js
  • apps/noter/src/components/MachineConnectPage.tsx
  • apps/noter/src/components/MachineConnectVisualFixture.tsx
  • apps/noter/src/lib/noterSync.test.ts
  • apps/noter/src/lib/noterSync.ts
  • packages/sync/noter.js
  • packages/sync/noter.test.ts
  • rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md
✅ Files skipped from review due to trivial changes (3)
  • apps/noter/src/components/MachineConnectVisualFixture.tsx
  • apps/noter/src/lib/noterSync.test.ts
  • packages/sync/noter.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/noter/src/lib/noterSync.ts
  • apps/noter/src/components/MachineConnectPage.tsx

Comment thread packages/sync/noter.js Resolved

@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: e46ebbdef3

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

Comment thread packages/sync/noter.js Outdated
Comment on lines +33 to +34
sourceUrl = argv[index + 1] ?? null
index += 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail when --from is provided without a URL

When parseCliArgs sees --from at the end of the command, it assigns null and execution later falls back to DEFAULT_NOTER_SYNC_SOURCE_URL instead of rejecting the input. That means a typo like noter-sync connect --from silently connects against the default deploy, which can misroute preview/local installation flows and is difficult to detect from the CLI output. The parser should throw if --from is missing its required URL argument.

Useful? React with 👍 / 👎.

@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: b94aec12ec

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

Comment thread apps/noter/src/lib/noterSync.ts Outdated
Comment on lines +12 to +15
"# default published package",
"npx @noter-md/sync connect",
"# direct single-file install for this deploy",
`curl -fsSL ${scriptUrl} | node --input-type=module - connect --from ${scriptUrl}`,

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 Badge Copy only one install command from machine connect page

buildNoterSyncConnectCommand returns two runnable shell commands in one string, and MachineConnectPage copies that full string to the clipboard. When a user pastes it into a terminal, the shell executes both installers sequentially (npx and then the direct curl | node fallback), which double-runs bootstrap and can unexpectedly execute the remote script path even if the user intended the default flow only. The copied payload should be a single executable path (or require explicit user choice) to avoid unintended execution.

Useful? React with 👍 / 👎.

@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: 318d49011f

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

Comment thread packages/sync/noter.js Outdated
Comment on lines +148 to +149
? { command: 'cmd', args: ['/c', 'start', '', url] }
: { command: 'xdg-open', args: [url] }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Quote URL when invoking Windows browser opener

buildMachineConnectUrl always produces a query string with &, but the Windows branch calls cmd /c start '' <url> without quoting the URL argument. In cmd, unquoted & splits commands, so the opener can receive a truncated URL (dropping installation/openedByCli) or fail to open correctly on Windows hosts. Please pass a quoted URL to start (for example start "" "<url>") so the full machine-connect URL is preserved.

Useful? React with 👍 / 👎.

@nicu-chiciuc
nicu-chiciuc force-pushed the codex/noter-sync-installer-rfc branch from 318d490 to 6f327c4 Compare March 30, 2026 14:02

@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: 605408b253

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

Comment thread apps/noter/src/lib/noterSync.ts Outdated
Comment on lines +53 to +57
export function resolveMachineConnectScriptOrigin(
sourceUrl: string | null,
fallbackOrigin: string,
): string {
return tryParseNoterSyncSourceUrl(sourceUrl)?.origin ?? fallbackOrigin;

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 Badge Restrict machine-connect source origin to trusted host

resolveMachineConnectScriptOrigin trusts any https://.../noter.js value from the source query param, so a crafted link like /machines/connect?source=https://attacker.example/noter.js will make MachineConnectPage render/copy a command that downloads and executes attacker-controlled code. Because this page is served from a trusted Noter domain, users can be socially engineered into running that command. The source origin should be constrained (for example to the current origin and explicitly allowed preview/local hosts) before it is used to build the install command/link.

Useful? React with 👍 / 👎.

@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: 6cfa1949b5

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

Comment thread apps/noter/noterSyncPublicScript.ts Outdated
Comment on lines +13 to +16
const origin =
args?.devOrigin?.trim() ||
args?.pagesUrl?.trim() ||
DEFAULT_NOTER_SYNC_SOURCE_ORIGIN;

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 Badge Fall back to local deploy origin when source env is missing

When DEV_ENV_ORIGIN and CF_PAGES_URL are unset, this function hard-falls back to https://noter.md, so the dev-served /noter.js is stamped with the production source URL. In the default local/worktree flow (make anon does not export either variable), running curl http://127.0.0.1:5174/noter.js | ... will open and persist state for noter.md instead of the current deploy, which breaks the deploy-scoped behavior this slice is introducing.

Useful? React with 👍 / 👎.

Comment thread apps/noter/src/lib/noterSync.ts Outdated
Comment on lines +49 to +50
export function buildDirectNoterSyncConnectCommand(scriptUrl: string): string {
return `curl -fsSL ${scriptUrl} | node --input-type=module - connect`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make direct installer command fail on curl errors

The generated direct command pipes curl into node without pipefail, so if download fails (DNS/TLS/404/network), node still runs an empty stdin script and exits 0 in typical shells. That creates a silent no-op in the primary “Use this today” path, making onboarding failures hard to detect and diagnose because users do not get a failing exit status.

Useful? React with 👍 / 👎.

@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: f1d29e2936

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

Comment thread apps/noter/src/lib/noterSync.ts Outdated
}

export function buildDirectNoterSyncConnectCommand(scriptUrl: string): string {
return `curl -fsSL ${scriptUrl} | node --input-type=module - connect ${scriptUrl}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Quote installer URL in generated direct shell command

Wrap scriptUrl in shell quotes when building the copyable direct command, otherwise local IPv6 deploy URLs like http://[::1]:5174/noter.js can break in common shells (notably zsh, where [...] is treated as a glob pattern and can error with “no matches found”). This causes the advertised local/worktree bootstrap command to fail before curl runs, even though the URL is explicitly accepted by the source-url validator.

Useful? React with 👍 / 👎.

@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: 1d84f0d787

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

Comment thread packages/sync/noter.js Outdated
Comment on lines +221 to +224
child.once('spawn', () => {
child.off('error', handleError)
child.unref()
resolve()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Detect browser opener exit failures

openBrowser resolves as soon as the child process emits spawn, so main logs “opened machine connect page in your browser” even when the opener immediately exits with a non-zero code (common on headless Linux/WSL where xdg-open exists but cannot launch a browser). In that case the fallback warning path is never triggered, which silently breaks the handoff flow and misleads users about completion.

Useful? React with 👍 / 👎.

@nicu-chiciuc
nicu-chiciuc force-pushed the codex/noter-sync-installer-rfc branch from 1d84f0d to 9d053aa Compare March 30, 2026 17:40

@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: 9d053aa88e

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

Comment thread packages/sync/noter.js
return true
}

return import.meta.url === pathToFileURL(entrypoint).href

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 Badge Resolve bin symlinks before checking direct execution

The isDirectExecution guard compares import.meta.url to pathToFileURL(process.argv[1]), but package-manager bin launches (npx @noter-md/sync connect, node_modules/.bin/noter-sync) run through a symlink path in .bin. In that common path, process.argv[1] is the symlink while import.meta.url resolves to the real file, so this comparison is false and main(...) never runs, causing the CLI to exit without doing anything. This breaks the primary published-package invocation flow.

Useful? React with 👍 / 👎.

@nicu-chiciuc
nicu-chiciuc force-pushed the codex/noter-sync-installer-rfc branch 2 times, most recently from b38f16f to d3b4763 Compare March 30, 2026 19:08
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