Skip to content

feat(app_server): add /api/v1/epic-poem/name endpoint (test-only, do not merge) - #1608

Open
juanmichelini wants to merge 2 commits into
mainfrom
epic-poem-name
Open

juanmichelini wants to merge 2 commits into
mainfrom
epic-poem-name

Conversation

@juanmichelini

@juanmichelini juanmichelini commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR was created by an AI agent (OpenHands) on behalf of the user.

In plain words

Adds a demo backend endpoint GET /api/v1/epic-poem/name that returns the title used by the /epic-poem slash command.

Why

This is one of four PRs across enterprise, software-agent-sdk, OpenHands/OpenHands, and extensions that together form a single cross-repo feature (/epic-poem). The four PRs must be deployed together for the feature to work end-to-end. The bundle is used to test the verify-this preview-verification automation with a multi-PR, multi-repo bundle — the prior examples only bundled one or two image-pinned PRs.

This PR is the enterprise leg (the backend endpoint). It is the PR that carries the verify-this label that triggers the automation.

Summary

+ openhands/app_server/epic_poem_router.py        (new — GET /api/v1/epic-poem/name → {name: "The OpenHands Epic"})
  openhands/app_server/v1_router.py               (register the router under /api/v1)
+ tests/unit/app_server/test_epic_poem_router.py  (new — asserts the response)

The endpoint is unauthenticated (like /web-client/config) because the Canvas UI calls it pre-conversation, before a user message exists. It returns a fixed, deterministic value so the demo is screenshot-able.

Cross-repo bundle — deploy together

This feature is split across four PRs. The three non-enterprise legs are linked here so the preview-verification automation pins their images alongside this PR's enterprise-server image.

EXTENSIONS_REF=OpenHands/extensions@<merge-sha> must be set on the preview for the /epic-poem command to resolve; the other three legs are pinned by image SHA.

How to Test

pytest tests/unit/app_server/test_epic_poem_router.py — asserts GET /name returns {"name": "The OpenHands Epic"}.

Type

  • Feature
  • Bug fix
  • Refactor
  • Breaking change
  • Docs / chore

Notes

Test-only. Part of a cross-repo /epic-poem demo bundle. Do not merge.


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-f8984ac

Add a demo endpoint that returns the title used by the /epic-poem slash
command. The Canvas UI calls this before invoking the command so the
agent receives a poem name from the enterprise backend.

This is one of four PRs (enterprise + sdk + openhands + extensions) that
form the /epic-poem cross-repo demo used to test the verify-this
preview-verification automation with a multi-PR bundle.

Test-only; do not merge.
@github-actions github-actions Bot added the type: feat A new feature label Dec 1, 2026
@juanmichelini juanmichelini added the verify-this Triggers Preview Verification on https://app.beta.staging.all-hands-testing.dev/canvas/automations/ label Dec 1, 2026
@juanmichelini

juanmichelini commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

🔍 Preview Verification — FAIL

Target: saas-deploy PR #2646 App: https://pr-2646.staging.all-hands.dev
Validates: #1608 (GET /api/v1/epic-poem/name) together with OpenHands/OpenHands#20195 (Canvas composer "Epic Poem" button that calls it)
Timestamp: 2026-12-01T14:58Z
Run ID: 079ce1d9-afd3-47a6-9298-50dabaa1efdb

Result: FAIL

One check failed. The PR description says the endpoint is unauthenticated, like /web-client/config. On the preview it answers 401 NoCredentialsError when called without a session. The logged-in path through the Canvas button works end to end. Either the description or the router registration/auth middleware needs to change.

Baseline smoke

Step Status Detail
preflight ✅ app → 200
positive:login ✅ Keycloak login accepted. The first run got invalid-creds (seed lag); the second run, 60s later, passed.
positive:home ✅ home screen + chat launcher visible
positive:backend ✅ /me 200, role=member
positive:reload ✅ login survived reload
positive:conversation ✅ conversation created
positive:reply ✅ GET /api/v1/app-conversations?ids=<id> → sandbox_status=RUNNING, execution_status=finished on the first poll, and the agent's reply is visible in the conversation. The poll started several minutes after creation, so time-to-reply was not measured.
negative:rejected ✅ wrong password rejected by Keycloak

Feature test — Epic Poem endpoint + composer button

Step Status Intended effect Observed effect (how verified) Screenshot
Endpoint, logged-in session ✅ GET /api/v1/epic-poem/name returns {"name":"The OpenHands Epic"} Session-authenticated request returned 200 with exactly that body (API read-back). n/a
Endpoint, no credentials ❌ PR says it is unauthenticated, as /web-client/config is curl with no session returned 401 {"error":"NoCredentialsError"}. /api/v1/web-client/config returned 200 in the same check. n/a
Button rendered in composer ✅ Sparkle "Epic Poem" button appears in the composer's right action row, on the home and conversation composers data-testid=epic-poem-button present on both. home
Click → backend call → command inserted (conversation composer) ✅ Click sends GET /api/v1/epic-poem/name and inserts /epic-poem into the input Network capture: one GET, 200 application/json; console [epic-poem] poem name: The OpenHands Epic; input text read back as /epic-poem . conversation
Click → command inserted (home composer) ✅ Same as above on the home composer Input text read back as /epic-poem . Each further click appended another /epic-poem . One earlier attempt, made right after page load, left the input empty. It did not recur in later attempts, so it is probably a hydration race. home click
/epic-poem command executes the skill ⏭️ Sending the command runs the extensions skill Not tested. The extensions skill (OpenHands/extensions#1014, EXTENSIONS_REF) is not in this run's list of deployed components. n/a
agent-server /api/epic-poem/name (software-agent-sdk#7220) ⏭️ Second backend leg Not tested. It is not in this run's list of deployed components. n/a

Key screenshots

home
conversation reply
feature step

Other baseline screenshots: reload conversation negative

What was tested

  • Backend endpoint with a session: 200 and the expected body.
  • Backend endpoint without credentials: 401, contradicting the PR description.
  • Canvas button: it triggers the real backend call, and the /epic-poem command is inserted. Checked through network capture, console output and an input-text read-back.
  • Baseline login, reload, conversation creation and agent reply.

Skipped / manual review

  • Running /epic-poem as a skill: the extensions PR is not part of this deployment.
  • agent-server leg: not part of this deployment.
  • No admin-gated behavior is involved, so no admin credentials were needed.

Evidence

Full log: evidence/run-log.json


Generated by an AI agent (OpenHands).

Components under test

Component Version Source
Enterprise server sha-51496a7e9c154ba62e2be6d3e705870af3c45e4d pinned: #1608
Agent server (Software Agent SDK) 1.65.0-python chart default (openhands 0.123.0)
Agent Canvas (OpenHands) sha-c0a42d3 pinned: OpenHands/OpenHands#20195
Automation service 1.37.0 chart default (openhands 0.123.0)
Runtime API 0.18.2 chart default (openhands 0.123.0)
Integrations hub 0.7.5 chart default (openhands 0.123.0)
Plugin directory server 1.2.1 chart default (openhands 0.123.0)
Plugin directory client 1.2.1 chart default (openhands 0.123.0)
OpenHands chart 0.123.0 locked in the preview's Chart.lock
Running app (reported) app 1.102.0, SDK 1.65.0 the deployment's /server_info
Verification plugin 1.13.1 @ 5405792 extensions-private, ref main

@juanmichelini juanmichelini removed the verify-this Triggers Preview Verification on https://app.beta.staging.all-hands-testing.dev/canvas/automations/ label Dec 1, 2026
@all-hands-bot

all-hands-bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Review posted for f8984aca5552

Verdict: ✅ APPROVED. See the review.

This is an automated status.

The Canvas /epic-poem slash command looks the poem name up before a
conversation exists, so the request carries no app session. The auth
middleware treated it like any other /api/v1 route and answered 401
NoCredentialsError (found by the preview-verification run of #1608).
Allowlist it next to /api/v1/web-client/config, which the endpoint is
modeled on.

Also mount the route through v1_router in its test so the test hits the
path the middleware allowlists, and cover the allowlist entry in
test_auth_middleware.py.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  openhands/app_server
  epic_poem_router.py 26
  v1_router.py
Project Total  

This report was generated by python-coverage-comment-action

@all-hands-bot all-hands-bot left a comment •

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.

This review was posted by an AI agent (OpenHands).

Scope: This is a small, self-contained backend leg of a four-repo demo bundle explicitly marked test-only/do-not-merge, used to exercise the verify-this preview-verification automation. The pattern (a real FastAPI router + middleware bypass entry + unit tests, deployed via a real enterprise-server image) matches this repo's own documented cross-repo-testing workflow, so this belongs here and needs no separate architecture decision.

Correctness: epic_poem_router.py is a minimal, deterministic GET /epic-poem/name endpoint, correctly mounted under /api/v1 via v1_router.py (confirmed against openhands/app_server/app.py). The exact-match entry added to SetAuthCookieMiddleware._should_attach's ignore_paths tuple in server/middleware.py is consistent with the existing /api/v1/web-client/config pattern and does not use prefix/startswith matching, so it can't be abused to bypass auth on unintended sub-paths.

History check: The PR's prior commit (51496a7e9) was preview-verified and failed — the endpoint answered 401 NoCredentialsError without a session, contradicting the "unauthenticated like /web-client/config" description. The current head (f8984aca5, pushed after that failure) adds exactly the middleware bypass entry needed to fix that, plus a new unit test (test_middleware_ignores_epic_poem_name_path) that asserts the middleware no longer raises NoCredentialsError for this path — directly covering the reported regression.

Tests/CI: Unit tests for both the router (test_epic_poem_router.py) and the middleware bypass are included and scoped correctly. GitHub Actions checks on this head are green (lint, CodeQL, Docker builds, most Python test shards); two shards were still in progress at review time with no failures reported.

Non-blocking note: The only live preview-verification evidence on this PR (posted 2026-12-01) targeted the earlier, failing commit. No fresh preview-verification run has been posted against this fixed head yet. The unit test gives good confidence the fix is correct, but re-running the verify-this automation against f8984aca5 before relying on this leg to validate the rest of the cross-repo bundle would close that gap.

✅ APPROVED

LLM profile: unknown · Model: openhands/claude-sonnet-5

@juanmichelini juanmichelini added the verify-this Triggers Preview Verification on https://app.beta.staging.all-hands-testing.dev/canvas/automations/ label Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat A new feature verify-this Triggers Preview Verification on https://app.beta.staging.all-hands-testing.dev/canvas/automations/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants