Skip to content

fix(resource): support all plugin-bearing resource types in fetch_latest_conf#13663

Open
AlinsRan wants to merge 1 commit into
apache:masterfrom
AlinsRan:fix/fetch-latest-conf-all-plugin-resources
Open

fix(resource): support all plugin-bearing resource types in fetch_latest_conf#13663
AlinsRan wants to merge 1 commit into
apache:masterfrom
AlinsRan:fix/fetch-latest-conf-all-plugin-resources

Conversation

@AlinsRan

@AlinsRan AlinsRan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #13458 (and issue #13456).

resource.fetch_latest_conf only whitelisted upstreams/routes/services/stream_routes. Any resource that attaches plugins via _meta.parent (set by plugin.set_plugins_meta_parent) but isn't in that list — plugin_configs, global_rules, consumers, consumer_groups — hit unsupported resource type and returned nil.

Concretely, ai-proxy-multi with multiple instances referenced through a plugin_config_id calls fetch_latest_conf(conf._meta.parent.resource_key) in pick_target, gets nil, and the request fails with failed to fetch the parent config (5xx). The same 5xx happens for ai-proxy-multi carried by a global_rule / consumer / consumer_group.

#13458 fixed only plugin_configs by adding one more branch. As @nic-6443 pointed out there, every supported prefix just maps to itself, so this replaces the if/else chain with a whitelist lookup table covering all plugin-bearing resource types; each maps to its /<type> top-level config key.

Fixes

Supersedes #13458, closes #13456.

Test

Added a regression test in t/plugin/ai-proxy-multi.balancer.t: an ai-proxy-multi plugin_config with two instances, referenced by a route via plugin_config_id. Without the fix the request returns 5xx (failed to fetch the parent config); with it, it proxies successfully. Verified locally — the whole file passes, and reverting resource.lua makes only the new test fail.

…est_conf

fetch_latest_conf only whitelisted upstreams/routes/services/stream_routes,
so any resource that attaches plugins via _meta.parent but wasn't listed
(plugin_configs, global_rules, consumers, consumer_groups) hit
"unsupported resource type" and returned nil. In particular ai-proxy-multi
with multiple instances referenced through a plugin_config_id failed with
"failed to fetch the parent config" (5xx).

Replace the if/else chain with a whitelist lookup table covering every
resource type that can carry plugins; each type maps to its own
"/<type>" top-level config key.

Add a regression test in ai-proxy-multi.balancer.t: an ai-proxy-multi
plugin_config with two instances, referenced by a route via
plugin_config_id, now returns a successful response instead of 5xx.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ai-proxy-multi plugin fails with plugin_config_id when multiple instances are configured

1 participant