Skip to content

feat(lifecycle): expose pool allocation summary - #1481

Open
cwj2001 wants to merge 5 commits into
opensandbox-group:mainfrom
cwj2001:feature/lifecycle-allocation-core
Open

feat(lifecycle): expose pool allocation summary#1481
cwj2001 wants to merge 5 commits into
opensandbox-group:mainfrom
cwj2001:feature/lifecycle-allocation-core

Conversation

@cwj2001

@cwj2001 cwj2001 commented Aug 12, 2026

Copy link
Copy Markdown

Summary

Adds an optional lifecycle Sandbox.allocation summary for a currently confirmed Kubernetes Pool allocation:

{
  "allocation": {
    "mode": "pool",
    "poolRef": "example-pool",
    "state": "allocated"
  }
}

This is a narrow runtime core change only. It does not update SDKs, Gateway integrations, business APIs, CRDs, Pool scheduling behavior, or CreateSandbox responses.

Confirmation semantics

The Pool controller extends its existing internal allocation record with the concrete Pool reference and allocation generation. The lifecycle mapper emits the public summary only when it finds a non-deleting workload with a concrete non-wildcard spec.poolRef, the Pool allocation finalizer, valid nonempty unique Pod evidence, an exact internal-record Pool-ref match, and matching allocated Pod count.

The summary omits all unconfirmed cases, including direct sandboxes, legacy Pods-only records, missing/mismatched Pool references, invalid allocation records, deletion, and count mismatch. It does not expose Pod names, namespace, node/IP/UID, raw annotations, finalizers, or generation.

The internal generation is recorded for controller traceability but is intentionally not used as a public-evidence predicate: renewal of spec.expireTime and other non-allocation spec changes can advance CR generation without changing a valid Pool allocation.

Closes #1479.

Verification

  • go test ./internal/controller -run "Test(Schedule|SetAllocation|SyncSandboxAllocation)" -count=1
  • uv run --no-sync pytest tests/k8s/test_workload_mapper.py tests/test_routes_get_sandbox.py — 28 passed
  • uv run --no-sync ruff check opensandbox_server/api/schema.py opensandbox_server/services/k8s/workload_mapper.py tests/k8s/test_workload_mapper.py tests/test_routes_get_sandbox.py
  • git diff --check

@github-actions github-actions Bot added component/k8s For kubernetes runtime component/server documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 12, 2026

@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: b41c366172

ℹ️ 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".

Comment thread specs/sandbox-lifecycle.yml
@cwj2001

cwj2001 commented Aug 12, 2026

Copy link
Copy Markdown
Author

SDK consumer follow-up is now included in 9dcb245.

Updated the affected stable get/list sandbox surfaces for Python, JavaScript, Kotlin, Go, and C#, with optional allocation omitted unchanged for legacy/non-Pool responses.

  • Python and JavaScript lifecycle generated clients were regenerated from specs/sandbox-lifecycle.yml; their stable layers and conversion coverage were added.
  • Kotlin lifecycle generation completed through the official Gradle task; generated build output remains uncommitted per SDK rules.
  • Go and C# handwritten lifecycle clients/models/adapters and get/list parsing tests were updated.

Verification passed:

  • server focused suite: 28 passed; ruff clean
  • controller allocation-focused Go test
  • Python ruff, pyright, and 80 focused tests
  • JavaScript generator, lint, typecheck, build, and 90 tests
  • Kotlin offline lifecycle generation and focused SandboxesAdapterTest
  • Go SDK go test ./...

C# tests are present but could not run locally because this host has only .NET SDK 8.0.129 while the project targets net10.0. Broader Kubernetes env/e2e suites are environment-blocked before assertions (missing envtest/KIND and disk exhaustion); the focused controller test passes.

@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: 9dcb24550c

ℹ️ 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".

Comment thread server/opensandbox_server/services/k8s/workload_mapper.py
@github-actions github-actions Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 12, 2026
@cwj2001
cwj2001 marked this pull request as draft August 13, 2026 02:07

@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: 180f3c18e0

ℹ️ 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".

Comment thread server/opensandbox_server/services/k8s/workload_mapper.py
@cwj2001
cwj2001 force-pushed the feature/lifecycle-allocation-core branch from 180f3c1 to d8b75c8 Compare August 13, 2026 02:18
@github-actions github-actions Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 13, 2026
@cwj2001
cwj2001 marked this pull request as ready for review August 13, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/k8s For kubernetes runtime component/server documentation Improvements or additions to documentation sdk/c# sdk/go sdk/java sdk/js sdk/python sdks size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(lifecycle): expose confirmed pool allocation summary

2 participants