Skip to content

fix: preserve unique machine IDs during provider sync in list query#203

Open
kirillsc wants to merge 1 commit intomainfrom
fix/return_all_run_instnaces
Open

fix: preserve unique machine IDs during provider sync in list query#203
kirillsc wants to merge 1 commit intomainfrom
fix/return_all_run_instnaces

Conversation

@kirillsc
Copy link
Copy Markdown
Contributor

@kirillsc kirillsc commented Apr 16, 2026

Description

ListMachinesHandler.execute_query() used synced_machines[0] after syncing with AWS, always picking the first instance in the reservation regardless of which machine was being iterated. This caused orb machines return --all to send the same instance ID repeated N times instead of N unique IDs — only 1 instance was actually terminated. Affected all code paths using ListMachinesQuery: return, list, stop, start (CLI, SDK, API, MCP).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code cleanup or refactor
  • Dependencies update
  • CI/CD or build process changes

Related Issues

How Has This Been Tested?

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • Regression test: tests/unit/application/queries/test_list_machines_sync_unique_ids.py
  • Verified via logs that orb machines return --all --force was sending duplicate IDs

Test Configuration

  • Python version: 3.13
  • OS: macOS Darwin 25.3.0
  • AWS region: eu-west-1
  • Dependencies changed: none

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have updated the CHANGELOG.md file
  • I have updated the version number (if applicable)

Additional Notes

Root cause: fetch_provider_machines() returns all instances in a reservation (not just the one being iterated). The code then blindly took synced_machines[0], overwriting every machine in the loop with the same instance. Fix: match the synced machine back to the current machine by ID.

Performance Impact

  • No significant performance impact
  • Performance improved
  • Performance degraded (explain why it's necessary)

Security Considerations

  • No security implications
  • Security improved
  • Potential security concerns (explain and justify)

Dependencies

None.

Reviewers

@awslabs/orb-maintainers

ListMachinesHandler.execute_query() used synced_machines[0] after syncing
with AWS, always picking the first instance in the reservation regardless
of which machine was being iterated. This caused return --all to send the
same instance ID repeated N times instead of N unique IDs.

Match synced machine by ID instead of blindly taking the first element.
@kirillsc kirillsc requested a review from a team as a code owner April 16, 2026 21:00
@github-actions
Copy link
Copy Markdown
Contributor

Test Results Summary

6 439 tests  +1   6 354 ✅ +1   9m 31s ⏱️ +4s
    6 suites ±0      85 💤 ±0 
    6 files   ±0       0 ❌ ±0 

Results for commit ba471de. ± Comparison against base commit fec26e7.

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