Repository navigation
CONTRACT: perf(ui-server,ui-sdk): attribute the native observation's writer hold and journal finish (#2915) - #4012
Merged
Conversation
…tion (#2915) The journal takes an internal observation trace for admission, a call's result, the periodic pass and finish: every step reports to it, the worker hold last. The observer now times its wait for room behind earlier releases (observe_reserve), and the record step is split into record, publication and facts query, repeated per recorded turn. Admission's lifecycle steps gain the same new names (wire.md lists them); the hold stays trace-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#2915) An internal trace option on the manager reports each request's wait for the single operation lock, with the operation it waited behind, the lock hold and the checkpoint, release, delta and checkpoint-read steps, stamped with performance.timeOrigin + performance.now() so the app process can align them. No trace, no change: the lock and every check run as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sh on one clock (#2915) --observation-timing now records the journal trace in the app child and the manager spans in the fixture, pairs each checkpoint and delta step with the one manager request that arrived inside it, and writes per-phase medians, coverage of the measured hold or journal call and the clock proof to observation-timing.json, with the raw samples in observation-traces.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
This was referenced Nov 15, 2026
schlessera
force-pushed
the
perf/2915-native-observation-phases
branch
from
November 15, 2026 14:32
dbd3db8 to
2d5a350
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
Merged
9 tasks done
9 tasks done
7 tasks done
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2915
Refs #2834
What changed
A native journal observation's time can now be attributed step by step, on one clock, and it has been. A held observation reports every step to an internal journal trace: admission, a call's result, the periodic pass and finish, with the worker hold itself last. The native manager can report each request's wait for its single operation lock, the operation it waited behind, and its checkpoint, release and delta steps.
--observation-timingrecords both, pairs each checkpoint and delta step with the one manager request that arrived inside it, and writes per-phase medians, coverage and the clock proof toobservation-timing.json(phases), with the raw samples inobservation-traces.json. Admission's lifecycle steps gainobserve_reserve,observe_release_reads,observe_worktrees,observe_publishandobserve_facts(additive;docs/integration-contract/wire.md, changeset). Nothing is traced unless a caller passes a trace. No check, intent, fsync, capture or durability step changed.The decision record has the analysis:
docs/decisions/governed-writable-workers.md, "Where an observation's time goes".Why this shape
process.hrtimeis process-relative, so both processes stampperformance.timeOrigin + performance.now(). A manager request is matched only when it arrives inside its app step. The run fails unless every native step pairs with exactly one request and each checkpoint answers before its step ends. Those two guards together bound any offset between the clocks.Proof
Native fixture timing, hosted runners. pi, governed, UID 1000, 2,000 notes,
bun scripts/prove-native-host.ts --backend=pi --app-uid=1000 --observation-timing. The runs used temporary draft-only commits, since removed, that made the draft heavy-feedbackruntime_hostjob run this cell. The paired rows ran back to back on one runner. Cells show median added ms / p95 with the median worker hold. Begin + finish is the median / p95 of paired totals.write_fileedit_filebashfed7d8b63f8ff293dbd3db82The traced code under those heads equals this PR's code. The merge with main since then touched only unrelated files.
stale maintenance output: .brain-index/brain.db-shm). The paired job passed.Failing-first and mutation receipts.
TRACE_EVERY_HELD_OBSERVATION(no trace)observe_factsTRACE_BEGIN_STEPSTRACE_HOLD_ENDS_LASTLIFECYCLE_SEES_EVERY_STEP_BUT_THE_HOLDTRACE_LEAVES_DO_NOT_OVERLAPTRACE_EVERY_HELD_OBSERVATIONPHASES_LEAVES,SUMMARY_COVERAGE_AGAINST_MEASUREDPHASES_UNPAIRED_STEP_REPORTEDSUMMARY_COVERAGE_AGAINST_MEASUREDSUMMARY_ABSENT_PHASE_IS_ZERO(survived until the test was strengthened)PHASES_NATIVE_BREAKDOWNThe manager trace runs only as root on btrfs. The hosted native runs exercise it through the clock-proof assertions (
OBSERVATION_TIMING_ONE_CLOCK).Local suites.
packages/ui-server: 435 pass, 10 fail. The same 10 fail onorigin/mainin this sandbox (index purge, maintenance probe, native host inputs, turn scope).bun run typecheck,bun run buildandbun run api-report(no diff) all pass.Collisions at head
22857a95(rechecked after the merge with main below): no path collisions. Closure-only overlaps with open drafts #3054, #3056, #3059, #3069, #3116, #3437, #3581, #3622, #3806, #4002, #4007, #4008, #4013, #4016, #4018 and #4020.{"version":1,"kind":"brain-check-pr-receipt","head":"079cc7c6d86dbc32142368efca0e801547f9ca89","base":"origin/main","mode":"focused","startedAt":"2026-11-15T15:44:35.403Z","finishedAt":"2026-11-15T15:46:17.342Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":14140.765433999999},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":121.90144799999689},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":78.52037500000006},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":23.430453000000853},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":87555.28454600001}]}Checklist
integrate.ts confirm.wire.md) is updated in the CONTRACT commit.docs/reflect the change.Anything left open
🤖 Generated with Claude Code