Skip to content

parse harness config from request#295

Open
joycel-github wants to merge 2 commits into
mainfrom
antigravity-harness-config-json
Open

parse harness config from request#295
joycel-github wants to merge 2 commits into
mainfrom
antigravity-harness-config-json

Conversation

@joycel-github

@joycel-github joycel-github commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Parse HarnessStart.harness_config (delivered to the sidecar as json in bytes )
into a JSON object and overlay it onto the server's LocalAgentConfig before each turn.

Minimum parsing and validation logic in the adapter as intended

  • Only blocks a request from overriding AX-owned setup (save_dir,
    conversation_id); these are injected last so a request can't redirect
    trajectory storage.
  • No distinction between request-time vs conversation-creation overrides
    -- intentionally left to the harness behind the adapter.
  • No validation yet for fields only meaningful to a runtime request, not
    harness_config (e.g. confirmation). Rejected today since
    LocalAgentConfig doesn't accept them.

Config is reconstructed (not model_copy'd) so the SDK re-validates and
surfaces its own error; invalid config fails the turn with
INVALID_ARGUMENT instead of crashing.

Next

Verification

Local ax exec --harness-config-json: valid override applied, AX-owned
field rejected, SDK validation error surfaced, malformed JSON rejected,
resume intact across a per-turn override.

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.
@joycel-github joycel-github marked this pull request as ready for review July 11, 2026 00:29

@rakyll rakyll left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after the comments.

# 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"})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need conversation_id? It's already in the request.

return {}

try:
config = json.loads(raw_config.decode("utf-8"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path here won't work on Windows. Use the platform specific path separator.

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