feat(BA-6893): add kernel scheduling-history SDK v2 client and CLI commands#12866
Merged
Conversation
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 15, 2026 03:36
663d835 to
09c0de0
Compare
This was referenced Jul 15, 2026
Merged
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 15, 2026 09:40
b9b9a37 to
8c13791
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 15, 2026 09:40
09c0de0 to
fa25770
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 15, 2026 09:56
8c13791 to
28b1894
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 15, 2026 09:56
fa25770 to
d5b9202
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 15, 2026 10:17
28b1894 to
3db2ec3
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 15, 2026 10:17
d5b9202 to
5803031
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 04:10
3db2ec3 to
610dd75
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 04:10
5803031 to
618b2fa
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 04:28
610dd75 to
24c5225
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 04:28
618b2fa to
8d3b63e
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 04:41
24c5225 to
9207228
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 04:41
8d3b63e to
9752716
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 04:47
9207228 to
6163a98
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 04:47
9752716 to
0b82b8f
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 04:55
6163a98 to
164383b
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 04:55
0b82b8f to
59abd5f
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 05:05
164383b to
942cb3a
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 05:05
59abd5f to
9cd3f7a
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 05:09
942cb3a to
0b1af6b
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 08:13
93a89e1 to
03bd499
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 08:13
fcfce6c to
1b6689c
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 08:26
03bd499 to
d956d23
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 08:26
1b6689c to
2be2f57
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 08:41
d956d23 to
bc9dfe8
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 08:41
2be2f57 to
79065c3
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
from
July 20, 2026 08:50
d1cf2de to
642d2ed
Compare
jopemachine
force-pushed
the
feat/BA-6893-kernel-history-sdk-cli
branch
from
July 20, 2026 08:50
79065c3 to
f673401
Compare
jopemachine
force-pushed
the
feat/BA-6892-kernel-history-adapter-rest
branch
11 times, most recently
from
July 21, 2026 05:35
76c497d to
4c5a83f
Compare
This was referenced Jul 21, 2026
jopemachine
commented
Jul 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds kernel scheduling-history support to the SDK v2 and CLI.
Changes:
- Adds admin and scoped SDK requests.
- Adds kernel history filtering, ordering, and CLI commands.
- Updates changelog and CLI reference documentation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
scheduling_history.py |
Adds kernel-history SDK methods. |
kernel.py |
Implements kernel-history CLI commands. |
commands.py |
Registers the kernel subgroup. |
12866.feature.md |
Adds the user-facing changelog entry. |
SKILL.md |
Updates the CLI command reference. |
Comments suppressed due to low confidence (1)
src/ai/backend/client/cli/v2/scheduling_history/kernel.py:183
- The scoped command uses the same seven-value
KernelHistoryOrderField, but its help advertises only two fields. List all accepted fields so--helpreflects the actual interface.
help="Order by field:direction (e.g., created_at:desc). Fields: created_at, updated_at.",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| """Kernel scheduling history commands.""" | ||
|
|
||
|
|
||
| @kernel.command() |
| @@ -0,0 +1 @@ | |||
| Add kernel scheduling-history queries to REST v2, the SDK, and the CLI (`bai scheduling-history kernel search / search-scoped`), scoped by session and/or kernel. | |||
| - **runtime-variant**: user(get, search) · admin(get, search, create, update, delete, bulk-delete) | ||
| - **runtime-variant-preset**: user(get, search) · admin(get, search, create, update, delete) | ||
| - **scheduling-history**: sub session / deployment / route — each (search, search-scoped) | ||
| - **scheduling-history**: sub session / kernel / deployment / route — each (search, search-scoped) |
…mmands Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fregataa
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 Stacked PRs
BA-6887fix: kernel history conditions reference the real status columns ✅BA-6889models: kernel query conditions and orders ✅BA-6890repository: kernel search scope and scoped search ✅BA-6891DTO + service: kernel v2 DTOs and search actions ✅BA-6892adapter + REST v2: kernel endpoints ✅BA-6883GraphQL v2: kernel history roots ✅BA-6957fix: authorize kernel scoped history via the owning session ✅BA-6893SDK + CLI: kernel commands ← you are hereBA-6953component tests: kernel REST v2 endpointsEvery PR below this one is merged, so this PR now branches straight off
mainand its diff is client-only.Summary
SDK v2 methods and CLI commands over the two REST routes from #12870, completing the surface BA-6889..BA-6892 built up.
bai scheduling-history kernel searchsearch_kernel_history(request)POST /v2/scheduling-history/kernels/admin/searchbai scheduling-history kernel search-scoped KERNEL_IDkernel_scoped_search(request)POST /v2/scheduling-history/kernels/scoped/searchcli/v2/scheduling_history/group as akernelsub-group, matching the existingsession/deployment/routesub-groups of this entity. The system-widesearchis still gated server-side bysuperadmin_required, so a regular user calling it gets a 403.search_{entity}_history/{entity}_scoped_search), and the scope travels in the request body (ScopedSearchKernelHistoriesInput.scope) rather than as a path parameter.search-scopedtakes the kernel id as a positional argument, like every other scoped search in the CLI, and wraps it intoKernelHistoryScopeDTO(kernel=[UUIDScope(...)])— the list-shaped scope introduced by feat(BA-6989): reshape KernelScope into scope-item lists and accept a session scope #13071 (BA-6989).--session-idon this command is an ordinary filter, not a second scope axis, because the server accepts exactly one scope item.Not covered: #13071 also lets the scope name a session (
scope.session), returning the history of every kernel that session owns. The CLI does not expose that axis — the positional argument is the kernel id. If it is wanted, it belongs in a follow-up as its own command rather than as an optional positional.How to test
Common options for both commands:
--limit/--offset,--phase(contains),--from-status/--to-status(repeatable),--result SUCCESS|FAILURE|STALE|NEED_RETRY|EXPIRED|GIVE_UP|SKIPPED,--error-code/--message(contains),--order-by created_at:desc(alsoupdated_at, repeatable),--session-id.searchadditionally takes--kernel-id; onsearch-scopedthe kernel id is the positional scope instead.Note:
kernel_scheduling_historyhas no writer yet (BA-6852), so an empty list is the expected live response. To see populated responses, insert rows directly;from_status/to_statusmust be validKernelSchedulingPhasevalues (PREPARING|PULLING|PREPARED|CREATING|RUNNING|TERMINATING|TERMINATED) or serialization fails. Test accounts live infixtures/manager/example-keypairs.json.Test plan
Verified end to end against a live manager rebased onto current
main(which includes #13071), with a seeded history row:search→ 200; row fields (kernel_id,session_id,phase,from_status/to_status,result,attempts, timestamps) deserializesearch-scoped KERNEL_ID→ 200, returns only that kernel's rowssearch-scoped KERNEL_ID --session-id→ matching session returns the row, non-matching returns none--phase,--result,--from-status,--to-status,--message,--kernel-id,--session-id) and--order-by created_at:desc--limit 1 --offset 1→has_previous_page: truesearch-scopedwith no positional →Missing argument 'KERNEL_ID'kernel_read_not-foundsearch→ 403; the same user'ssearch-scopedon their own kernel → 200pants fmt/fix/lint/checkclean🤖 Generated with Claude Code