Repository navigation
Sync upstream dev - #4
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
fs.exists is not a function on node:fs/promises (there is no promises-based exists). This will throw at runtime and break embedded UI serving. Use an fs.access/stat check (catching ENOENT) or reuse the repository's existing filesystem helper if available.
| try { | |
| await fs.access(match) | |
| const mime = getMimeType(match) ?? "text/plain" | |
| c.header("Content-Type", mime) | |
| if (mime.startsWith("text/html")) { | |
| c.header("Content-Security-Policy", DEFAULT_CSP) | |
| } | |
| return c.body(new Uint8Array(await fs.readFile(match))) | |
| } catch { |
There was a problem hiding this comment.
Passing credentials via auth_token query param is risky (URLs get logged, stored in browser history, proxies, etc.) and mutating c.req.raw.headers may not be reliable if the underlying Request headers are immutable. Prefer requiring the Authorization header only, or (if this is required for a specific client) accept the token via a dedicated header and avoid rewriting the raw headers; alternatively, construct a new Request with merged headers and forward that.
There was a problem hiding this comment.
The package name is now finny-... but the installed binary name is still opencode/opencode.exe. If the published artifact/binary is also renamed as part of the rebrand, this will fail to locate the executable after install. Align binaryName with the actual packaged binary (or keep package naming consistent with opencode-*).
There was a problem hiding this comment.
unref currently returns an Effect from inside another Effect.sync, producing a nested effect value that callers are unlikely to execute. If the intended API is 'unref and return a re-ref finalizer', return a plain function (or an Effect that performs both sides via acquireRelease), but avoid returning Effect.sync(...) from within Effect.sync(...).
| return () => { | |
| if (!ref) { | |
| proc.ref() | |
| ref = true | |
| } | |
| } |
There was a problem hiding this comment.
Shipping a hard-coded Convex deployment URL as a fallback can unintentionally route user data to an unexpected environment when CONVEX_URL is unset/misconfigured. Consider requiring CONVEX_URL (fail fast with a clear error) or defaulting to a local/dev URL only when NODE_ENV !== 'production' / Installation.isLocal().
| const url = process.env.CONVEX_URL?.trim() | |
| if (!url) { | |
| throw new Error( | |
| "Missing required CONVEX_URL environment variable. Refusing to use a hard-coded Convex deployment URL.", | |
| ) | |
| } |
There was a problem hiding this comment.
The displayed version string is hard-coded, which will drift from the real Installation.VERSION after future releases. Consider generating this string at runtime (or during build) from the same version source used elsewhere so the CLI always reports the correct version.
There was a problem hiding this comment.
crypto.randomUUID() is used without importing crypto. This will fail in runtimes where crypto isn't a global (and may also be a typecheck issue depending on TS lib settings). Import crypto from node:crypto (or crypto) or use globalThis.crypto explicitly with appropriate runtime guarantees.
There was a problem hiding this comment.
This file is marked as auto-generated. Committing generated Convex _generated/* artifacts often causes noisy diffs and merge conflicts. If not strictly required for your build/deploy flow, consider adding convex/_generated/ to .gitignore and generating it in CI/build steps instead (or documenting why it must be committed).
There was a problem hiding this comment.
The PR title/description indicate an upstream sync, but this diff includes a broad rebrand (opencode → finny) and substantial new product functionality (Convex storage, algorithm tools, licensing, UI routes). If this PR is intended to be a pure upstream sync, these changes should be split into separate PRs; if the scope is intentionally broader, the PR description should be updated to reflect the rebrand and feature additions.
Fixes all 17 Copilot comments: Telemetry opt-out (#1, #2, #3, #9, #16): - tracker.ts now reads FINNY_TELEMETRY=0 / OPENCODE_TELEMETRY=0 at module load, so the opt-out applies in every entrypoint (TUI worker, server, CLI), not just the bootstrap path. - Email dialog auto-prompt and /subscribe slash command also gated on Analytics.isEnabled() — email POST goes to the same Convex deployment. Tracker correctness (#5, #14, #17): - drain() now also waits for the DeviceProfile.userId() resolution promise, not just the post-send promise. - worker rpc.shutdown() and main-thread thread.ts both call Analytics.drain() before tearing down — neither beforeExit nor SIGTERM fire on worker.terminate() / process.exit(0). - beforeExit handler runs at most once per process, preventing an infinite drain loop when a hung telemetry request later resolves and re-empties the loop. Privacy (#10, #11, #12): - Drop process.argv from tui.worker.booted (could include --prompt text and project paths). - error.surfaced now sends only error.name; error messages frequently embed user prompt content and local file paths. - Don't persist the submitted email address to local KV (no reader, just unnecessary PII retention). Email dialog state machine (#4, #6, #8): - Wait for kv.ready before evaluating the prompt gate so we don't re-show the dialog to users who already submitted/skipped. - Conditional dismiss handler — only marks "skipped" when no terminal status has been set, so a successful submit isn't overwritten by the dismiss callback that fires on dialog.clear() and isn't suppressed by another dialog replacing this one. Server-side validation (#15): - subscribe mutation now rejects empty / oversized / regex-failing emails with a ConvexError, so the public Convex client can't bypass the TUI regex. Command coverage (#13): - Hook Analytics.track() in DialogCommand.trigger() instead of the bus event handler. trigger() is the central activation point for palette, slash, keybind, plugin, and bus paths — single hook, full coverage, no double-counting. Comment wording (#7): - bootstrap.ts: "opt-in by default" → "enabled by default" (correct description of opt-out semantics). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Tracker correctness (#4 in this round): - track() now wraps the userId lookup AND the convex round-trip in a single tracked promise that drain() can race on. Previously the outer promise resolved as soon as DeviceProfile.userId() finished because send() returned void, so a fast shutdown could snapshot inFlight before the actual mutation settled and drop the event. Privacy hardening: - app.launched: drop args.agent (user-defined name) → hasAgent boolean. - session.created: drop projectId (stable repo identifier). - agent.run: drop model identifier (provider/model can be plugin- or custom-config-supplied). Keep mode — closed string union, not user data. - command.executed: drop raw command name (plugin-controlled) → send only option.category plus a builtin/plugin bit. Command coverage: - Wrap each option.onSelect once in entries() so analytics fires identically across palette / slash / keybind / plugin / bus paths. Removes the gap where DialogSelect's direct option.onSelect call and the keybind useKeyboard handler bypassed the previous hook. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
#1 Always return JSON from algorithm-list. The empty-state branch previously returned a plain English string while the populated branch returned JSON; now both branches return the same shape so any caller can parse the output uniformly. #2 Normalize capacity / remaining to (number | null) everywhere. The structured body and the metadata field both use null for unlimited tiers — no more Number.POSITIVE_INFINITY in metadata silently coercing to null when serialized for logs/telemetry. #3 Tests for buildAlgorithmListPayload — extracted as a pure helper so the dedupe-by-name, latest-version-wins, capacity reporting, and JSON-roundtrip behavior can be exercised without spinning up Convex or the Plan service. #4 Tests for countUniqueAlgorithms — the cap-check helper extracted from algorithm-save. Covers the orphan-row scenario (duplicate names not consuming extra cap slots) and the at-cap boundary condition that blocks new saves.
Issue for this PR
Closes #
Type of change
What does this PR do?
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.