Skip to content

chore(sdk): regenerate all SDKs with typed action methods#1524

Merged
mergify[bot] merged 10 commits into
mainfrom
jsell/chore/regenerate-sdk
May 7, 2026
Merged

chore(sdk): regenerate all SDKs with typed action methods#1524
mergify[bot] merged 10 commits into
mainfrom
jsell/chore/regenerate-sdk

Conversation

@jsell-rh
Copy link
Copy Markdown
Contributor

@jsell-rh jsell-rh commented May 7, 2026

Summary

Key changes

ScheduledSession actions (new):

Method HTTP Return Type
suspend POST ScheduledSession (typed)
resume POST ScheduledSession (typed)
trigger POST Record<string, unknown> (generic — inline schema)
runs GET Record<string, unknown> (generic — cross-resource ref)

Session actions (unchanged):
start() and stop() continue to work identically — the generator now uses the Action struct but produces the same output for existing actions.

Test plan

  • cd components/ambient-sdk/go-sdk && go build ./... — Go SDK compiles
  • cd components/ambient-sdk/ts-sdk && npx tsc --noEmit — TS SDK type-checks
  • Verify scheduled_session_api.ts has suspend(), resume(), trigger(), runs() methods

Summary by CodeRabbit

  • New Features

    • Added scheduled session control operations: resume, suspend, trigger, and runs across all SDKs
    • Implemented project-scoped scheduled session management throughout CLI and SDK endpoints
  • Chores

    • Regenerated SDKs with updated build metadata and timestamps across Go, Python, and TypeScript clients

jsell-rh and others added 7 commits April 23, 2026 11:56
… patch

- Update fallback callback to /api/auth/github/user/callback (confirmed
  by team as the correct path for all clusters)
- Add kustomize JSON patch to production overlay injecting
  GITHUB_CALLBACK_URL from per-cluster frontend-config ConfigMap
- Update README docs

Per-cluster setup after deploy:
  oc create configmap frontend-config \
    --from-literal=github-callback-url=https://<cluster>/api/auth/github/user/callback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit 484b0ae
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/69fcb1428d2bb900083bdb35

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

📝 Walkthrough

Walkthrough

SDK codegen regeneration with timestamp updates and new scheduled-session control APIs. CLI commands updated to use project-scoped scheduled-session methods. Minor API shape changes for AgentAPI.Start return type and additions to CRUD pagination across SDKs.

Changes

Scheduled Session Project Scoping

Layer / File(s) Summary
SDK Core APIs
components/ambient-sdk/go-sdk/client/scheduled_session_api.go
ScheduledSessionAPI adds four new methods: Resume, Suspend, Trigger (POST endpoints returning session/generic response), and Runs (GET endpoint). These mirror non-project-scoped patterns.
SDK Extensions (Project-Scoped)
components/ambient-sdk/go-sdk/client/scheduled_session_extensions.go
Four methods renamed with *InProject suffix: SuspendSuspendInProject, ResumeResumeInProject, TriggerTriggerInProject, RunsRunsInProject. Project-scoped endpoint paths and signatures preserved.
CLI Wiring
components/ambient-cli/cmd/acpctl/scheduledsession/cmd.go, components/ambient-cli/cmd/acpctl/ambient/tui/client.go
CLI commands (suspend, resume, trigger, runs) and TUI client methods updated to call *InProject SDK methods instead of non-project-scoped variants.
Test Coverage
components/ambient-sdk/go-sdk/client/extensions_test.go
Tests for SuspendInProject, ResumeInProject, TriggerInProject, and RunsInProject added; prior non-project variants removed. Validates project-scoped paths and return types.

SDK Regeneration & API Shape Changes

Layer / File(s) Summary
Agent API Return Type
components/ambient-sdk/go-sdk/client/agent_api.go, components/ambient-sdk/python-sdk/ambient_platform/_agent_api.py, components/ambient-sdk/ts-sdk/src/agent_api.ts
AgentAPI.Start() return type changed from typed *types.Agent / Agent / Agent to untyped map[string]interface{} / dict / Record<string, unknown> across Go, Python, and TypeScript SDKs.
Scheduled Session Base APIs
components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py, components/ambient-sdk/ts-sdk/src/scheduled_session_api.ts
Python and TypeScript SDKs add the same four methods (resume, suspend, trigger, runs) to match Go API surface.
User API Pagination
components/ambient-sdk/ts-sdk/src/user_api.ts
UserAPI.listAll() async generator method added for paginated iteration across user results.
Role API CRUD
components/ambient-sdk/python-sdk/ambient_platform/_role_api.py
RoleAPI.update() method added to Python SDK for PATCH operations on role resources.
Autogenerated Metadata Updates
All Go types (components/ambient-sdk/go-sdk/types/*), Python types/APIs (components/ambient-sdk/python-sdk/ambient_platform/*), TypeScript types/APIs (components/ambient-sdk/ts-sdk/src/*), and base modules
Timestamp comment regenerated from 2026-05-05T18:24:54Z to 2026-05-07T15:10:36Z across all autogenerated SDK files (Go client/types, Python client/models, TypeScript types/APIs). No functional code changes to these files beyond metadata.
🚥 Pre-merge checks | ✅ 7 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows Conventional Commits format (chore(sdk): ...) and accurately summarizes the main change: SDK regeneration with typed action methods.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Performance And Algorithmic Complexity ✅ Passed No blocking performance regressions. New SDK methods are single-call operations. Go SDK pagination properly supported. No O(n²), N+1, or unbounded operations found.
Security And Secret Handling ✅ Passed All security checks passed. Auth headers properly set, project scoping enforced, path parameters URL-encoded, tokens redacted in logs, no hardcoded secrets found, token validation present.
Kubernetes Resource Safety ✅ Passed PR contains only SDK code (Go/Python/TS) and CLI tools. No Kubernetes manifests, deployments, RBAC, containers, or resource specs are modified. Custom check for K8s resource safety is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jsell/chore/regenerate-sdk
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch jsell/chore/regenerate-sdk

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jsell-rh jsell-rh changed the title chore: regenerate ts sdk chore(sdk): regenerate all SDKs with typed action methods May 7, 2026
jsell-rh and others added 2 commits May 7, 2026 15:13
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ethod conflicts

Suspend, Resume, Trigger, Runs were hand-written in
scheduled_session_extensions.go with explicit projectID parameters.
The generator now also emits these methods (using the client's
configured project via basePath()). Rename the extensions to
SuspendInProject, ResumeInProject, TriggerInProject, RunsInProject
to match the existing *InProject naming convention and avoid
duplicate method declarations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jsell-rh jsell-rh marked this pull request as ready for review May 7, 2026 15:35
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set chat.allow_non_org_members: true in your configuration.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/ambient-cli/cmd/acpctl/scheduledsession/cmd.go (1)

51-64: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

resolveScheduledSession: blind fallback masks real errors.

The GetByProject error is swallowed regardless of type — network failures, auth errors, and 500s all silently fall through to GetByName. Only a genuine "not found" (e.g., 404) should trigger the fallback; other errors should be propagated immediately.

🛠 Proposed fix
-	ss, err := client.ScheduledSessions().GetByProject(ctx, projectID, arg)
-	if err != nil {
-		ss, err = client.ScheduledSessions().GetByName(ctx, projectID, arg)
-		if err != nil {
-			return "", fmt.Errorf("scheduled session %q not found in project %q", arg, projectID)
-		}
-	}
+	ss, err := client.ScheduledSessions().GetByProject(ctx, projectID, arg)
+	if err != nil {
+		if !isNotFound(err) {
+			return "", fmt.Errorf("get scheduled session %q: %w", arg, err)
+		}
+		ss, err = client.ScheduledSessions().GetByName(ctx, projectID, arg)
+		if err != nil {
+			return "", fmt.Errorf("scheduled session %q not found in project %q", arg, projectID)
+		}
+	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/ambient-cli/cmd/acpctl/scheduledsession/cmd.go` around lines 51 -
64, The resolveScheduledSession function currently swallows any error from
client.ScheduledSessions().GetByProject and always falls back to GetByName;
change it so only a genuine "not found" error triggers the fallback. Inspect the
error returned by GetByProject (e.g., check for a sentinel NotFound error or
HTTP 404 status on the error type) and if it is not a NotFound, return the error
immediately; only when it's a NotFound call client.ScheduledSessions().GetByName
and proceed to return ss.ID. Keep references to resolveScheduledSession,
ScheduledSessions().GetByProject and ScheduledSessions().GetByName when
implementing the check.
🧹 Nitpick comments (1)
components/ambient-sdk/go-sdk/client/extensions_test.go (1)

174-176: ⚡ Quick win

Strengthen route assertions for project-scoped action tests

These three tests only validate path suffixes, so they would still pass if /projects/{projectID} were accidentally dropped. Add the same project-path assertion used in RunsInProject to catch scope regressions.

[Suggest patch pattern in each handler:]

Patch
 		if !strings.HasSuffix(r.URL.Path, "/scheduled-sessions/ss-sus/suspend") {
 			t.Errorf("unexpected path: %s", r.URL.Path)
 		}
+		if !strings.Contains(r.URL.Path, "/projects/proj-a/") {
+			t.Errorf("expected project in path: %s", r.URL.Path)
+		}

Also applies to: 203-205, 227-229

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/ambient-sdk/go-sdk/client/extensions_test.go` around lines 174 -
176, The test currently only checks path suffixes (e.g., the handler that
asserts !strings.HasSuffix(r.URL.Path, "/scheduled-sessions/ss-sus/suspend")),
which allows /projects/{projectID} to be dropped; update each affected test
handler to also assert the project-scoped prefix the same way RunsInProject
does: add the same project-path assertion used in RunsInProject to verify
r.URL.Path contains the expected "/projects/{projectID}" segment (alongside the
existing suffix check) so the route is validated for correct project scoping.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/ambient-sdk/python-sdk/ambient_platform/_agent_api.py`:
- Around line 45-47: AgentAPI.start() now returns a raw dict instead of the
typed Agent object, breaking the public contract; restore the previous behavior
by converting the response into an Agent before returning (use Agent.from_dict
on the response) or, if intentionally breaking, update the SDK release notes and
bump version accordingly; locate the start method in class AgentAPI and either
wrap the existing resp with Agent.from_dict(resp) and return that, or add an
explicit breaking-change comment and semver bump step in the release plan.

In
`@components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py`:
- Around line 45-59: The generated methods (resume, runs, suspend, trigger)
interpolate resource_id directly into path segments; update the generator
template (not this generated file) to URL-encode path segment IDs by wrapping
resource_id with urllib.parse.quote(resource_id, safe="") when building
f"{self._base_path()}/{resource_id}/...", and apply the same change for all
generator templates that emit resource_id in paths so calls like
self._client._request("POST", f"{self._base_path()}/{resource_id}/resume")
become self._client._request(..., f"{self._base_path()}/{quote(resource_id,
safe='')}/resume") ensuring encoding is used consistently for functions such as
resume, runs, suspend and trigger and for responses parsed by
ScheduledSession.from_dict.

In `@components/ambient-sdk/ts-sdk/src/agent_api.ts`:
- Around line 40-42: The start method in agent_api.ts currently returns
Promise<Record<string, unknown>> instead of the OpenAPI-defined StartResponse;
create or add a StartResponse type (including session and start_prompt fields
per the spec) into the generated types module, export it, then update the start
function signature in agent_api.ts to return Promise<StartResponse> and
import/use that type for the ambientFetch generic; ensure the shape matches the
OpenAPI response so callers get proper type safety.

In `@components/ambient-sdk/ts-sdk/src/scheduled_session_api.ts`:
- Around line 44-46: The runs method currently returns a generic Record<string,
unknown> but the OpenAPI schema specifies SessionList; update the runs method
signature to return Promise<SessionList> and ensure the ambientFetch call is
typed accordingly so it returns SessionList (use the exported SessionList type
from the SDK), e.g., change the generic parameter on ambientFetch in runs and
import/reference SessionList where runs is defined to match other correctly
typed endpoints like list().

---

Outside diff comments:
In `@components/ambient-cli/cmd/acpctl/scheduledsession/cmd.go`:
- Around line 51-64: The resolveScheduledSession function currently swallows any
error from client.ScheduledSessions().GetByProject and always falls back to
GetByName; change it so only a genuine "not found" error triggers the fallback.
Inspect the error returned by GetByProject (e.g., check for a sentinel NotFound
error or HTTP 404 status on the error type) and if it is not a NotFound, return
the error immediately; only when it's a NotFound call
client.ScheduledSessions().GetByName and proceed to return ss.ID. Keep
references to resolveScheduledSession, ScheduledSessions().GetByProject and
ScheduledSessions().GetByName when implementing the check.

---

Nitpick comments:
In `@components/ambient-sdk/go-sdk/client/extensions_test.go`:
- Around line 174-176: The test currently only checks path suffixes (e.g., the
handler that asserts !strings.HasSuffix(r.URL.Path,
"/scheduled-sessions/ss-sus/suspend")), which allows /projects/{projectID} to be
dropped; update each affected test handler to also assert the project-scoped
prefix the same way RunsInProject does: add the same project-path assertion used
in RunsInProject to verify r.URL.Path contains the expected
"/projects/{projectID}" segment (alongside the existing suffix check) so the
route is validated for correct project scoping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1144455b-88d1-42d4-a83c-22376c208df5

📥 Commits

Reviewing files that changed from the base of the PR and between 933691f and 484b0ae.

📒 Files selected for processing (81)
  • components/ambient-cli/cmd/acpctl/ambient/tui/client.go
  • components/ambient-cli/cmd/acpctl/scheduledsession/cmd.go
  • components/ambient-sdk/go-sdk/client/agent_api.go
  • components/ambient-sdk/go-sdk/client/client.go
  • components/ambient-sdk/go-sdk/client/credential_api.go
  • components/ambient-sdk/go-sdk/client/extensions_test.go
  • components/ambient-sdk/go-sdk/client/inbox_message_api.go
  • components/ambient-sdk/go-sdk/client/iterator.go
  • components/ambient-sdk/go-sdk/client/project_api.go
  • components/ambient-sdk/go-sdk/client/project_settings_api.go
  • components/ambient-sdk/go-sdk/client/role_api.go
  • components/ambient-sdk/go-sdk/client/role_binding_api.go
  • components/ambient-sdk/go-sdk/client/scheduled_session_api.go
  • components/ambient-sdk/go-sdk/client/scheduled_session_extensions.go
  • components/ambient-sdk/go-sdk/client/session_api.go
  • components/ambient-sdk/go-sdk/client/session_message_api.go
  • components/ambient-sdk/go-sdk/client/user_api.go
  • components/ambient-sdk/go-sdk/types/agent.go
  • components/ambient-sdk/go-sdk/types/base.go
  • components/ambient-sdk/go-sdk/types/credential.go
  • components/ambient-sdk/go-sdk/types/inbox_message.go
  • components/ambient-sdk/go-sdk/types/list_options.go
  • components/ambient-sdk/go-sdk/types/project.go
  • components/ambient-sdk/go-sdk/types/project_settings.go
  • components/ambient-sdk/go-sdk/types/role.go
  • components/ambient-sdk/go-sdk/types/role_binding.go
  • components/ambient-sdk/go-sdk/types/scheduled_session.go
  • components/ambient-sdk/go-sdk/types/session.go
  • components/ambient-sdk/go-sdk/types/session_message.go
  • components/ambient-sdk/go-sdk/types/user.go
  • components/ambient-sdk/python-sdk/ambient_platform/__init__.py
  • components/ambient-sdk/python-sdk/ambient_platform/_agent_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_base.py
  • components/ambient-sdk/python-sdk/ambient_platform/_credential_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_inbox_message_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_iterator.py
  • components/ambient-sdk/python-sdk/ambient_platform/_project_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_project_settings_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_role_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_role_binding_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_session_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_session_message_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_user_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/agent.py
  • components/ambient-sdk/python-sdk/ambient_platform/client.py
  • components/ambient-sdk/python-sdk/ambient_platform/credential.py
  • components/ambient-sdk/python-sdk/ambient_platform/inbox_message.py
  • components/ambient-sdk/python-sdk/ambient_platform/project.py
  • components/ambient-sdk/python-sdk/ambient_platform/project_settings.py
  • components/ambient-sdk/python-sdk/ambient_platform/role.py
  • components/ambient-sdk/python-sdk/ambient_platform/role_binding.py
  • components/ambient-sdk/python-sdk/ambient_platform/scheduled_session.py
  • components/ambient-sdk/python-sdk/ambient_platform/session.py
  • components/ambient-sdk/python-sdk/ambient_platform/session_message.py
  • components/ambient-sdk/python-sdk/ambient_platform/user.py
  • components/ambient-sdk/ts-sdk/src/agent.ts
  • components/ambient-sdk/ts-sdk/src/agent_api.ts
  • components/ambient-sdk/ts-sdk/src/base.ts
  • components/ambient-sdk/ts-sdk/src/client.ts
  • components/ambient-sdk/ts-sdk/src/credential.ts
  • components/ambient-sdk/ts-sdk/src/credential_api.ts
  • components/ambient-sdk/ts-sdk/src/inbox_message.ts
  • components/ambient-sdk/ts-sdk/src/inbox_message_api.ts
  • components/ambient-sdk/ts-sdk/src/index.ts
  • components/ambient-sdk/ts-sdk/src/project.ts
  • components/ambient-sdk/ts-sdk/src/project_api.ts
  • components/ambient-sdk/ts-sdk/src/project_settings.ts
  • components/ambient-sdk/ts-sdk/src/project_settings_api.ts
  • components/ambient-sdk/ts-sdk/src/role.ts
  • components/ambient-sdk/ts-sdk/src/role_api.ts
  • components/ambient-sdk/ts-sdk/src/role_binding.ts
  • components/ambient-sdk/ts-sdk/src/role_binding_api.ts
  • components/ambient-sdk/ts-sdk/src/scheduled_session.ts
  • components/ambient-sdk/ts-sdk/src/scheduled_session_api.ts
  • components/ambient-sdk/ts-sdk/src/session.ts
  • components/ambient-sdk/ts-sdk/src/session_api.ts
  • components/ambient-sdk/ts-sdk/src/session_message.ts
  • components/ambient-sdk/ts-sdk/src/session_message_api.ts
  • components/ambient-sdk/ts-sdk/src/user.ts
  • components/ambient-sdk/ts-sdk/src/user_api.ts

Comment on lines +45 to +47
def start(self, resource_id: str) -> dict:
resp = self._client._request("POST", f"{self._base_path()}/{resource_id}/start")
return Agent.from_dict(resp)
return resp
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Public contract break in AgentAPI.start() return type

Line 45 changes start() from returning Agent to returning raw dict, and Line 47 now skips Agent.from_dict(...). That is a breaking SDK API change for typed consumers. Please either preserve the typed return for backward compatibility or explicitly treat this as a breaking release (semver + migration note).

As per coding guidelines, “Prioritize Critical and Major severity issues. Minimize Minor and Trivial findings.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/ambient-sdk/python-sdk/ambient_platform/_agent_api.py` around
lines 45 - 47, AgentAPI.start() now returns a raw dict instead of the typed
Agent object, breaking the public contract; restore the previous behavior by
converting the response into an Agent before returning (use Agent.from_dict on
the response) or, if intentionally breaking, update the SDK release notes and
bump version accordingly; locate the start method in class AgentAPI and either
wrap the existing resp with Agent.from_dict(resp) and return that, or add an
explicit breaking-change comment and semver bump step in the release plan.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not a regression — this is intentional. The generator detects that Agent's start action returns StartResponse (not Agent), so it correctly falls through to the generic dict return. Previously, the generator didn't emit a start method for Agent at all.

Supporting cross-resource return types (like StartResponse) would require the generator to resolve $refs across OpenAPI spec files and add cross-resource imports to templates — a valid enhancement tracked separately, not in scope for this PR.

Comment on lines +45 to +59
def resume(self, resource_id: str) -> ScheduledSession:
resp = self._client._request("POST", f"{self._base_path()}/{resource_id}/resume")
return ScheduledSession.from_dict(resp)

def runs(self, resource_id: str) -> dict:
resp = self._client._request("GET", f"{self._base_path()}/{resource_id}/runs")
return resp

def suspend(self, resource_id: str) -> ScheduledSession:
resp = self._client._request("POST", f"{self._base_path()}/{resource_id}/suspend")
return ScheduledSession.from_dict(resp)

def trigger(self, resource_id: str) -> dict:
resp = self._client._request("POST", f"{self._base_path()}/{resource_id}/trigger")
return resp
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify direct interpolation of resource_id into URL paths (without quote()).
rg -nP --type=py 'f"\{self\._base_path\(\)\}/\{resource_id\}(/|")'

Repository: ambient-code/platform

Length of output: 3048


🏁 Script executed:

# Get the full file to see all methods and understand the scope
cd components/ambient-sdk/python-sdk/ambient_platform && wc -l _scheduled_session_api.py

Repository: ambient-code/platform

Length of output: 94


🏁 Script executed:

# Check if quote() is imported and used anywhere in the file
rg -n "from.*quote|import.*quote" components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py

Repository: ambient-code/platform

Length of output: 98


🏁 Script executed:

# Check if any method in this file uses quote() for resource_id
rg -nP "quote\(" components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py

Repository: ambient-code/platform

Length of output: 174


🏁 Script executed:

# Examine the _base_path() method and imports at the top of the file
head -30 components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py

Repository: ambient-code/platform

Length of output: 1167


🏁 Script executed:

# Check the parent class to see if encoding is handled there
rg -n "class ScheduledSessionAPI" components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py

Repository: ambient-code/platform

Length of output: 95


Resource IDs not URL-encoded in path segments—fix must be applied to generator, not generated file

All resource_id parameters (lines 30, 39, 43, 46, 50, 54, 58 and across other API files) are interpolated directly into paths without encoding. Reserved characters (e.g., /, ?, #) will break routing. Use quote(resource_id, safe="") when building path segments.

Critical note: This file is auto-generated (Code generated by ambient-sdk-generator from openapi.yaml — DO NOT EDIT). The fix must be applied to the generator template, not this file—otherwise it will be overwritten on next generation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py`
around lines 45 - 59, The generated methods (resume, runs, suspend, trigger)
interpolate resource_id directly into path segments; update the generator
template (not this generated file) to URL-encode path segment IDs by wrapping
resource_id with urllib.parse.quote(resource_id, safe="") when building
f"{self._base_path()}/{resource_id}/...", and apply the same change for all
generator templates that emit resource_id in paths so calls like
self._client._request("POST", f"{self._base_path()}/{resource_id}/resume")
become self._client._request(..., f"{self._base_path()}/{quote(resource_id,
safe='')}/resume") ensuring encoding is used consistently for functions such as
resume, runs, suspend and trigger and for responses parsed by
ScheduledSession.from_dict.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pre-existing issue — not introduced by this PR. All generated Python API methods (create, get, update, delete) use the same f"{self._base_path()}/{resource_id}" pattern without URL-encoding. The new action methods follow the same convention as existing methods.

Worth fixing in the generator template as a separate PR, but out of scope here.

Comment on lines +40 to 42
async start(id: string, opts?: RequestOptions): Promise<Record<string, unknown>> {
return ambientFetch<Record<string, unknown>>(this.config, 'POST', `${this.basePath()}/${id}/start`, undefined, opts);
}
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find callers of the TS AgentAPI.start() to ensure they've been updated
rg -n --type=ts -C3 '\.start\s*\(' components/
# Also check Go callers of .Start(
rg -n --type=go -C3 '\.Start\s*\(ctx' components/

Repository: ambient-code/platform

Length of output: 4061


🏁 Script executed:

# Check if Agent type is defined in the TS SDK
rg -n --type=ts 'type Agent|interface Agent|class Agent' components/ambient-sdk/ts-sdk/src/

# Look at the full agent_api.ts file to understand context and type imports
head -50 components/ambient-sdk/ts-sdk/src/agent_api.ts

# Check the integration test for how the start() response is actually used
sed -n '182,195p' components/ambient-sdk/ts-sdk/tests/integration.test.ts

Repository: ambient-code/platform

Length of output: 3339


🏁 Script executed:

# Check the OpenAPI spec for the start endpoint
rg -A10 'start:' components/ambient-api-server/openapi/openapi.yaml | head -30

# Search for any TS code that accesses specific fields from start() response
rg -n --type=ts 'agents\.start\(' components/ -A5

# Check if there's a SessionCreateResponse or similar type that explains the Record return
rg -n --type=ts 'SessionCreateResponse|SessionStartResponse' components/ambient-sdk/ts-sdk/src/

Repository: ambient-code/platform

Length of output: 2244


🏁 Script executed:

# Find the agents openapi yaml file
find components/ -name 'openapi.agents.yaml' -o -name '*agents*.yaml' | grep -i openapi

# Check the agents start endpoint specification
rg -A20 '/{agent_id}/start:' components/ambient-api-server/openapi/

Repository: ambient-code/platform

Length of output: 244


🏁 Script executed:

# Read the openapi.agents.yaml file to find the start endpoint
cat components/ambient-api-server/openapi/openapi.agents.yaml | grep -A20 "agent_id}/start"

Repository: ambient-code/platform

Length of output: 870


🏁 Script executed:

# Get more of the start endpoint response definition
cat components/ambient-api-server/openapi/openapi.agents.yaml | grep -A40 "agent_id}/start"

Repository: ambient-code/platform

Length of output: 1575


🏁 Script executed:

# Find the StartResponse schema definition
rg -A15 'StartResponse:' components/ambient-api-server/openapi/openapi.yaml | head -40

Repository: ambient-code/platform

Length of output: 503


🏁 Script executed:

# Check if StartResponse type is defined/exported in the TS SDK
rg -n --type=ts 'StartResponse' components/ambient-sdk/ts-sdk/src/

# Check what types are imported/used in agent_api.ts
grep -n 'import' components/ambient-sdk/ts-sdk/src/agent_api.ts

Repository: ambient-code/platform

Length of output: 296


🏁 Script executed:

# Search for StartResponse in the entire TS SDK
find components/ambient-sdk/ts-sdk/src -type f -name '*.ts' -exec grep -l 'StartResponse' {} \;

# Check if there's a schemas or types file that might have StartResponse
ls -la components/ambient-sdk/ts-sdk/src/ | grep -i schema

# Check the full list of exported types from the SDK
grep -E 'export (type|interface|class)' components/ambient-sdk/ts-sdk/src/*.ts | head -30

Repository: ambient-code/platform

Length of output: 2597


🏁 Script executed:

# Check if any code tries to access Agent properties from the start() response
rg -n --type=ts 'start\(' components/ambient-sdk/ts-sdk/ -A3 | grep -E '\.(id|metadata|spec|status|kind)'

Repository: ambient-code/platform

Length of output: 47


🏁 Script executed:

# Double-check: look for any historical references to Agent return type from start()
rg -n 'start.*Agent' components/ambient-api-server/openapi/openapi.agents.yaml

# Check if there's any Session type definition in the SDK that might clarify the intent
rg -n 'export type Session' components/ambient-sdk/ts-sdk/src/

Repository: ambient-code/platform

Length of output: 905


🏁 Script executed:

# Check the context: is this file really newly modified or was it always like this?
# Look at what the start() method signature should be based on spec
cat components/ambient-api-server/openapi/openapi.agents.yaml | grep -B5 -A50 "agent_id}/start" | grep -A2 "StartResponse"

# Verify: is Session type properly exported from SDK?
grep -n 'export.*Session' components/ambient-sdk/ts-sdk/src/session.ts | head -1

# Check the index.ts to see what's exported publicly
grep -i 'session\|start' components/ambient-sdk/ts-sdk/src/index.ts

Repository: ambient-code/platform

Length of output: 1225


Missing StartResponse type in generated SDK — start() should return typed Session response, not generic Record.

The OpenAPI spec defines the agent start endpoint to return StartResponse (with session and start_prompt fields), but the TS SDK generator didn't create this type. The method currently returns Promise<Record<string, unknown>> instead of the proper typed response. While the integration test only checks .toBeDefined(), external callers lose type safety when accessing response fields. Add StartResponse to the generated types.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/ambient-sdk/ts-sdk/src/agent_api.ts` around lines 40 - 42, The
start method in agent_api.ts currently returns Promise<Record<string, unknown>>
instead of the OpenAPI-defined StartResponse; create or add a StartResponse type
(including session and start_prompt fields per the spec) into the generated
types module, export it, then update the start function signature in
agent_api.ts to return Promise<StartResponse> and import/use that type for the
ambientFetch generic; ensure the shape matches the OpenAPI response so callers
get proper type safety.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as the Python finding — intentional. The OpenAPI spec defines Agent's start response as StartResponse (with session and start_prompt fields), which is a cross-resource type not imported by the Agent API module. The generator correctly detects this isn't the parent Agent type and falls through to Record<string, unknown>.

Adding cross-resource type resolution to the generator is a valid follow-up but out of scope for this PR.

Comment on lines +44 to +46
async runs(id: string, opts?: RequestOptions): Promise<Record<string, unknown>> {
return ambientFetch<Record<string, unknown>>(this.config, 'GET', `${this.basePath()}/${id}/runs`, undefined, opts);
}
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.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if Session/SessionList types are exported from the TS SDK
rg -n "export.*SessionList|export.*Session[^A-Z]" components/ambient-sdk/ts-sdk/src/
# Check the openapi spec for the runs endpoint response schema
rg -n "runs" components/ambient-api-server/openapi/openapi.yaml 2>/dev/null | head -40

Repository: ambient-code/platform

Length of output: 1007


🏁 Script executed:

# Check the full context of scheduled_session_api.ts around the runs() method
cd components/ambient-sdk/ts-sdk/src && wc -l scheduled_session_api.ts

Repository: ambient-code/platform

Length of output: 93


🏁 Script executed:

# Read the scheduled_session_api.ts file to see all methods and their return types
cat -n components/ambient-sdk/ts-sdk/src/scheduled_session_api.ts | head -60

Repository: ambient-code/platform

Length of output: 3474


🏁 Script executed:

# Look at the openapi.scheduledSessions.yaml to find the runs endpoint response schema
find components/ambient-api-server/openapi -name "*.yaml" -exec rg -l "runs" {} \;

Repository: ambient-code/platform

Length of output: 185


🏁 Script executed:

# Check the complete OpenAPI definition for the runs endpoint
cat components/ambient-api-server/openapi/openapi.scheduledSessions.yaml | grep -A 30 "runs" | head -50

Repository: ambient-code/platform

Length of output: 1347


Fix runs() return type — generator emitted Record<string, unknown> instead of SessionList.

The OpenAPI spec defines the runs endpoint response as SessionList (from openapi.sessions.yaml#/components/schemas/SessionList), and SessionList is already exported from the TS SDK. However, the code generator produced Record<string, unknown> for this method while correctly typing other endpoints (e.g., list() returns ScheduledSessionList). Callers can't iterate or access list properties without unsafe casting.

The generator should emit SessionList here, matching the OpenAPI schema reference.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/ambient-sdk/ts-sdk/src/scheduled_session_api.ts` around lines 44 -
46, The runs method currently returns a generic Record<string, unknown> but the
OpenAPI schema specifies SessionList; update the runs method signature to return
Promise<SessionList> and ensure the ambientFetch call is typed accordingly so it
returns SessionList (use the exported SessionList type from the SDK), e.g.,
change the generic parameter on ambientFetch in runs and import/reference
SessionList where runs is defined to match other correctly typed endpoints like
list().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By design. The runs endpoint returns SessionList via a cross-file $ref to openapi.sessions.yaml. The generator intentionally uses generic return types for cross-resource references because resolving cross-file $refs and adding cross-resource imports to templates would require significant template changes.

SessionList is exported from the TS SDK, so callers that need the typed response can cast: const runs = await api.runs(id) as SessionList. A generator enhancement to handle cross-resource $refs would eliminate this — tracked as a follow-up.

@mergify mergify Bot added the queued label May 7, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 7, 2026

Merge Queue Status

  • Entered queue2026-05-07 15:52 UTC · Rule: default
  • Checks skipped · PR is already up-to-date
  • Merged2026-05-07 15:53 UTC · at 484b0ae6f54bc54c29e1a5ebadc88be544e09df1 · squash

This pull request spent 19 seconds in the queue, including 3 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit 3b05694 into main May 7, 2026
39 of 41 checks passed
@mergify mergify Bot deleted the jsell/chore/regenerate-sdk branch May 7, 2026 15:53
@mergify mergify Bot removed the queued label May 7, 2026
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