parse harness config from request#295
Open
joycel-github wants to merge 2 commits into
Open
Conversation
The sidecar decodes HarnessStart.harness_config as a UTF-8 JSON object and overlays it onto the server's LocalAgentConfig before each turn. Fields flow through to the SDK, which validates values and surfaces its own error to the caller; the harness server does not maintain its own field allowlist. Two things the harness server does enforce: - AX-managed fields (save_dir, conversation_id) cannot be set by a request -- AX owns them for resumption, and they are injected last so a request can never redirect trajectory storage. - The config is reconstructed (not model_copy'd) so the SDK re-runs validation on overlaid values instead of storing raw dicts. Invalid harness_config (non-JSON, non-object, an AX-managed field, or a value the SDK rejects) fails the turn with gRPC INVALID_ARGUMENT rather than crashing. TODO: add validation for fields that are unsafe to set per execution (e.g. credentials, deployment routing) or that may only be set at conversation creation.
rakyll
approved these changes
Jul 11, 2026
| # TODO: add validation for fields that are unsafe to set per execution | ||
| # (e.g. credentials, deployment routing) or that may only be set at | ||
| # conversation creation. | ||
| _AX_MANAGED_CONFIG_FIELDS = frozenset({"conversation_id", "save_dir"}) |
Member
There was a problem hiding this comment.
Why do we need conversation_id? It's already in the request.
| return {} | ||
|
|
||
| try: | ||
| config = json.loads(raw_config.decode("utf-8")) |
Member
There was a problem hiding this comment.
Can we introduce a type for the config? It's very hard to read/manage it if it's represented as dict[str, object].
|
|
||
| # TODO(#269, #203): should be injected by the controller. | ||
| overrides["save_dir"] = str( | ||
| pathlib.Path.home() / ".ax" / "antigravity" / "conversations" / conversation_id |
Member
There was a problem hiding this comment.
The path here won't work on Windows. Use the platform specific path separator.
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.
Parse
HarnessStart.harness_config(delivered to the sidecar as json in bytes )into a JSON object and overlay it onto the server's
LocalAgentConfigbefore each turn.Minimum parsing and validation logic in the adapter as intended
save_dir,conversation_id); these are injected last so a request can't redirecttrajectory storage.
-- intentionally left to the harness behind the adapter.
harness_config (e.g. confirmation). Rejected today since
LocalAgentConfigdoesn't accept them.Config is reconstructed (not
model_copy'd) so the SDK re-validates andsurfaces its own error; invalid config fails the turn with
INVALID_ARGUMENTinstead of crashing.Next
LocalAgentConfigunknown fields (pydantic silently dropsthem today; TODO in code).
state_dirchange from Antigravity sidecar state dir from config #292.Verification
Local
ax exec --harness-config-json: valid override applied, AX-ownedfield rejected, SDK validation error surfaced, malformed JSON rejected,
resume intact across a per-turn override.