You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(account): read the socket table again when one read misses the confirm page's caller - #4867
The PC's local confirm page (server/account/local-confirm.ts) only answers this PC's own user. It finds the caller's uid in /proc/net/tcp. It used to read that table once. The kernel serves the file one page per read() and resumes by position. So while other sockets open and close, a single read can miss the caller's live row (or show it twice). When that happened, the page refused the owner with 403 Open this page as this PC's own user.
That is the main CI failure in run 45894193621 (1b0066f): server/account/lock.contract.test.ts:349, a standing lock remains owner-unlockable after identity_reset via terminal, Expected 200, Received 403. It is a flake, not a regression from a recent merge. The test and the confirm code have not changed since #4435. Among the last 60 failed CI runs, it appears only in that one. The next main run (9f1c5c9) was green.
Fix
peerUidOnLinux now reads the table up to 3 times and returns the first read that finds exactly one row on the caller's ends.
A read that misses the row, or shows it twice for the same user, is read again.
A read that shows rows on those ends naming different users is final: nobody (review finding, second commit).
A unique foreign uid is returned as-is, and the page refuses it.
A re-read only asks the kernel again. A row that is not there is never found, so a re-read admits no one a correct single read would refuse.
Evidence
The repro ran in the CI runner image, the same way the P620 runners run integration: docker run --cpus 4 herdr-ci-runner:local, own network namespace, 8 copies of bun test server/account/lock.contract.test.ts -t "via terminal" at once, repeated.
origin/main 9f1c5c9: 14 of 1600 runs failed, all on the terminal-unlock cases, at both the confirm page GET and the POST. A second run failed 3 of 352.
Instrumented origin/main (throwaway logging, not in this PR): every refusal was the peer-uid check. The first lookup returned null and an immediate re-read returned 1000. The row was there: 0100007F:BC26 0100007F:A2DD 01 ... 1000.
This branch: 0 of 1600 (first commit, with the final commit for the later rounds) and 0 of 800 on the final head.
New unit test Q20: a read of the socket table that missed the live row ... fails on origin/main and passes here.
bun run typecheck passes. bun test server/account/local-confirm.test.ts passes: 32 pass.
Reviews
omo gate: BLOCK on one MEDIUM. A read whose rows name two users could be passed by a later read. Fixed in the second commit, with that sequence added to the test. Its LOW (no separate code-review report) is noted here.
Codex (gpt-6.2-sol-fast, xhigh): CLEAR. LOWs:
Three reads can still all miss under sustained churn. An exact NETLINK_SOCK_DIAG lookup would avoid the table walk, but that is a larger change.
A re-read slightly widens the existing window in which a torn-down tuple could be reused before the lookup ends.
The changelog wording was softened to match.
Validation
bun run check fast on the final head 90236c9: passed (workflow syntax, generated types/themes, typecheck, build, unit tests).
The CI-image repro above for the integration contract; the full integration and browser suites run in CI.
…nfirm page's caller
The local confirm page checks its caller's uid in /proc/net/tcp. The kernel
hands that file out a page per read and resumes by position, so while other
sockets come and go one read can miss the live row (or show it twice), and
the page refused this PC's own user with 403. That flaked
server/account/lock.contract.test.ts on main (run 45894193621).
Read the table up to three times; a row that is not there is never found,
so a re-read admits no one the first read would not.
… not read again
Review (gate): a read showing two rows on the caller's exact ends with
different uids used to refuse; with the re-read a later read could pass.
Such a read is now an answer (nobody). Only a missed row, or one shown
twice for the same user, is read again.
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
ovis confirm now retries when the system’s connection list does not show the PC’s own user. This helps confirmation proceed when the connection information is briefly missing, instead of immediately asking you to open the page as that user. If the connection information remains unavailable or identifies conflicting users, confirmation still cannot determine the user.
The Linux local confirmation lookup now retries socket-table reads up to three times when a read does not identify exactly one matching peer UID. Tests cover retry and immediate-result cases. A changelog entry records the confirmation behavior.
Changes: Local confirmation peer UID lookup
Layer / File(s)
Summary
Socket-row matching and retry server/account/local-confirm.ts, server/account/local-confirm.test.ts, changelog.d/confirm-page-own-user.md
The table lookup returns a UID only when exactly one matching row has a valid UID. The Linux lookup retries up to three times when no unique UID is found. Tests cover retry, missing rows, and conflicting users. The changelog describes the confirmation behavior when the connection list omits the PC’s own user.
devswha/ovis#4277: Introduced the local confirmation path and its socket-table caller check, which this change modifies.
devswha/ovis#4283: Defined the exact socket-row matching behavior that this change extends with retries.
Merge Risk: Minimal · previous review 90236
The change makes the local confirmation page more reliable when a single read of the socket table misses the caller's row. Foreign users are still refused. No actionable merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the socket table is read again when one read misses the confirm page's caller. It is specific to the fix, under 72 characters for the subject line, and matches the cha…
Description check
The description covers the problem, the fix, the reviews, and validation. It follows the template's Change and Validation sections in substance. The Change section explains the bug and the resulting 4…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the socket table is read again when one read misses the confirm page's caller. It is specific to the fix, under 72 characters for the subject line, and matches the changeset in server/account/local-confirm.ts and its test.
Full details: Description check
Explanation
The description covers the problem, the fix, the reviews, and validation. It follows the template's Change and Validation sections in substance. The Change section explains the bug and the resulting 403 behavior. The Validation section lists the checks run and the CI runs left to CI. It does not link an issue, but the template asks for one only for features, and this is a fix. The description also points to the changelog work only indirectly.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 2c00789 and 90236c9.
Files selected for processing: 3
changelog.d/confirm-page-own-user.md
server/account/local-confirm.test.ts
server/account/local-confirm.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.
Merged through pr-merge at head 9fe71f1d2. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit reviewed this head.
main had moved since the checks of 90236c9c9: pr-merge --update merged it in (509d3dc4e), and every required check was green at this head.
It waited in the merge queue behind #4863, whose change overlaps it, before it was updated.
main moved but untouched: merged without update. Its new commits up to 96c22b87c change no file of this pull request, none imported by one, nothing that decides which checks run, and no core path.
Reviews on this head's code: omo gate (BLOCK on one MEDIUM, fixed in 90236c9, the one fix round), Codex gpt-6.2-sol-fast xhigh (CLEAR, LOWs in the PR body), CodeRabbit (no actionable comments). main-red flake fix under the lane brief main-red-account-lock (lead's word).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The PC's local confirm page (
server/account/local-confirm.ts) only answers this PC's own user. It finds the caller's uid in/proc/net/tcp. It used to read that table once. The kernel serves the file one page perread()and resumes by position. So while other sockets open and close, a single read can miss the caller's live row (or show it twice). When that happened, the page refused the owner with403 Open this page as this PC's own user.That is the main CI failure in run 45894193621 (1b0066f):
server/account/lock.contract.test.ts:349,a standing lock remains owner-unlockable after identity_reset via terminal, Expected 200, Received 403. It is a flake, not a regression from a recent merge. The test and the confirm code have not changed since #4435. Among the last 60 failed CI runs, it appears only in that one. The next main run (9f1c5c9) was green.Fix
peerUidOnLinuxnow reads the table up to 3 times and returns the first read that finds exactly one row on the caller's ends.A re-read only asks the kernel again. A row that is not there is never found, so a re-read admits no one a correct single read would refuse.
Evidence
The repro ran in the CI runner image, the same way the P620 runners run integration:
docker run --cpus 4 herdr-ci-runner:local, own network namespace, 8 copies ofbun test server/account/lock.contract.test.ts -t "via terminal"at once, repeated.nulland an immediate re-read returned1000. The row was there:0100007F:BC26 0100007F:A2DD 01 ... 1000.Q20: a read of the socket table that missed the live row ...fails on origin/main and passes here.bun run typecheckpasses.bun test server/account/local-confirm.test.tspasses: 32 pass.Reviews
NETLINK_SOCK_DIAGlookup would avoid the table walk, but that is a larger change.Validation
bun run check faston the final head 90236c9: passed (workflow syntax, generated types/themes, typecheck, build, unit tests).