feat(sandbox): surface validation reason on /config 400#3294
Open
feat(sandbox): surface validation reason on /config 400#3294
Conversation
The TenantConfigStore was discarding the field-level reason produced by
validateTenantConfig (e.g. "runtime invalid: python", "git.repository.cloneUrl
is empty") and returning the bare "invalid" rejection constant. The wire
response was always {"error":"invalid"} with no field detail, so a 400 from
/_decopilot_vm/config was undiagnosable without attaching a debugger.
Pass validation.reason as the rejection detail so the route handler emits
{"error":"invalid: <reason>"}, and log on the daemon side for pod logs. Also
preserve the message from any unexpected exception in the apply queue under
the apply-failed rejection so those don't get silently flattened either.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Release OptionsSuggested: Minor ( React with an emoji to override the release type:
Current version:
|
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
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.
What is this contribution about?
The daemon's `TenantConfigStore` was discarding the field-level `reason` produced by `validateTenantConfig` (e.g. `runtime invalid: python`, `git.repository.cloneUrl is empty`) and returning only the bare `"invalid"` rejection constant — so a 400 from `POST /_decopilot_vm/config` came back as the opaque `{"error":"invalid"}` with no way to tell which field failed without attaching a debugger. This PR forwards `validation.reason` as the rejection `detail` so the wire response becomes `{"error":"invalid: "}`, logs the same line via `console.warn` so it lands in pod logs, and additionally preserves the thrown error message under the `apply-failed` rejection so unexpected exceptions in the apply queue stop being silently flattened.
How to Test
Migration Notes
None. The wire shape stays `{"error": string}` with status 400; only the string content gets richer.
Review Checklist
Summary by cubic
Surface field-level validation reasons in 400 responses from /_decopilot_vm/config and log them for easier debugging. Also keep thrown error messages when apply fails so failures aren’t silently flattened.
validateTenantConfigreason as rejection detail so clients see{"error":"invalid: <reason>"}.console.warnfor pod visibility.apply-failedrejection.Written for commit c2e305f. Summary will update on new commits.