Skip to content

feat(acp): backend deployment, ACP WebSocket, T5/T6 test tiers - #1498

Merged
pdettori merged 60 commits into
rossoctl:mainfrom
Ladas:feat/acp-backend-t5-t6
May 27, 2026
Merged

pdettori merged 60 commits into
rossoctl:mainfrom
Ladas:feat/acp-backend-t5-t6

Conversation

@Ladas

@Ladas Ladas commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Deploy kagenti-backend in the openshell stack (Step 7 in deploy-shared.sh) with PostgreSQL sessions DB, idempotent and skippable
  • ACP WebSocket endpoint at /api/v1/acp/ws/{namespace}/{agent_name} with JSON-RPC 2.0 protocol bridging to A2A agents, gated behind KAGENTI_FEATURE_FLAG_ACP
  • T5 Backend API tests (~15 tests): validates production A2A proxy path through kagenti-backend instead of per-agent port-forwards — connectivity, send, stream, multiturn, agent list, error handling, concurrency
  • T6 ACP Protocol tests (~15 tests): WebSocket lifecycle (initialize, session/new|close), prompt relay, ACP-to-A2A bridge roundtrip, session management, permission gates, error handling
  • Scorecard fix: move pending commit status to dedicated e2e-openshell-pending.yaml workflow, resolving 4 TokenPermissions alerts from PR fix(openshell): ADK policy port 4000, Claude flake guard, workflow paths #1489

ACP Protocol Methods

Method Description
initialize Capability exchange
authenticate Pass-through (PoC)
session/new Create session
session/prompt Relay to A2A agent, stream updates
session/close Cleanup session
session/list Enumerate sessions
session/resume Reconnect to session
session/request_permission HITL gate (auto-approve PoC)

DAM Integration

The ACP endpoint is designed to be compatible with DAM (formerly Humr, now at dam-agents/dam) which uses ACP as its sole agent protocol via WebSocket. Detailed integration plan will follow in the design doc update.

Test plan

  • CI Kind passes with existing T0-T4 tests (no regression)
  • uv run pytest test_T5_1_backend_api.py --collect-only shows ~15 test items
  • uv run pytest test_T6_1_acp_protocol.py --collect-only shows ~15 test items
  • Deploy backend on Kind cluster and run T5/T6 tests with OPENSHELL_BACKEND_AVAILABLE=true
  • Scorecard TokenPermissions alerts reduced after merge

Assisted-By: Claude Code

@Ladas

Ladas commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
@Ladas

Ladas commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 3c9a5b13ad68c59d656a06338244d395f42cb85e
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 1dc443ed1fb2ee3b1f26bf5612e8036d5b812bc8
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review Summary

Solid PoC implementation of ACP WebSocket with proper feature-flag gating, correct commit conventions, and clean CI refactor. Two concurrency/resource-management issues need fixing before merge.

Areas reviewed: Python (ACP endpoint, bridge service, tests), Shell (deploy script), CI/GitHub Actions, Docs
Commits: 4, all signed-off ✓
CI: Core checks pass. OpenShell PoC CI fails as expected (new test tiers need backend deployed).

Assisted-By: Claude Code

try:
while True:
raw = await websocket.receive_text()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

must-fix: No WebSocket disconnect handler — when a client drops the connection, sessions stored in _bridge._sessions are never cleaned up, causing unbounded memory growth.

This while True loop needs a try/finally (or try/except WebSocketDisconnect) that calls a cleanup method on the bridge to remove sessions associated with this connection.

def __init__(self):
self._sessions: dict[str, ACPSession] = {}

def server_capabilities(self) -> dict:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

must-fix: _sessions dict on the module-level singleton has no async lock. Concurrent WebSocket connections mutating self._sessions will race.

Fix: add an asyncio.Lock and acquire it around _sessions mutations, or use a connection-scoped session store instead of a shared dict.

@@ -0,0 +1,156 @@
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: The WebSocket endpoint at /ws/{namespace}/{agent_name} performs no authorization check — any client can connect to any namespace/agent. Even as a PoC, a TODO comment noting the need for namespace-level authz would help track the gap.

try:
async with httpx.AsyncClient(timeout=120.0) as client:
async with client.stream(
"POST",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: The httpx timeout is hardcoded to 120s. Long-running agent operations may exceed this. Consider making it configurable via settings or at least extracting to a module-level constant.

# Enable backend API tests if kagenti-backend is deployed and healthy
if kubectl get deploy kagenti-backend -n team1 &>/dev/null; then
READY=$(kubectl get deploy kagenti-backend -n team1 -o jsonpath='{.status.readyReplicas}' 2>/dev/null || echo "0")
if [ "${READY:-0}" -ge 1 ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: kubectl get deploy checks existence but not actual readiness. A deployment can exist with 0 ready replicas. Consider kubectl wait --for=condition=Available --timeout=60s before setting OPENSHELL_BACKEND_AVAILABLE=true.

context_id = event.get("result", {}).get("contextId", "")
if context_id and not session.context_id:
session.context_id = context_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Session context_id is stored in-memory only — lost on pod restart. Since PostgreSQL is deployed alongside for sessions, consider persisting it there in a follow-up to enable true multi-turn continuity across restarts.

@Ladas

Ladas commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 3c9a5b13ad68c59d656a06338244d395f42cb85e
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
Comment thread kagenti/backend/app/routers/acp.py Fixed
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 0c5ea70356f1f83988920b4fd47261ff39d4662a
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

1 similar comment
@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: c36c2b8e4254dc01071923eb9a96cedef1c2d28a
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: dc81d7bbe3a415e8fe6401d7ae8759cf4bfca701
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

1 similar comment
@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: c36c2b8e4254dc01071923eb9a96cedef1c2d28a
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 9bb3f83119d6c797ee9050581014acbf68229e67
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: ae52b9fd63fc67bba6171365d805222d6dc90bc4
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 5823b8bfa520c7fb3dc7f281421f5b8a31120778
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

1 similar comment
@Ladas

Ladas commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: e7af930e63e30f7ce93415f8067047dfcae8baa7
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

Prompt step was using a label selector that doesn't match (controller
doesn't propagate CR labels to pods). Switch to name-based grep with
30s retry loop. Send all log messages to stderr so stdout is clean for
machine-readable output. Fix prompt assertion to check full output.

Signed-off-by: Ladislav Smola <[email protected]>
@github-actions

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 833d705f538c7a60d7918b06adad6e0bf31522af
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@Ladas
Ladas force-pushed the feat/acp-backend-t5-t6 branch from 833d705 to db003c8 Compare May 21, 2026 16:13
@Ladas

Ladas commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: db003c85f39e0711ef62d06538e82b45d0110a0d
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

… gRPC

Replace kubectl exec shortcut with proper OpenShell gateway integration.
The ACP bridge now calls ExecSandbox gRPC via mTLS instead of exec-ing
directly into pods, providing session management, credential injection,
and audit logging through the gateway.

- Vendor minimal ExecSandbox proto from kagenti/openshell
- Add grpcio dependency to backend
- New OpenShellGatewayClient with TLS credential caching
- Replace _prompt_sandbox kubectl exec with ExecSandbox streaming
- 9 unit tests for TLS loading, caching, streaming, error handling

Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

Generated gRPC stubs use PascalCase method names (ExecSandbox) which
violate N802. Exclude *_pb2*.py from both root and backend ruff config.

Signed-off-by: Ladislav Smola <[email protected]>
@github-actions

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 785dd488d9f091a7063fe1b918adce9bf6ffff96
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

Ladas added 2 commits May 22, 2026 14:33
Add teleport usage documentation at docs/agentic-runtime/teleport.md
covering prerequisites, quick start, step-by-step usage, and test matrix.

Expand T7 tests from 4 to 10:
- test_teleport__full_mode (--full flag lifecycle)
- test_teleport__skills_packaged (TELEPORT_SKILLS env var)
- test_teleport__no_action (error: no action)
- test_teleport__deploy_without_session (error: missing --session)
- test_teleport__prompt_without_session (error: missing --session)
- test_teleport__cleanup_without_session (error: missing --session)

Add missing permissions to settings.json for teleport and git operations.

Signed-off-by: Ladislav Smola <[email protected]>
Add --spawn flag for bare sandbox creation without local context,
enabling remote session delegation without teleporting local files.

Add credential isolation test verifying sandbox only sees LiteLLM
virtual key, never real MaaS/Vertex API keys.

Update teleport doc with spawn examples and credential isolation
architecture diagram.

12 T7 tests pass (was 10):
- test_teleport__spawn_creates_sandbox
- test_teleport__spawn_credential_isolation

Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: cc2670bccffc3998c7ed2a3a1ac889516a7855ce
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

Ladas added 2 commits May 25, 2026 08:53
Fix discrepancies between docs and script:
- SKILL.md: destination path $HOME not /workspace (fixed in c39fe50)
- SKILL.md: size limit 800KB not 900KB (fixed in 75a1472)
- SKILL.md: add --spawn mode, TELEPORT_SKILLS, credential isolation
- teleport.md: add Actions table listing all 6 flags including --spawn

Signed-off-by: Ladislav Smola <[email protected]>
…te diagrams

Convert stateDiagram-v2 to flowchart (mermaid state diagrams don't render
visible arrowheads on GitHub). Style all nodes with explicit fill colors
to prevent white-on-white invisibility. Simplify overloaded diagrams.

Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 014df6f0a8f4a83f7827eeca5d7eb11eda77f06d
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All review feedback from the initial round has been addressed — both must-fix items (WebSocket disconnect cleanup, async lock on _sessions) are resolved, along with the suggestions (auth check, timeout constant, deployment readiness). The only remaining item is the nit about PostgreSQL persistence for context_id, which is a reasonable follow-up.

CI note: The Kind resource exhaustion failure (Helm timeout on openshell-team2) is partially related to the expanded workload footprint. The HyperShift and flaky LLM test failures are unrelated infrastructure/test issues.

@pdettori
pdettori merged commit e8530df into rossoctl:main May 27, 2026
26 of 27 checks passed
@github-project-automation github-project-automation Bot moved this from New /:ToDo to Done in Rossoctl Issue Prioritization May 27, 2026
@Ladas

Ladas commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e-openshell

@github-actions

Copy link
Copy Markdown

❌ [Experimental] OpenShell E2E Tests Failed

Commit: 014df6f0a8f4a83f7827eeca5d7eb11eda77f06d
Workflow: View logs


Non-voting. Re-run: /run-e2e-openshell

Ladas added a commit to Ladas/kagenti that referenced this pull request May 29, 2026
Add 3 T6 tests for sandbox agents via ACP WebSocket:
- test_T6_sandbox__initialize: ACP handshake works for sandbox agent name
- test_T6_sandbox__session_lifecycle: create/close session
- test_T6_sandbox__prompt_response: send prompt, get response via ExecSandbox

Initialize and session tests pass. Prompt test requires backend with
ExecSandbox gRPC client (PR rossoctl#1689 — currently uses kubectl exec fallback
on deployed backend from merged PR rossoctl#1498).

Signed-off-by: Ladislav Smola <[email protected]>
Ladas added a commit to Ladas/kagenti that referenced this pull request Jun 5, 2026
Add 3 T6 tests for sandbox agents via ACP WebSocket:
- test_T6_sandbox__initialize: ACP handshake works for sandbox agent name
- test_T6_sandbox__session_lifecycle: create/close session
- test_T6_sandbox__prompt_response: send prompt, get response via ExecSandbox

Initialize and session tests pass. Prompt test requires backend with
ExecSandbox gRPC client (PR rossoctl#1689 — currently uses kubectl exec fallback
on deployed backend from merged PR rossoctl#1498).

Signed-off-by: Ladislav Smola <[email protected]>
Ladas added a commit to Ladas/kagenti that referenced this pull request Jun 6, 2026
Add 3 T6 tests for sandbox agents via ACP WebSocket:
- test_T6_sandbox__initialize: ACP handshake works for sandbox agent name
- test_T6_sandbox__session_lifecycle: create/close session
- test_T6_sandbox__prompt_response: send prompt, get response via ExecSandbox

Initialize and session tests pass. Prompt test requires backend with
ExecSandbox gRPC client (PR rossoctl#1689 — currently uses kubectl exec fallback
on deployed backend from merged PR rossoctl#1498).

Signed-off-by: Ladislav Smola <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants