Skip to content

feat(core): report abandoned, revisited and resumed orchestrated migrate runs and their dispense ordinals - #36989

Draft
leosvelperez wants to merge 2 commits into
nxc-4769from
nxc-4818
Draft

feat(core): report abandoned, revisited and resumed orchestrated migrate runs and their dispense ordinals#36989
leosvelperez wants to merge 2 commits into
nxc-4769from
nxc-4818

Conversation

@leosvelperez

@leosvelperez leosvelperez commented Sep 10, 2026

Copy link
Copy Markdown
Member

Current Behavior

This only applies to orchestrated migrate runs, behind NX_MIGRATE_ORCHESTRATOR.

An orchestrated run is many short nx calls driven by an agent. The agent can stop calling nx at any point. Nothing runs at the end to say so. In analytics an abandoned run only shows up as a start event with no completion event. The classic loop never had this gap, because one process sends both its start and its end.

When a session continues an existing run, or finds one and reports it, analytics sees nothing either. The start event is sent once per run, so a restarted session leaves no trace.

Expected Behavior

Analytics can tell how orchestrated runs end and how far they got. Every event below carries the run's tallies: applied, skipped, and steps handed out.

  • nx started the agent and the run is still active when the agent exits: an abandonment event, with the agent id.
  • nx finds an existing run and reports it instead of starting one: an existing-run event.
  • A session continues an existing run: a resume event.
  • nx hands a new step to the agent: a step event with the step's position. Counting these per position shows where runs stop.

Related Issue(s)

NXC-4818

Implementation Notes

  • A run id dimension was the first plan and was dropped. The GA property has no BigQuery export, so an undeclared parameter cannot be read. GA collapses unique-id dimensions into an "(other)" row past a few hundred values a day. The new events reuse the existing dimensions; no Rust change.
  • The existing per-response dispense event now carries the same step position, but it repeats until the step moves. It feeds the action mix per position, not the survival curve. migrate_orchestrator_step_dispensed fires once per durable step handout and is the curve.
  • runTallies() in state-machine.ts derives the event tallies from tallySteps(), so the completion summary, the completion event and the new events share one step classification. Adopted steps count as applied.
  • A continue with a bare --run-id is not a resume: nothing in run state marks the first call after a lost session.
  • A session that failed to start its agent with the run left active sends both the error event and the abandonment event. That fall-through order predates this change.

@leosvelperez
leosvelperez added this pull request to stack #36919 September 10, 2026 13:15
@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 3cede9d
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6aa2ad88303c0300083411e0
😎 Deploy Preview https://deploy-preview-36989--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 3cede9d
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6aa2ad885765f9000857c323
😎 Deploy Preview https://deploy-preview-36989--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@leosvelperez leosvelperez self-assigned this Sep 10, 2026
@nx-cloud

nx-cloud Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit bb56465

Command Status Duration Result
nx affected --targets=lint,oxlint,test,build,e2... ✅ Succeeded 10m 50s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 4s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 1m 3s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 20s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-09-10 20:59:28 UTC

@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit b71f794
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6aa3168309ce4b0008fa56ec
😎 Deploy Preview https://deploy-preview-36989--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit b71f794
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6aa31683bf5d2e00082d4c2c
😎 Deploy Preview https://deploy-preview-36989--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

nx-cloud[bot]

This comment was marked as outdated.

…ate runs and their dispense ordinals

An orchestrated migrate run spans many short-lived nx processes driven by
an agent that can stop calling nx at any point. Nothing ran at the end to
say the run was abandoned, so abandonment only showed up as a missing
migrate_orchestrator_complete. The classic loop never had this gap: one
process emits both its start and its end.

A run id dimension was the original plan and was dropped: the GA property
has no BigQuery export, so an undeclared parameter is unreadable, and GA
advises against declaring unique ids as dimensions (past ~500 distinct
values a day they collapse into an "(other)" row). The signals below need
no new dimension and no Rust change.

- migrate_orchestrator_abandoned: the spawn-path parent reads run.json
  after the agent exits; a run still active at that point is reported with
  the same tallies complete carries (applied, skipped, dispense count) plus
  the agent id. Exact per-run abandonment for user-initiated runs.
- migrate_orchestrator_existing_run: every existing-run report, whether
  init printed it for the agent or handed it to the master session. On the
  master path it precedes the resume when the user continues; on the agent
  path it is the only trace of a revisit.
- migrate_orchestrator_resume: every resume reports the same tallies,
  which the start watermark hid until now. The state cannot tell a crashed
  session from a re-invocation, so both count. A bare --run-id reconcile
  is not a resume: nothing in run state marks the first call after a lost
  session.
- migrate_orchestrator_step_dispensed: once per durable dispense
  transition, carrying the run-wide dispense ordinal on task_count.
  Counting it per ordinal is the survival curve for agent-initiated runs,
  which have no parent process to observe them.
- migrate_orchestrator_dispense gains the same ordinal. It repeats on every
  reconcile until the step moves, so it feeds the action mix per position,
  not the curve.

runTallies() in state-machine.ts derives the event tallies from
tallySteps() so the completion event and the new events agree with the
completion summary on one step classification; adopted steps count as
completed. Classic single-process events are unchanged.
…ate runs and their dispense ordinals [Self-Healing CI Rerun]

@nx-cloud nx-cloud Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nx Cloud has identified a flaky task in your failed CI:

🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

Nx Cloud View detailed reasoning in Nx Cloud ↗

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.


🎓 Learn more about Self-Healing CI on nx.dev

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.

1 participant