🩹 fix: define appConfig in Responses API createResponse

responses.js referenced `appConfig` on lines 381 / 396 without ever
declaring it, so `createResponse` threw `ReferenceError: appConfig is
not defined` the moment it entered the skills-capability block. The
existing `recordCollectedUsage` unit tests silently stopped running
(try/catch swallowed the error into `logger.error`), so CI showed
6 assertions failing with "Expected calls: 1, Received: 0" — the
function never reached the recorder.

Mirror initialize.js: seed `appConfig = req.config` at the top of the
try block, before the `enabledCapabilities` Set it feeds into. The two
later `appConfig: req.config` call-sites keep the direct reference —
only the lexical reads needed a binding.

This failure already exists on origin/feat/agent-skills (the same 6
tests fail there with the same stack) but blocks our branch too since
we're rebased on top, so fix it here and cherry-pick back if needed.
This commit is contained in:
Danny Avila 2026-04-21 13:19:35 -04:00
parent d08e78415c
commit 2463b6acd9

View file

@ -377,6 +377,7 @@ const createResponse = async (req, res) => {
getSkillByName: db.getSkillByName,
};
const appConfig = req.config;
const enabledCapabilities = new Set(
appConfig?.endpoints?.[EModelEndpoint.agents]?.capabilities,
);