tool/loadartifactstool: return error instead of panic when artifact service is not configured - #1390
Merged
Merged
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Contributor
Author
|
I signed it! |
…ervice is not configured
GerardGao
force-pushed
the
fix/loadartifacts-nil-panic
branch
from
August 25, 2026 13:39
ef62a47 to
e538345
Compare
wolo-lab
self-requested a review
August 27, 2026 12:18
wolo-lab
requested changes
Aug 27, 2026
This was referenced Aug 27, 2026
Per review: the guard lived in appendInitialInstructions, so the ctx.Artifacts() read in processLoadArtifactsFunctionCall was only protected by call ordering. Move the check to the top of ProcessRequest so both paths are covered in one place, and add a test that exercises the function-call path through the public entry.
Contributor
Author
|
Addressed in 455d4be: the guard now lives at the top of |
4 tasks
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.
Fixes #283
What changed
loadartifactstoolnow returns a descriptive error ("load_artifacts tool requires an artifact service to be configured") fromProcessRequestwhen no artifact service is configured, instead of panicking with a nil pointer dereference.agent.NewToolContextandagent.NewCallbackContextWithArtifactTrackingno longer wrap a nilArtifactsintrackedArtifacts, so "no artifact service configured" remains observable as a nilArtifactsinstead of panicking on the first promoted method call.Why
When the
load_artifactstool is registered but no artifact service is configured, the agent panics during request preprocessing (nil pointer dereference intrackedArtifacts.List, previouslyinternalArtifacts.List— see #283). A configuration error should be reported as an error instead of crashing the process.Testing plan
TestLoadArtifactsTool_ProcessRequest_NilArtifacts: constructs a context with no artifact service and assertsProcessRequestreturns an error mentioning the artifact service (this test panicked before the fix).go test ./agent/... ./tool/... ./runner/...— all pass.gofmt -lclean.