Skip to content

fix: propagate InjectParamsIntoContext error in StartInference and FinishInference#971

Open
unameisfine wants to merge 2 commits intogonka-ai:mainfrom
unameisfine:bugfix/propagate-inject-params-error
Open

fix: propagate InjectParamsIntoContext error in StartInference and FinishInference#971
unameisfine wants to merge 2 commits intogonka-ai:mainfrom
unameisfine:bugfix/propagate-inject-params-error

Conversation

@unameisfine
Copy link
Copy Markdown

Same pattern as #968 (Validation handler) — applied to StartInference and FinishInference.

Problem

When InjectParamsIntoContext fails (e.g. corrupted params store), both handlers log a warning but continue executing with a broken context. Downstream calls to GetDeveloperAccessParams and GetTransferAgentAccessParams then fail silently, effectively bypassing access gates.

Fix

Return error immediately instead of continuing, matching the pattern from #968:

ctx, err := k.Keeper.InjectParamsIntoContext(sdk.UnwrapSDKContext(goCtx))
if err != nil {
    k.LogWarn("...", types.Inferences, "error", err)
    return nil, fmt.Errorf("cannot start/finish inference with stale params: %w", err)
}

Tests

TestStartInference_ReturnsError_WhenInjectParamsFails and TestFinishInference_ReturnsError_WhenInjectParamsFails — corrupt the params store with invalid protobuf, then call the handler:

  • Without fix: FAIL — handler returns nil error, continues with broken params, access gates bypassed
  • With fix: PASS — handler returns "cannot start/finish inference with stale params" immediately

@akup
Copy link
Copy Markdown
Collaborator

akup commented Apr 1, 2026

Same as #968

@unameisfine I think tests here is overkill and just add unneeded code. Please clear the tests from the PR

@unameisfine
Copy link
Copy Markdown
Author

Done — removed both test files in 11d5d96. Only the two msg_server fixes remain.

@akup
Copy link
Copy Markdown
Collaborator

akup commented Apr 1, 2026

Done — removed both test files in 11d5d96. Only the two msg_server fixes remain.

And please rebase

unameisfine added 2 commits April 3, 2026 15:14
…nishInference

When InjectParamsIntoContext fails (e.g. corrupted params store),
StartInference and FinishInference log a warning but continue
executing with a broken context. Downstream calls to
GetDeveloperAccessParams and GetTransferAgentAccessParams then
fail silently, bypassing access gates.

Return error immediately, matching the fix applied to the
Validation handler in PR gonka-ai#968.

Without fix: handler continues with corrupted params, access
gates become no-ops, downstream errors cascade.
With fix: handler returns "cannot start/finish inference with
stale params" immediately.
@unameisfine unameisfine force-pushed the bugfix/propagate-inject-params-error branch from 11d5d96 to 7756064 Compare April 3, 2026 12:14
@unameisfine
Copy link
Copy Markdown
Author

Rebased on main (ec8f455).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants