Bug Fix: BFF company/urls/generic Was Returning the Wrong Data
Bug Fix: BFF company/urls/generic Was Returning the Wrong Data
Release: v0.1.91
Severity: High
Area: Backend for Frontend (BFF) · AgentOS integration
What happened
The POST /api/bff/company/urls/generic endpoint is responsible for returning company-level portal URL configuration from AgentOS — things like AgentLogoUrl and HomeUrls that the Vue SPA and Capacitor mobile app use to brand and navigate the portal.
Due to an incorrect wiring in the route handler, this endpoint was actually calling getCompanyBranches() internally, which hits:
GET /{clientName}/company/branches
This endpoint returns branch office records — a completely different data shape. The correct upstream call is:
GET /{clientName}/company/urls
Because the BFF returned a 200 OK either way, the mismatch was silent. The Vue SPA and Capacitor app were consuming branch records wherever URL configuration was expected, with no visible error.
What was fixed
The handler now calls the correct AgentOS endpoint directly:
// Before (incorrect)
const branches = await getCompanyBranches(clientName);
return bffSuccess(branches);
// After (correct)
const data = await letmcClient.get(
`/${encodePath(clientName)}/company/urls`
);
return bffSuccess(data);
The unused getCompanyBranches import has been removed from the route file entirely.
A JSDoc comment has been added to the handler documenting the upstream endpoint and expected response fields:
/**
* Fetch generic (company-wide) portal URLs from the AgentOS API.
*
* Original Lambda: GET /{clientName}/company/urls
* Returns: URL map with AgentLogoUrl, HomeUrls, etc.
* Request body: { clientName }
*/
Test coverage added
Two regression tests have been added to tests/app/api/bff/route.test.ts:
-
Endpoint path test — asserts that calling
POST /api/bff/company/urls/genericresults in a singleletmcClient.getcall to/{clientName}/company/urls, and explicitly asserts the path does not contain/branches. -
Source validation test — reads the route file at test time and asserts that the string
getCompanyBranchesdoes not appear anywhere in it, preventing the dead import from being reintroduced.
Impact
| Surface | Effect |
|---|---|
| Vue SPA | Now receives correct portal URL mappings instead of branch records |
| Capacitor mobile app | Same — correct URL config for logo and home URL routing |
| Public API surface | No change — handler path and request/response shape are unchanged |
| Downstream callers | No migration required |
Related
- PR #61 — fix: BFF company/urls/generic calls correct AgentOS endpoint
- AgentOS upstream:
GET /{clientName}/company/urls