Repository navigation
fix(start-os): update re-added SSH keys in place and publish them to patch-db - #4757
Conversation
StartOS stores SSH keys by MD5 fingerprint, so adding a key that was already authorized silently replaced the stored entry. The UI then listed the returned key a second time, and removing either row deleted the single stored entry, so both rows disappeared. ssh.add now refuses a key whose fingerprint is already stored with a Duplicate error that carries the existing key's details as its info. The SSH page catches that error and opens a dialog naming the existing key by hostname, algorithm, fingerprint and creation date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Seems like we should update the key in place without updating timestamps. And move it to the public section of patch-db so that the frontend and backend aren't out of sync |
helix-white
left a comment
There was a problem hiding this comment.
Requesting changes on eaf689b99a0827fe367a1c1ca0da5ea61442f2fe.
-
Preserve in-place updates and retryability. The duplicate branch in
shared-libs/crates/start-core/src/ssh.rsprevents the update-without-timestamp-reset requested by @dr-bonez. It also introduces a recovery regression:addcommits the DB entry beforesync_pubkeyswritesauthorized_keys. If that write fails, a retry now returnsDuplicatebefore attempting the write, leaving a stored key unusable until another operation or restart repairs the file. Replace the existing key value while retaining both timestamps, then perform the usual sync. -
Make the displayed collection follow the authoritative state. The SSH page still combines a one-time
ssh.listresponse with locally maintained arrays. Changes fromstart-clior another browser remain invisible to an open page. The requested public PatchDB collection and subscribed UI are still missing. The proposal moves authorized public keys only, retaining the SSH private key underprivate, updates boot/add/remove/list callers, and supplies an idempotent migration with a same-version migration-revision bump and downgrade support. The UI refreshes the existing server-ownedSshKeyResponseprojection on key changes/reconnection rather than duplicating OpenSSH parsing in browser production code or maintaining another list. -
Resolve the base conflicts.
git merge-tree --write-tree origin/master HEADfails for all five dictionaries (en.ts,de.ts,es.ts,fr.ts,pl.ts) undershared-libs/ts-modules/shared/src/i18n/dictionaries/. Merge currentorigin/masterbefore re-requesting review. Removing the duplicate-only dialog/translations in the proposal eliminates those collisions; its source tree merges cleanly with the base inspected here.
The proposal includes timestamp/retry and migration regression cases, mock updates, the revised changelog, and the timestamp/ownership contracts at their production owners. It also removes the obsolete commented-out SSH command declaration. On adoption, update the PR title/description to describe in-place updates and synchronized state, preserving the author's attribution.
This is an unexecuted source proposal: no builds, tests, typechecks or formatters were run. Generated TypeScript bindings are intentionally not regenerated during review; regeneration and verification belong to the implementing author. Existing head CI has successful automated tests, formatting and generated-artifact checks; the riscv64 image job was cancelled, so not every check succeeded.
Proposed changes: eaf689b...proposal/4757
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
…patch-db Helix-Harness: claude-code Helix-Model: claude-opus-5-5
… authorized_keys writer Helix-Harness: claude-code Helix-Model: claude-opus-5-5
…e-ssh-key Helix-Harness: claude-code Helix-Model: claude-opus-5-5
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
Dismissed by Helix: the changes require a substantive PR brief update. The reviewed implementation rejected existing fingerprints with a Duplicate error and matching-key dialog. The new implementation instead updates keys successfully while preserving both timestamps and retrying authorized_keys synchronization. It also moves authorized keys into public PatchDB with migration/revision handling and replaces the local UI list with live refreshes. These changes require a substantively different behavior, storage, rollout, and synchronization explanation; they are PR-owned changes, not merely imported master changes.
|
The previous cross-review was retired. Review the updated PR again. |
|
@dr-bonez done: re-adding a key now updates it in place, and the authorized keys live in @helix-white, I adopted your proposal as-is (160e11c, under your authorship) and added:
Verified: |
helix-white
left a comment
There was a problem hiding this comment.
Approved at b1db4b330942e71f8bdaaaebea3c8c5538de2132. The earlier findings are addressed, and git merge-tree confirms a clean merge with current master.
Re-adding an SSH key now replaces its value/comment without changing either stored timestamp. Retrying after a failed authorized_keys write reaches the writer again rather than returning Duplicate. Boot-time synchronization reuses that same writer.
Data model and rollout: Public.sshPubkeys replaces Private.sshPubkeys, with an empty default for new databases and generated SshKeys bindings. Existing key values and timestamps move before startup reads them. Migration revision 1 makes existing 0.4.3 RC installations run the migration; its inverse restores the private path. Default authenticated database subscribers now receive the authorized public-key bodies and timestamps. The SSH private key remains private, and the ordinary SSH RPC request/response shapes remain unchanged. Directly booting an older same-version RC against this migrated database is not covered by the inverse version migration.
The page replaces its locally maintained list with PatchDB-driven refreshes and reconnect refreshes. It reuses ssh.list for display conversion, costing one read per observed collection change/reconnection rather than duplicating OpenSSH parsing. The presentation is unchanged, so screenshots are not required.
The obsolete commented-out SSH command declaration is also removed.
Implementation diff: +199 / −65 lines in 14 files (excludes lockfiles, tests, docs, release notes, and changelog).
Verification: The author records successful start-core tests covering timestamp preservation, failed-sync retry, migration round-trip and same-version migration, plus shared/UI/i18n checks, binding regeneration and Rust formatting. At inspection, CI formatting/lockfiles, changelog/version checks and SDK/runtime/script tests passed; Rust tests, generated bindings/MCP and architecture builds were still running. No builds or tests were run during this review, and no live-browser end-to-end result is recorded.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
|
Rechecked the review request: the head is still |
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
|
Done in 8bbb739: re-adding a key now sets |
Dismissed by Helix: the changes require a substantive PR brief update. Re-adding an existing SSH key now advances its persisted updated_at timestamp via WithTimeData::DerefMut while preserving created_at. The approved implementation and review brief guaranteed that both timestamps remained unchanged. That substantive timestamp guarantee must change, regardless of the already-updated description. The mock, regression test and changelog reflect this PR-owned behavior change; it is not an imported master change.
|
The previous cross-review was retired. Review the updated PR again. |
helix-white
left a comment
There was a problem hiding this comment.
Approved at 8bbb739bcb4b64ad0464244ea1acf3edec21345f. The revised implementation is internally consistent, and the merge check against current master is clean.
Timestamp policy for final review: this revision preserves created_at but refreshes updated_at on every re-add, including identical keys and retries. It intentionally differs from my previous approval, which covered preserving both timestamps. Flagging that narrower guarantee for @dr-bonez's judgment against the original “without updating timestamps” wording. The earlier-RC rollback decision already raised in the PR brief also remains: an older same-version RC expects the removed private collection and cannot directly load the migrated database.
Re-adding a fingerprint replaces its key/comment without creating another row. Model<SshKeys>::authorize now reuses WithTimeData::DerefMut for the update timestamp instead of duplicating that rule. The changed test and mock match this behavior. A retry after a failed authorized_keys write still reaches the writer, and boot-time synchronization shares that writer.
Data model: authorized keys move to default-empty Public.sshPubkeys, with generated SshKeys bindings and unchanged entry format { created_at, updated_at, value }. Migration revision 1 runs the move before typed startup reads, including existing 0.4.3 RC databases, and supplies an inverse move. Default authenticated PatchDB subscribers receive the public-key lines and timestamps; the SSH private key stays private. Ordinary SSH RPC request/response shapes remain unchanged.
The unchanged-looking page refreshes its server-owned ssh.list projection on collection changes and reconnection, avoiding both a locally maintained list and duplicated OpenSSH parsing. This costs a list RPC per observed change/reconnection. The obsolete commented command declaration is removed. No screenshots are required for the unchanged presentation.
Implementation diff: +200 / −65 lines in 14 files (excludes lockfiles, tests, docs, release notes, and changelog).
Verification: the author records 1,875 passing start-core tests on this head, including the updated timestamp case, failed-sync retry, migration round-trip and same-version migration, plus passing shared/UI/i18n checks. CI formatting/lockfiles, changelog/version checks, SDK/runtime/script tests and rpc-toolkit/visit-rs/backup-fs tests passed at inspection; core/WRT tests, generated bindings/MCP and architecture builds were still running. No builds or tests were run during review. Live browser refresh and a real RC upgrade remain unexercised end to end in the recorded evidence.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
|
CI: |
…e-ssh-key Helix-Harness: claude-code Helix-Model: claude-opus-5-5 # Conflicts: # shared-libs/crates/start-core/src/version/v0_4_3.rs
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
|
Pushed
Verified: |
helix-white
left a comment
There was a problem hiding this comment.
Approved at edcdbac9e7ef9bebd7693f9765fca9c3c89f922e. No new correctness findings; the merge check against current master is clean.
For final maintainer judgment: re-adds preserve created_at but advance updated_at, including identical keys and retries. This still differs from the original “without updating timestamps” request; preserving both timestamps remains the alternative. Direct rollback to an earlier same-version 0.4.3 RC also remains broken: the older model requires the removed private collection, and equal versions do not run the down-migration. Retaining a private compatibility copy would preserve that rollback at the cost of duplicated, potentially stale state. Downgrades to 0.4.2.2 or earlier run the inverse move.
Behavior and data: reauthorization replaces the existing fingerprint's key/comment and always reaches authorized_keys synchronization, allowing recovery after a failed write. Public.sshPubkeys replaces Private.sshPubkeys, defaults to empty, and retains the fingerprint → { created_at, updated_at, value } representation. Generated bindings expose this collection; ordinary SSH RPC shapes remain unchanged. Authenticated PatchDB subscribers now receive the public-key lines/comments and timestamps, which those sessions could already read through ssh.list. The private key remains private.
The migration merge retains both the SSH move and #4666's range-address repair. Revision 2, rather than 1, correctly makes databases already migrated by #4666 run the SSH move before typed decoding. Both steps remain idempotent, and the updated same-version regression starts from revision 1.
The page uses PatchDB changes and reconnection to refresh the existing server-owned ssh.list projection, avoiding a second maintained list and browser OpenSSH parsing. This costs one list RPC per observed change/reconnection. Presentation is unchanged, so screenshots are unnecessary. Boot-time sync shares the authorized_keys writer, and the obsolete commented command declaration is removed.
Additional image-build fix: clearing .build/chroot_archives before each existing lb chroot attempt restores local archive bindings after live-build cleanup. I checked live-build 1:20250505+deb13u1 source: its exit handler unmounts chroot filesystems without clearing this marker, while archive installation skips completed markers before binding local sources. The wrapper repairs that mismatch without forcing unrelated completed stages or changing retry limits.
Implementation diff: +204 / −66 lines in 15 files (excludes lockfiles, tests, docs, release notes, and changelog).
Verification: the author records 1,883 passing start-core tests on the updated head, including SSH retry/timestamp cases, migration round-trip, revision-1 startup migration and the retained range tests. Recorded shared/UI/i18n checks, the updated DNS recipe check and kernel-backports tests pass. Current CI formatting/lockfiles, changelog/version and SDK/runtime/script checks have passed; core/WRT and rpc-toolkit/visit-rs/backup-fs tests, generated bindings/MCP, cross-platform builds and image validation remain pending. No builds or tests were run during review. A real RC upgrade, live browser refresh and a deliberately failed/retried image build are not covered by the recorded end-to-end evidence.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Dismissed by Helix: the changes require a substantive PR brief update. The PR adds image-build recovery by clearing .build/chroot_archives before each lb chroot attempt, changing retry behavior and expanding scope beyond the approved SSH explanation. It also advances the SSH migration from revision 1 to 2 so databases already on #4666's revision 1 execute the key move, requiring a substantive rollout update. These are actual PR-owned changes, not merely imported master changes or bookkeeping.
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
|
Per @dr-bonez, the SSH page no longer calls |
Dismissed by Helix: the changes require a substantive PR brief update. The SSH page replaces PatchDB-triggered ssh.list refreshes with direct PatchDB rendering and browser-side sshKeyRows conversion. Per-change/reconnect list RPCs disappear, and display conversion moves into the browser, shared with mocks. The approved brief explicitly described server-owned conversion without browser parsing and one RPC per change/reconnect; those substantive approach and runtime-cost facts must change. This is a PR-owned change, with no intervening base merge or retarget.
Helix-Harness: pi Helix-Model: openai-codex/gpt-6.1-sol
helix-white
left a comment
There was a problem hiding this comment.
Requesting changes on 3a2cd92ca0c5e28aec84e7ed83b04cf9869df813. Direct PatchDB rendering is a reasonable replacement for the list RPC, but two reachable cases regress.
-
Preserve keys with
authorized_keysoptions.utils/ssh-keys.tsassumes the algorithm is the first word. However,ssh.addacceptsSshPubKeythroughopenssh-keys::PublicKey::parse, which supports options, and its serializer retains them. A key added through the CLI/API asrestrict ssh-ed25519 <base64> laptoptherefore reaches PatchDB in that form. The page now displays algorithmrestrictand hostname<base64> laptop; the previousssh.listprojection returnedssh-ed25519andlaptop. Quotedcommand="…"options also contain spaces, so dropping one leading word is insufficient. The proposal makes the shared row converter recognize the key fields after quoted/escaped options, retaining the comment unchanged. The mock backend continues to reuse it. -
Keep old browser snapshots from terminating the page's signal.
PatchDbSourceemits its IndexedDB cache before live updates. A nonzero-revision snapshot saved before this feature lackssshPubkeys;PatchDB.watch$accepts that revision and emitsundefinedfor the missing path. Authentication/routing does not wait for live PatchDB, so opening the SSH route during reconnection can pass that value toObject.entries. The resulting error terminates the stream and is retained bytoSignal, rather than recovering when the live collection arrives. The proposal filters the absent collection before conversion, preserving the loading state until it exists; an actual empty collection still renders an empty list.
Both format/cache contracts are recorded beside their production owners. The proposal adds focused cases for bare keys, restrictions, quoted/escaped commands, comment whitespace, empty collections and a real PatchDB/Angular-signal transition from an older snapshot through live data and removal. These are unexecuted source proposals: no builds, tests, typechecks or formatters were run during review; verification of adopted changes belongs to the implementing author.
The merge check against current master is clean. Current head CI formatting/lockfiles, changelog/version and SDK/runtime/script checks pass; Rust tests, generated bindings/MCP and architecture builds remain pending. These findings come from the production paths, not pending CI.
Proposed changes: 3a2cd92...proposal/4757
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
…ys collection Helix-Harness: claude-code Helix-Model: claude-opus-5-5
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
|
Adopted both points as proposed (14af2ae, under @helix-white's authorship), plus a Prettier pass (5d92bc4):
Verified: |
helix-white
left a comment
There was a problem hiding this comment.
Approved at 5d92bc4b1276a8ee0029e807fa611abc45a65f37. Both requested corrections are adopted, with their contracts and regression cases. The remaining differences from my proposal are formatting-only, and the merge check against current master is clean.
For final maintainer judgment: re-adds preserve created_at but advance updated_at, including identical keys and retries; this differs from the original “without updating timestamps” wording. Direct rollback to earlier same-version 0.4.3 RCs also remains unsupported: those builds require the removed private collection, and equal versions do not invoke the down-migration. Preserving both timestamps and retaining a private compatibility copy are the respective alternatives; the latter reintroduces duplicated state. Downgrades to 0.4.2.2 or earlier run the inverse move.
Reauthorizing an existing fingerprint replaces its key/comment without creating another row and still rewrites authorized_keys. Retrying after a failed file write therefore remains possible. Boot-time synchronization reuses the same writer; the obsolete commented command declaration is removed.
Data and rollout: default-empty Public.sshPubkeys replaces Private.sshPubkeys, retaining fingerprint → { created_at, updated_at, value }, with an OpenSSH line as the value. Generated bindings expose the collection. Authenticated PatchDB subscribers receive full public-key lines, options/comments and timestamps; the private key stays private. One description correction: ssh.list already returned algorithm, fingerprint, comment and creation time, but not the full key line, options or updated_at. Its existing visibility therefore does not cover every newly published field. Ordinary SSH RPC request/response shapes are unchanged. Migration revision 2 moves existing keys before typed decoding, including servers already at #4666's revision 1, and retains that version's idempotent range-address repair.
UI approach: the page renders directly from PatchDB, with no ssh.list refresh RPCs or separately maintained list. Browser-side sshKeyRows supplies display fields and is shared with the mock backend; CLI callers retain the server's ssh.list projection. The converter now handles leading restrictions and quoted/escaped options without mistaking them for the algorithm or hostname. An older cached snapshot without the collection keeps the existing loading state until live data arrives; an empty collection renders empty. These two corrections came from my review proposal. Presentation is otherwise unchanged, so screenshots are unnecessary.
Additional image-build fix: clearing .build/chroot_archives before each lb chroot attempt makes live-build bind local archives again after failure cleanup, rather than incorrectly trusting its retained completion marker. Retry limits and unrelated completed stages are unchanged.
Implementation diff: +175 / −66 lines in 15 files (excludes lockfiles, tests, docs, release notes, and changelog).
Verification: the author reports successful UI typechecking and 289 UI script tests, including seven new SSH cases covering options, comment preservation, empty collections and a real PatchDB/Angular-signal transition from an older snapshot through live data and removal. The unchanged backend has recorded coverage from 1,883 passing tests, including retry/timestamp and migration cases; shared/i18n, DNS-recipe and kernel-backports checks also have recorded passing results. Current CI Prettier, conflict scanning and dependency-license checks pass; Rust/UI/script suites, formatting/lockfiles, changelog/version checks, generated bindings/MCP and architecture/image validation are still pending. No builds or tests were run during review. A live RC upgrade, browser-session synchronization and a deliberately failed/retried image build remain unexercised end to end in the recorded evidence.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Dismissed by Helix: the changes require a substantive PR brief update. The PR now parses key types/comments after leading quoted or escaped authorized_keys options, replacing the reviewed first-word parsing behavior. It also filters missing sshPubkeys from older browser snapshots, replacing a terminal signal error with loading followed by live rendering. These implemented fixes require substantive updates to the accepted-key parsing and upgrade-cache lifecycle explanations, independently of formatting, tests, CI status or bookkeeping. No intervening base merge or retarget accounts for these PR-owned changes.
Decision before merge: going back to an earlier 0.4.3 RC. Once this build has run, an earlier
0.4.3-rc.*started on the same disk will refuse to load its database. Both report version 0.4.3, so no downgrade migration runs between them, and the earlier RC'sPrivatemodel requiresprivate.sshPubkeys, which this build has moved. Downgrading to 0.4.2.2 or earlier is unaffected, because the 0.4.3 down-migration moves the keys back. The alternative is to also leave a copy inprivate.sshPubkeysuntil 0.4.3 ships. That costs a second copy that can go stale, which is what this PR removes. Is breaking a rollback to earlier RCs acceptable?Summary
created_at, and setsupdated_atto the time of the re-add. It then rewritesauthorized_keysas for a new key. Before, the server overwrote the entry with fresh timestamps, and the UI appended the returned key to its local list, so one fingerprint showed as two rows and removing either removed both.authorized_keyswrite repairs the file. An earlier revision of this PR rejected duplicates, which would have left that file unrepairable until another change.ssh.list. It renders straight fromsshPubkeysin PatchDB, so changes fromstart-clior another browser show without a reload. The page looks the same.lb chrootfailed on a transient download error, its retries could never succeed. live-build's failure cleanup unmounts the local kernel-backports repository from the build environment but keeps thechroot_archives"done" marker, so the retry skipped re-mounting it and failed withFile not found. This PR'sImage (x86_64-nonfree)job failed this way after aConnection reset by peerfrom deb.debian.org.build.shnow clears that marker before eachlb chrootattempt, so a retry mounts the repository again. Thebinary_*steps don't need this, because they don't unmount anything when they fail.sync_keys(boot-time sync) now callssync_pubkeysinstead of keeping a second copy of theauthorized_keyswriter. A commented-out command declaration inssh.rsis removed.Implementation diff: +183 / −68 lines in 15 files (excludes lockfiles, tests, docs, release notes, and changelog). 37 of those added lines are regenerated TS bindings in 2 files.
Data model
publicgainssshPubkeys(SshKeys, defaulting to empty), andprivate.sshPubkeysis removed. The entry format is unchanged: a map from MD5 fingerprint to{ created_at, updated_at, value }, wherevalueis the OpenSSH public-key line. These field names are snake_case, unlike their camelCase neighbours, because the existingWithTimeDatastorage type is reused.SshKeysand includesshPubkeysonPublic. The request and response shapes ofssh.add,ssh.listandssh.removeare unchanged.privatetopublicbefore startup reads the database. It then runs the existing range-address fix from fix(core): keep a range's public IP on with its plain public domain across a renumber #4666. The migration revision goes to 2. fix(core): keep a range's public IP on with its plain public domain across a renumber #4666 already used revision 1, so 2 makes servers that have fix(core): keep a range's public IP on with its plain public domain across a renumber #4666's revision 1 run the move as well. Both steps do nothing when run again, and the down-migration moves the keys back.Exposure: every authenticated PatchDB subscriber, meaning each logged-in UI session, now receives the authorized public keys and their comments, which are usually
user@host. The same sessions could already read them throughssh.list. The SSH private key stays inprivate.Approach
sshKeyRows(utils/ssh-keys.ts). It skips any leadingauthorized_keysoptions, such asrestrictor a quotedcommand="…", whichssh.addaccepts and stores. It then takes the key type as the algorithm and the comment after the key data as the hostname. UntilsshPubkeysarrives, the page shows its loading state, because a browser's cached PatchDB snapshot from before this change has no such collection. The options parsing and the cached-snapshot handling came from @helix-white's review. The mock backend uses the same helper. The alternative was storingalgandhostnameas fields insshPubkeys, which would duplicate data already in the key line and need a format-changing migration.ssh.liststill does the same conversion on the server forstart-cli. (The in-place update came from @helix-white's review proposal.)Model<SshKeys>::authorize, whichssh.addcalls.Testing
make start-core-test(dev profile) on this head: 1883 passed, 0 failed, including fix(core): keep a range's public IP on with its plain public domain across a renumber #4666's migration tests next to the SSH ones. This includes new tests that:updated_atbut keepscreated_at;authorized_keyswrite rewrites the file;publicobject now includesshPubkeys.npm run check:shared,check:ui(typecheck plus 289 UI script tests, including newsshKeyRowscases for bare keys,restrict, multiple options, quoted and escaped commands, and keys without comments, and a PatchDB test that goes from an older cached snapshot to live keys to removal) andcheck:i18npass against the regenerated bindings, and Prettier 3.8.3 accepts the changed UI files.lb_chrootstep) andmake start-os-kernel-backports-testpass. A real retry oflb chrootafter a download failure was not reproduced; the fix follows live-build 1:20250505+deb13u1'sExithandler andchroot_archivesstagefile.5d92bc4b1is running, including all image builds andGenerated Bindings & MCP Catalog.Helix-Harness: claude-code
Helix-Model: claude-opus-5-5