Skip to content

feat(#52): runtime attribution instrumentation (Slice 1) - #68

Open
aryaniyaps wants to merge 5 commits into
mainfrom
perf/issue-52-runtime-adr
Open

feat(#52): runtime attribution instrumentation (Slice 1)#68
aryaniyaps wants to merge 5 commits into
mainfrom
perf/issue-52-runtime-adr

Conversation

@aryaniyaps

@aryaniyaps aryaniyaps commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 1 of #52 / epic #49: runtime attribution, root-cause elimination, bounded spikes, and ADR-015 accepted.

Slice 1 — Attribution instrumentation

  • Lifecycle phase-aligned attribution in baseline workload (phase IDs, per-phase descendant peaks, subprocess launch counts).
  • Structured attribution fields in observe.mjs success responses.
  • Machine-readable report at benchmarks/runtime-baseline-v1/attribution/small.json.

Slice 2 — Root-cause elimination matrix

  • Analytic elimination of four architecture families in ADR-015 draft.
  • Selected D+A (bounded topology + concurrency caps) with ADR-012 hybrid retained.

Slice 3 — Bounded spikes (≤2)

  • Spike 1 (D+A): initial-observation valid at pids.max=64, peak 47 tasks — evidence benchmarks/runtime-baseline-v1/spikes/da-bounded-topology.json
  • Spike 2 (B): BM25-only fails [Practical Runtime foundation 4/5] Add the normalized semantic behavior oracle #51 gates — keep ADR-012 hybrid dense — evidence benchmarks/runtime-baseline-v1/spikes/b-lexical-first.json
  • Production policy surface: packages/cli/lib/runtime-budget.mjs

Slice 4 — ADR finalization + issue rewrite

#52 handoff to Phase 2

Parent Child leaves
#53 #69 topology/memory, #70 lifecycle/cleanup
#54 #71 inventory, #72 generations/invalidation
#55 #73 index sync, #74 scoring/closure
#56 #75 keep dense decision, #76 bounded implementation
#57 #77 Linux packaging, #78 macOS/Windows deferred

Start Phase 2 with #69 (topology/memory ownership) — must complete small initial-observation under 64 tasks without spike-only Node backend.

Test plan

  • npm run test:runtime-baseline
  • npm run test:safe-runner
  • npm run test:semantic-oracle
  • npm run test:real-repository-oracle
  • node tests/runtime_budget_test.mjs
  • node tests/observation_diagnostics_test.mjs

Closes #52. Phase 1 of epic #49 complete; Phase 2 begins at #69.

Made with Cursor

aryaniyaps and others added 2 commits August 3, 2026 21:45
Record post-#66 baseline refresh at 104153a confirming the same aggregate
pids.max=64 refusal on initial observation, with updated attestation and
result identity digests for reproduction.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extend the small-tier baseline with lifecycle phase labels, product-side
observation diagnostics, and a machine-readable attribution report so #52 can
name dominant costs before any architecture changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lamina-docs Ready Ready Preview Aug 3, 2026 4:54pm

Document measured PID refusal causes from #60 attribution and analytically
eliminate alternative families to select ≤2 bounded spikes for Slice 3.

Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce LAMINA_RUNTIME_BOUNDED_TOPOLOGY policy hooks and run D+A/B spikes
on the small #60 fixture: initial-observation completes under pids.max=64,
lexical-only fails #51 held-out gates, spike evidence in ADR-015.

Co-authored-by: Cursor <cursoragent@cursor.com>
@aryaniyaps
aryaniyaps marked this pull request as ready for review August 3, 2026 16:51
@cursor

cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

…ice 4)

Finalize practical runtime architecture decision (D+A topology, retain
ADR-012 hybrid dense), remove Node backend and seedGraph skip from default
baseline path, and confine spike repro helpers to run-da-spike.mjs.

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6370538279

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const environment = Object.fromEntries(entries
.filter(([name]) => !isGraphdExecutionHook(name, platform)
&& (platform !== 'win32' || name.toLowerCase() !== 'path')));
Object.assign(environment, graphdThreadEnvironment(inheritedEnvironment));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Parse the budget before applying graphd thread caps

When graphdEnvironmentFor receives either a normal environment or one with LAMINA_RUNTIME_BOUNDED_TOPOLOGY=1, it passes the raw environment object to graphdThreadEnvironment, which expects a parsed budget containing graphd_threads. Consequently threadLimitEnvironment(undefined) emits values such as OMP_NUM_THREADS='NaN' and UV_THREADPOOL_SIZE='NaN'; bounded runs therefore do not apply the requested graphd cap and can still hit the PID ceiling this feature is intended to prevent. Pass runtimeBudgetFromEnvironment(inheritedEnvironment) instead, allowing the helper to return an empty object when the feature is disabled.

Useful? React with 👍 / 👎.

} : null,
mode: live ? 'live' : invalidate ? 'rebuild' : discover ? 'discover' : 'observe',
subprocess_launches: {
cocoindex_worker: workerDiagnostics.filter((item) => item.ok).length,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Count CocoIndex launches only for the CocoIndex backend

When bounded topology selects the Node backend, runWorker calls observeNode in-process and still appends a successful diagnostic, so this expression reports one cocoindex_worker subprocess per attempt even though no CocoIndex process was launched. This already makes the bounded-topology attribution claim a worker launch that did not occur; gate the count on backend === COCOINDEX_BACKEND so the experiment's process-topology evidence remains accurate.

Useful? React with 👍 / 👎.

});

const ROLE_ALIASES = Object.freeze({
graphd: 'graphd_startup',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Map graphd launches to the declared graphd bucket

The launch accumulator declares a graphd bucket, but this alias converts every graphd event to graphd_startup, which is absent from that accumulator. Both direct recording and merged product attribution therefore fall through to other, causing the top-level attribution report to show zero graphd launches and inflated unknown launches even when the product attribution reports graphd startup.

Useful? React with 👍 / 👎.

mode: live ? 'live' : invalidate ? 'rebuild' : discover ? 'discover' : 'observe',
subprocess_launches: {
cocoindex_worker: workerDiagnostics.filter((item) => item.ok).length,
graphd: compatibilityRecovery ? 2 : 1,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Record graphd launches only when ensureGraphd starts one

For observations performed after seedGraph or against any already-running compatible daemon, ensureGraphd reuses that daemon, but the attribution unconditionally records one graphd subprocess (and two after compatibility recovery). Once later baseline scenarios are unblocked, this overcounts graphd startups throughout the report; derive the count from whether the initial ensureGraphd call actually spawned a daemon rather than assuming every observation starts one.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Practical Runtime decision] Select the runtime architecture using measured experiments

1 participant