fix(api): agent_action URLs must use api-host for /api/v1 paths#213
Merged
Conversation
Eleven agent_action strings shipped pointing /api/v1 calls at the marketing host (https://instanode.dev/api/v1/...), which returns HTML 404 on every path. The canonical API host is api.instanode.dev. Every LLM agent that hit one of these walls relayed a non-working URL to the user, who then wasted a curl/POST attempt. Live verification of the bug surface: - curl https://instanode.dev/api/v1/resources -> HTTP/2 404 (HTML) - curl https://api.instanode.dev/api/v1/resources -> HTTP/2 401 (JSON) Fix: - Flip 11 sites in agent_action.go (3) + helpers.go (8) to https://api.instanode.dev/api/v1/... - Relax assertContract URL check to accept either canonical host (marketing https://instanode.dev/ for dashboard URLs, api host for programmatic API paths). Docblock now spells out the two surfaces. - Add TestAgentActionContract_APIPathsUseAPIHost — registry-iterating regression test that asserts no /api/v path appears on the marketing host. Iterates the live contract registry plus the long-form deploy-TTL builder (which was already correct but had been excluded from the contract gate for length). Verified to fail-fast on any re-introduction of the bug (rule 18). - Update one collateral test assertion in resource_pause_test.go to use the dual-host check so AgentActionResourceAlreadyPaused still satisfies its per-handler URL assertion. Coverage (CLAUDE.md rule 17): Symptom: agent_action returns "POST https://instanode.dev/api/v1/..." -> HTML 404 on the marketing site Enumeration: rg -nF 'https://instanode.dev/api/' internal/ -> 11 sites Sites found: 11 Sites touched: 11 Coverage test: TestAgentActionContract_APIPathsUseAPIHost (registry-iterating) Live verified: curl host-comparison above Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eleven
agent_actionstrings shipped pointing/api/v1calls at themarketing host (
https://instanode.dev/api/v1/...), which returns HTML404 on every path. The canonical API host is
api.instanode.dev.Every LLM agent that hit one of these walls relayed a non-working URL
to the user — they would then waste a
curl/POSTattempt and get anHTML 404 instead of the JSON they expected.
Live verification of the bug:
Changes
internal/handlers/agent_action.go(3 sites:AgentActionResourceAlreadyPaused,newAgentActionBindingNotFound,newAgentActionBindingNoEnvTwin) andinternal/handlers/helpers.go(8 sites in
codeToAgentAction) to usehttps://api.instanode.dev/api/v1/....assertContractURL check inagent_action_contract_test.goto accept either canonical host (marketing
https://instanode.dev/for dashboard URLs, api host for programmatic API paths). The
docblock now spells out the two surfaces.
TestAgentActionContract_APIPathsUseAPIHost— registry-iteratingregression test that asserts no
/api/vpath appears on themarketing host. Iterates the live contract registry plus the
long-form deploy-TTL builder (which was already correct but had been
excluded from the contract gate for length). Verified to fail-fast
on any re-introduction of the bug (CLAUDE.md rule 18).
resource_pause_test.gotothe dual-host check so
AgentActionResourceAlreadyPausedcontinuesto satisfy its per-handler URL assertion.
Coverage block (CLAUDE.md rule 17)
Test plan
go build ./...cleango vet ./...cleanTestAgentActionContractPASS (includes the relaxed dual-host check)TestAgentActionContract_APIPathsUseAPIHostPASS (the new gate)TestAgentActionContract_RegistryCoveragePASSrestored after verification
TestPause*/TestResume*/TestResidualPause*PASS (thehandler tests that exercise the changed
AgentActionResourceAlreadyPaused)TestRedeploy*/TestDeployRedeploy*happy-path PASS (theno_existing_deployment_to_redeploycode path)curl /healthzshows new SHA, then a synthetichit on a 4xx wall (e.g. anon team tries to remove primary user)
surfaces the corrected URL
Notes
origin/master(TestLinkGitHubID,TestDeployRedeploy_Goroutine_ComputeDeadline) are unrelated to thischange and reproduce on a clean checkout of
origin/master. Theysurface only in local runs against the shared test-pg; CI's
per-package isolation handles them. (See memory
feedback_coverage_measure_per_package_not_dotdotdot.md.)Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com