Skip to content

fix(server): preserve numeric zero data_id in terminal projection - #700

Open
KVR Vishnu (VISHNU0906) wants to merge 1 commit into
microsoft:mainfrom
VISHNU0906:fix/659-terminal-data-id-zero
Open

KVR Vishnu (VISHNU0906) wants to merge 1 commit into
microsoft:mainfrom
VISHNU0906:fix/659-terminal-data-id-zero

Conversation

@VISHNU0906

Copy link
Copy Markdown

Fixes #659

CC Quanxin Liu (@notoufa)

Problem

_data_id_of selected IDs with truthiness (data_id or instance_id or ""), so numeric 0 was treated as missing. GET /api/rollouts/terminal then returned "" or an instance_id fallback instead of "0".

Change

Pick the first present data_id / instance_id that is not None or "", then stringify. Explicit 0 / "0" are kept; missing / null / empty still fall back.

Tests

Endpoint regressions through enqueue → running → succeeded → GET /api/rollouts/terminal for:

  • data_id=0 with instance_id fallback
  • instance_id=0 only
  • both zero (prefers data_id)
  • non-zero / string IDs
  • missing / null / empty primary → fallback or ""

Mutation-check: reverting to the or chain fails the three zero cases; controls still pass.

Verification

  • ruff check / ruff format --check on touched files
  • pyright on touched files
  • pytest -v tests → 250 passed, 4 skipped

I used AI assistance for parts of this change and tested it locally against the full test suite.

_data_id_of used truthiness (x or y), so data_id/instance_id of 0
were treated as missing and fell through to the fallback or "". Select
the first present non-None/non-empty id instead, and cover zero and
fallback cases through GET /api/rollouts/terminal.

Fixes microsoft#659

Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 07:58

Copilot AI 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.

🟢 Approval recommended

There are no active review issues for the change preserving numeric zero IDs in terminal rollout projections.

No open issues 🎉

What changed in this PR

Fixes #659 by preserving numeric zero IDs in the terminal rollout projection without changing stored rollout input.

Changes:

  • Selects data_id before instance_id, falling back only for missing, null, or empty-string values.
  • Adds parameterized endpoint regressions for zero IDs, ordinary IDs, and fallback behavior.
File Description
tests/​server/​test_endpoints.py Adds a rollout lifecycle helper and nine terminal projection test cases.
agentlightning/​server/​routes/​rollouts.py Replaces truthiness-based ID selection with explicit presence checks that preserve zero.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

Terminal rollout projection drops numeric dataset ID zero

2 participants