Skip to content

fix(boxes): Test Connection on existing-box edit form - #126

Merged
sarg3nt merged 1 commit into
mainfrom
fix/test-connection-box-id
May 17, 2026
Merged

fix(boxes): Test Connection on existing-box edit form#126
sarg3nt merged 1 commit into
mainfrom
fix/test-connection-box-id

Conversation

@sarg3nt

@sarg3nt sarg3nt commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Test Connection on the box edit form was failing on existing boxes because the JS sent a non-existent server_id form field. The backend already supports a "look up by box_id, decrypt the stored key, run probe server-side" recovery path at haproxy_config.go:427-449 — it just never received the box_id needed to trigger it.
  • Fix: rename the form field the JS sends (server_idbox_id) and read from the existing readonly box_id input that the edit form already renders. No backend changes needed.
  • Phase 0 of the rotation plan in Auto agent API Key rotation #72; landed independently so the visible bug clears now and the multi-key rotation work that follows starts from a working Test Connection baseline.

Test plan

  • On a freshly-added box, Test Connection succeeds (regression check — this code path was already working).
  • On an existing box opened via the edit form without typing anything into the API Key field, Test Connection succeeds (the actual bug being fixed).
  • On an existing box where the operator pastes a new API key into the field, Test Connection uses the typed key (form takes precedence over stored key when both are present — backend behavior unchanged).
  • On an existing box that has no API key configured at all (rare), Test Connection returns the existing "API key is required" error rather than silently using a stale lookup.
  • make templ-generate && make build clean.

Related

🤖 Generated with Claude Code

The Test Connection button on the box edit screen was failing on
existing boxes because the JS sent a non-existent `server_id` form
field. The backend already supports a "look up by box_id, decrypt
stored key" recovery path (haproxy_config.go:427-449) but never
received the box_id needed to trigger it.

Form field name `server_id` -> `box_id` to match the readonly input
the edit form already renders, and the existing backend path takes
over from there. No changes needed on the backend; this is purely
the missing handshake the recovery code was waiting for.

Phase 0 of the issue-72 plan; landed independently so the visible
bug clears now and the multi-key rotation work that follows starts
from a working Test Connection baseline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 17, 2026 15:33

Copilot AI 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.

Pull request overview

This PR fixes the Box edit form’s “Test Connection” path by sending the existing box_id to the backend so it can load and decrypt the stored API key server-side.

Changes:

  • Updates the Test Connection form payload from server_id to box_id.
  • Adds an inline comment explaining why edit-mode connection tests need box_id.

@sarg3nt
sarg3nt merged commit 58f64f1 into main May 17, 2026
26 checks passed
@sarg3nt
sarg3nt deleted the fix/test-connection-box-id branch May 28, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants