During CI (see failing job: https://github.com/math-inc/OpenGauss/actions/runs/24005864186/job/70009361883) the ACP adapter crashes with an ImportError:
ImportError: cannot import name 'AuthMethod' from 'acp.schema'
Observed in: acp_adapter/server.py (import list around line 17) when the ACP server initializes. The repository's declared dependency in pyproject.toml is:
acp = ["agent-client-protocol>=0.8.1,<1.0"]
This report covers two likely root causes and asks for a corrective action:
Problem summary
- The code imports AuthMethod from
acp.schema, but the installed agent-client-protocol version does not provide AuthMethod at that location (or at all), causing the import error and failing the ACP start / CI job.
Possible fixes (pick one as appropriate)
-
Pin/upgrade the agent-client-protocol package to a version that exposes AuthMethod at acp.schema (or otherwise provides the expected API). Update pyproject.toml accordingly (e.g. bump the lower/upper bounds or pin to a specific working release). Verify that the CI environment installs that version.
-
If AuthMethod was moved/renamed in the currently allowed ACP versions, update the import and initialization code in acp_adapter/server.py to use the correct symbol/location or to construct the authentication metadata without relying on AuthMethod (for example, use a plain dict for auth method metadata or the correct class from the current ACP package).
Suggested changes to the code (non-exhaustive)
provider = detect_provider()
auth_methods = None
if provider:
auth_methods = [
{
"id": provider,
"name": f"{provider} runtime credentials",
"description": f"Authenticate Gauss using the currently configured {provider} runtime credentials.",
}
]
- Verify the fix by running the ACP server and CI.
Reproduction
- Run the failing GitHub Actions job (see URL above) or locally with the environment used by CI.
- Run
python -m acp_adapter or gauss acp after installing dependencies via pip install -e '.[acp]' and observe the ImportError.
Expected behavior
- The ACP adapter should import the correct symbols and start without raising ImportError.
Additional notes
pyproject.toml currently constrains agent-client-protocol>=0.8.1,<1.0. If AuthMethod was added in a later major release (>=1.0) then choosing to update the dependency should be done intentionally and with compatibility testing.
Please either update the dependency bounds in pyproject.toml to allow an ACP version that provides AuthMethod, or change the import/use of AuthMethod in acp_adapter/server.py to be compatible with the currently-allowed ACP versions.
During CI (see failing job: https://github.com/math-inc/OpenGauss/actions/runs/24005864186/job/70009361883) the ACP adapter crashes with an ImportError:
Observed in:
acp_adapter/server.py(import list around line 17) when the ACP server initializes. The repository's declared dependency inpyproject.tomlis:This report covers two likely root causes and asks for a corrective action:
Problem summary
acp.schema, but the installedagent-client-protocolversion does not provideAuthMethodat that location (or at all), causing the import error and failing the ACP start / CI job.Possible fixes (pick one as appropriate)
Pin/upgrade the
agent-client-protocolpackage to a version that exposesAuthMethodatacp.schema(or otherwise provides the expected API). Updatepyproject.tomlaccordingly (e.g. bump the lower/upper bounds or pin to a specific working release). Verify that the CI environment installs that version.If
AuthMethodwas moved/renamed in the currently allowed ACP versions, update the import and initialization code inacp_adapter/server.pyto use the correct symbol/location or to construct the authentication metadata without relying onAuthMethod(for example, use a plain dict for auth method metadata or the correct class from the current ACP package).Suggested changes to the code (non-exhaustive)
Option A (depend on ACP having AuthMethod):
pyproject.tomlto allow the ACP version that includesAuthMethod(e.g. set a specific working version range).pip install agent-client-protocol==<version>locally and running the failing code path.Option B (make code compatible with current ACP):
acp_adapter/server.pyinitialize() with a plain mapping or with the correct class from the current ACP version. Example sketch:Reproduction
python -m acp_adapterorgauss acpafter installing dependencies viapip install -e '.[acp]'and observe the ImportError.Expected behavior
Additional notes
pyproject.tomlcurrently constrainsagent-client-protocol>=0.8.1,<1.0. IfAuthMethodwas added in a later major release (>=1.0) then choosing to update the dependency should be done intentionally and with compatibility testing.Please either update the dependency bounds in
pyproject.tomlto allow an ACP version that provides AuthMethod, or change the import/use of AuthMethod inacp_adapter/server.pyto be compatible with the currently-allowed ACP versions.