Repository navigation
fix(identity): stabilize Linux epoch start times - #9
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR estimates Linux process epoch birth times from bracketed realtime and boottime samples while preserving boot-relative identity. Example: Read a freshly spawned Linux process identity with CLK_TCK=100.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a concrete Linux timestamp error still present on main, and its author is a verified repository administrator. No actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe identity subpath passes a PID to the native Linux observer, which reads procfs and clocks and returns a typed identity, proven absence, or a typed error. flowchart TD
A[Caller PID] --> B[TypeScript identity API]
B --> C[Native Linux observer]
D[Procfs process stat] --> C
E[Realtime and boottime clocks] --> C
C --> F[Identity or typed error]
F --> G[Boot-relative ancestry comparison]
Technical reviewBest possible solution: Land the bounded clock-sampling repair with exact boot-relative comparisons and the documented current-wall-clock semantics. Do we have a high-confidence way to reproduce the issue? Main's calculation visibly combines whole-second boot-epoch truncation with process-tick truncation; the PR reports matching time-namespace measurements, but no reproduction was run during this read-only review. Is this the best way to solve the issue? The repair addresses the truncation at its native owner, retains exact boot-relative identity, and rejects uncertain observations instead of adding retries or fallbacks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 17b242b4033f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 10, 2026, 7:20 AM ET / 11:20 UTC. |
Linux epoch birth estimates can fall more than a second before a freshly spawned process.
/proc/stattruncates the boot epoch to whole seconds, while/proc/<pid>/statindependently truncates birth to clock ticks. Their errors add: a real time-namespace reproduction exceeded the existing one-second bound in 470/500 x64 samples and 469/500 ARM64 samples, with errors reaching 1.0094 seconds. Ordinary GNU and musl measurements showed stable realtime/boottime offsets and CLK_TCK=100; neither libc-specific conversion nor accumulating clock drift was required.Compute the epoch estimate from bracketed CLOCK_REALTIME/CLOCK_BOOTTIME samples at each read. Reject samples wider than one tick and disjoint boot-epoch intervals. Keep the boot-relative birth exactly as before for PID-reuse and ancestry comparisons. Document that epoch time is an estimate in the current wall-clock frame, bounded by two ticks plus one microsecond, and can change after a wall-clock correction. No public API is added.
The runtime proof now checks 32 freshly spawned children on the main thread and 32 in a real Worker against a derived 21 ms Date.now bracket at 100 Hz. GNU and musl, x64 and ARM64, Node and Bun are covered. The arithmetic regression also rejects a wall-clock step hidden by an otherwise narrow intersection. Existing lifecycle and Worker comparisons retain exact boot-relative identity checks.
Validation: local native
pnpm checkand Bun tests; real AWS Linux GNU/musl measurements and Node/Bun runtime proof; required CI on the PR head. Independent review identified the wide-sample intersection issue, which is fixed and covered before landing.