Skip to content

test: regression guards for 2026-04-23 hermes + CP bug wave - #1902

Merged
HongmingWang-Rabbit merged 6 commits into
stagingfrom
test/2026-04-23-regression-suite
Apr 24, 2026
Merged

test: regression guards for 2026-04-23 hermes + CP bug wave#1902
HongmingWang-Rabbit merged 6 commits into
stagingfrom
test/2026-04-23-regression-suite

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Closes items in #1900.

3 complementary regression tests for today's P0 chain

1. E2E A2A specific error-pattern checks (tests/e2e/test_staging_full_saas.sh)

Old assertion: substring-match error|exception. Too broad — missed the actual failure modes + poor diagnostics. Now each known error class has a dedicated check with a diagnostic fail pointing at the exact bug:

  • [hermes-agent error 401] → hermes#12 (API_SERVER_KEY not in runtime env)
  • hermes-agent unreachable → gateway process died
  • model_not_found → hermes#13 (slug prefix)
  • Encrypted content is not supported → hermes#14 (api_mode)
  • Unknown provider → bridge PROVIDER misconfig regression

Also asserts PONG token in response — catches silent echo/truncation.

2. Hermes install.sh bridge shell harness (tools/test-hermes-bridge.sh)

4 scenarios × 16 assertions, offline, <1s. Invokes derive-provider.sh + bridge if-block against fixed env permutations:

  • openai-bridge-happy: OPENAI_API_KEY + openai/gpt-4o → custom/gpt-4o/chat_completions
  • operator-custom-wins: explicit HERMES_CUSTOM_* → bridge skipped
  • openrouter-not-touched: OPENROUTER_API_KEY → openrouter + slug kept
  • non-prefixed-model: bare gpt-4o → prefix-strip is no-op

Every assertion pins an invariant from today's fixes. Drift breaks a test.

3. Canvas ConfigTab hermes vitest (ConfigTab.hermes.test.tsx)

5 test cases pinning #1894 behavior:

  • Runtime loaded from workspace metadata when config.yaml missing
  • No red "No config.yaml found" error for hermes
  • Hermes info banner shown instead
  • Langgraph still gets the red error (regression-guard other direction)
  • config.yaml runtime wins over workspace metadata when present

Run locally

bash tools/test-hermes-bridge.sh                                       # shell
cd canvas && npx vitest run src/components/tabs/__tests__/ConfigTab.hermes.test.tsx   # vitest
# E2E: existing staging workflow uses the enhanced script

Not yet covered

CP-side tests (admin-delete cascade, cp-provisioner instance_id, purge audit SQL, pq statement cache) are tracked in #1900 — separate PRs in the controlplane repo.

Includes

This PR cherry-picks #1898 so the vitest tests pass on this branch's base — the canvas fix + its tests ship together. When #1898 merges first, this will resolve cleanly on rebase.

Comment thread canvas/src/components/tabs/__tests__/ConfigTab.hermes.test.tsx Fixed
@HongmingWang-Rabbit
HongmingWang-Rabbit force-pushed the test/2026-04-23-regression-suite branch from 9a710c4 to c4811ca Compare April 24, 2026 00:03
@molecule-ai

molecule-ai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Review — PR #1902 ✅ LGTM (comprehensive regression guard suite)

test: regression guards for 2026-04-23 hermes + CP bug wave

Quality assessment

Three complementary regression test suites, all well-documented with bug references:

1. E2E A2A error pattern checks (test_staging_full_saas.sh): Replaces the generic error|exception substring check with specific error-class assertions. Each pattern pins a real P0 bug from 2026-04-23 (hermes gateway auth, provider slug passthrough, codex_responses misroute, bridge PROVIDER misconfig). Fail message is unambiguous — includes bug reference. ✅

2. Hermes bridge shell harness (tools/test-hermes-bridge.sh): 4 scenarios × 16 assertions, offline, <1s. Covers both "must fire" and "must not fire" invariants for provider bridging. Invokes derive-provider.sh + bridge if-block against fixed env permutations. ✅

3. Canvas ConfigTab vitest (ConfigTab.hermes.test.tsx): 5 test cases pinning #1894 behavior. Covers the hermes workspace UX regression: empty model field, wrong runtime dropdown, scary red banner. Also guards against overcorrection (LangGraph still shows red error when it should). ✅

4. CPProvisioner instance ID tests (cp_provisioner_instance_id_test.go): 127 lines covering the EC2 instance ID lookup fix from PR #1738. Documents the original bug clearly (UUID passed as instance_id → AWS Malformed error → cascade failure). Pins two invariants of the fix. ✅

No concerns

Tests are regression guards, not new features. All code is additive. Comment density is high but justified — each test pins a specific production incident.

Verdict

APPROVE (comment). Excellent test coverage. Guards the 2026-04-23 bug wave comprehensively. Ready to merge.

@HongmingWang-Rabbit
HongmingWang-Rabbit force-pushed the test/2026-04-23-regression-suite branch from c4811ca to 170a591 Compare April 24, 2026 00:43
Hongming Wang and others added 2 commits April 23, 2026 17:45
Three complementary regression tests for the chain of P0s fixed today.
Each targets a specific bug class that reached production, and will
fire loud if any of them regress.

## 1. E2E A2A assertion enhancements (tests/e2e/test_staging_full_saas.sh)

The existing A2A check looked for "error|exception" in the response text,
which was too broad and missed the actual error patterns we hit. Now
matches each known error class individually with a diagnostic fail
message pointing at the exact bug:

  - "[hermes-agent error 401]"        → hermes #12 (API_SERVER_KEY)
  - "hermes-agent unreachable"        → gateway process died
  - "model_not_found"                 → hermes #13 (model prefix)
  - "Encrypted content is not supported" → hermes #14 (api_mode)
  - "Unknown provider"                → bridge PROVIDER misconfig

Also asserts the response contains the PONG token the prompt asked for —
catches silent-truncation/echo regressions.

## 2. Hermes install.sh bridge shell harness (tools/test-hermes-bridge.sh)

4 scenarios × 16 assertions, all offline (no docker, no network):

  - openai-bridge-happy: OPENAI_API_KEY + openai/gpt-4o →
    provider=custom, model="gpt-4o" (prefix stripped),
    api_mode=chat_completions
  - operator-custom-wins: explicit HERMES_CUSTOM_* → bridge skipped
  - openrouter-not-touched: OPENROUTER_API_KEY → provider=openrouter,
    slug kept
  - non-prefixed-model: bare "gpt-4o" → prefix-strip is a no-op

Runs in <1s, can be wired into template-hermes CI. Pins the exact
config.yaml shape — any drift in derive-provider.sh or the bridge
if-block breaks a test.

## 3. Canvas ConfigTab hermes tests (ConfigTab.hermes.test.tsx)

5 vitest cases covering the #1894 bugs:

  - Runtime loads from workspace metadata when config.yaml missing
  - "No config.yaml found" red error hidden for hermes
  - Hermes info banner shown instead
  - Langgraph workspace still sees the red error (regression-guard the
    other way)
  - config.yaml runtime wins over workspace metadata when present

## Running

  bash tools/test-hermes-bridge.sh                # 16 assertions
  cd canvas && npx vitest run src/components/tabs/__tests__/ConfigTab.hermes.test.tsx  # 5 cases
  # E2E enhancements ride on the existing staging E2E workflow

## Not yet covered (tracked in #1900)

CP admin delete-tenant EC2 cascade, cp-provisioner instance_id
lookup (#1738), purge audit SQL mismatch (#241), and pq prepared-
statement cache collision (#242). These are in-controlplane-repo
concerns — separate PR with CP-side sqlmock + integration tests.

Closes items in #1900.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pins the fix-invariants from PR #1738 (merged 2026-04-23) against
regression. Pre-fix, `CPProvisioner.Stop` and `IsRunning` both passed
the workspace UUID as the `instance_id` query param:

    url := fmt.Sprintf("%s/cp/workspaces/%s?instance_id=%s",
                        baseURL, workspaceID, workspaceID)
                                              ^ should be the real i-* ID

AWS rejected downstream with InvalidInstanceID.Malformed, orphaned the
EC2, and the next provision hit InvalidGroup.Duplicate on the leftover
SG — full Save & Restart cascade failure.

## Tests added

- **TestStop_UsesRealInstanceIDNotWorkspaceUUID**: stub resolveInstanceID
  to return an i-* ID, assert the CP request's instance_id query param
  carries that i-* value (not the workspace UUID).
- **TestStop_NoInstanceIDSkipsCPCall**: empty DB lookup → no CP call at
  all (idempotent). Guards against re-introducing the "call CP with ''
  and let AWS reject" footgun.
- **TestIsRunning_UsesRealInstanceIDNotWorkspaceUUID**: mirror for the
  /cp/workspaces/:id/status path — same bug shape.

All 3 pass on current staging (which has the fix). Reverting either
Stop or IsRunning to the pre-#1738 shape causes these to fail loud.

Extends molecule-core#1902's regression suite.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit force-pushed the test/2026-04-23-regression-suite branch from 170a591 to 9ce8d97 Compare April 24, 2026 00:45

@molecule-ai molecule-ai 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.

CI green, no conflicts. Approving — ready for @airenostars merge.

@HongmingWang-Rabbit
HongmingWang-Rabbit merged commit b752c3c into staging Apr 24, 2026
13 of 14 checks passed
@molecule-ai
molecule-ai Bot deleted the test/2026-04-23-regression-suite branch May 20, 2026 06:22
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