Skip to content

feat(auto_ontology_agent): take part in BIRD-Interact's c-Interact, asking the user through the Environment Server - #6323

Open
ffrujeri wants to merge 8 commits into
ffrujeri/birdbench-auto-ontology-agentfrom
ffrujeri/auto-ontology-agent-c-interact
Open

ffrujeri wants to merge 8 commits into
ffrujeri/birdbench-auto-ontology-agentfrom
ffrujeri/auto-ontology-agent-c-interact

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What

auto_ontology_agent takes part in BIRD-Interact's c-Interact, which the bird_interact Environment Server runs (the BIRD-Interact stack, #5465 → #5534, now merged). The agent's single-activation path for BIRD dev does not change.

  • Session. c-Interact seeds a multi-turn session with no agent context, and grants the server's ask_user and submit_sql over direct HTTP. The agent declares continuation support (trajectory, timing). It refuses an agent context, a required MCP grant, or a seed without one direct HTTP grant.

  • The task, from the ADK's texts (c_interact.py). The first request's system message gives the database, the visible knowledge and the number of questions allowed. Each turn's user message is the request, a debug message or the follow-up question. The agent refuses a request that does not hold these texts.

  • One Auto Ontology episode per turn, in the session's sandbox, in the turn's own directory (SandboxSession.begin_activation):

    • Auto Ontology's prompts and tools, with its own ask_user tool (Let a ReAct episode ask the user NVIDIA/auto-ontology#559), which the runner turns on (TEXT_TO_SQL_REACT_ASK_USER) and answers through the server's ask_user (ToolContext.ask_user);
    • a system-prompt section on asking, with the questions left;
    • evidence that carries the visible knowledge, the user's earlier answers, and the earlier queries with the server's reply.

    The query that Auto Ontology accepts goes to submit_sql.

  • Close. The close returns each turn's input, answer, stop reason and duration.

  • Episode runner. It calls the server's tools over HTTP from the sandbox, and decodes a JSON-string reply. It expands ${NAME} in the image's settings, so a source database can name the episode's catalog port. A call whose arguments the server refuses (HTTP 422) replies with the refusal, which the model reads as the tool's result; any other failed call fails the activation (see the review fixes below). An episode that raises writes its error to the result file, and the activation fails with that error (AutoOntologyEpisodeError), not with a missing-file error.

Why

The catalog stays inside the agent harness's sandbox (#6285 is closed), and Auto Ontology's ReAct agent is the agent under test. The ReAct loop had no way to ask a user, so NVIDIA/auto-ontology#559 gave it its own ask_user tool, which a caller answers through ToolContext.ask_user: the agent answers it through the benchmark's ask_user, with no copy of the loop. The model reads Auto Ontology's description of the tool, not the server's. Tracking: GYMINT-753 (Linear).

Stacked on #6289. The pairing (benchmarks/bird_interact/auto_ontology_agent.yaml and the BIRD-Interact catalog image) is #6489, at the top of this stack.

Validation

  • gym env test +entrypoint=responses_api_agents/auto_ontology_agent: 40 passed (35, plus the failed tool call, the raising runner and the activation's error). This includes the c-Interact seed refusals, two turns with ask_user and a debug turn, the close's per-turn record, the text parsing, and the runner's HTTP calls and setting expansion. The tests use copies of the ADK's texts (tests/adk_texts.py), because this stack does not hold the server; the pairing PR checks the copies against the server's own texts.

  • tests/unit_tests/test_session_contract_repo.py and tests/unit_tests/environment/test_benchmarks.py: 88 passed.

  • pre-commit on the changed files: passed.

  • After the rebase onto main (4954b38, 2026-11-23), with the BIRD-Interact stack merged: the agent's tests at the stack's top 86 passed, 1 skipped; pre-commit on the stack's files passed. feat(bird_interact): run BIRD-Interact with the Auto Ontology agent, as auto-ontology-eval runs it #6489's smoke runs this agent on BIRD-Interact Full.

  • Review fixes (e5a8440):

    • A tool call the Environment Server does not answer (a refused connection, a timeout, HTTP 5xx) fails the activation instead of grading as no_sql_submitted.
    • A refused question (HTTP 422) replies with the refusal and does not spend the allowance.
    • The trajectory carries a turns_unavailable gap.
    • c-Interact turns refuse controls the loop does not honor.
    • Agent tests: 49 passed. BIRD-Interact Full smoke at the stack's top (34e9855): c-Interact rewards 1.0, 1.0, 1.0, 0.0. Rollout health: 4 unobserved and 0 unhealthy, where every rollout was unhealthy (rollout_missing_agent_turns) before.
  • Third review round, rebased onto main (6f6f4c7, 2026-11-24), b4eaf51:

    • A reply cut short (IncompleteRead, a reset connection) is a call that got no reply, so the activation fails without asking again.
    • A turn whose model call the loop gave up on answers failed (feat(auto_ontology_agent): run Auto Ontology's ReAct agent in Gym, one sandbox per episode #6289), and its invocation records failed.
    • Agent tests at this PR: 58 passed; the new tests fail with the previous runner. Core (tests/unit_tests/benchmarks/, environment/, config/, CLI) at the stack's top: 2834 passed, 13 skipped; agent tests: 108 passed, 1 skipped; pre-commit run --all-files: passed.
    • Smoke at the stack's top (43784ab), Claude Opus 5.5: 5 of 5 BIRD dev tasks correct; BIRD-Interact Full on the interactive pipeline and the full-meanings image, c-Interact rewards 1.0, 1.0, 1.0, 0.0 and a-Interact 1.0, 1.0, 1.0, 0.0 (16 to 19 BIRD-COIN; the 0.0 is the agent's own repeated_sql stop). No failures, nothing masked, rollout health unobserved only, every sandbox stopped.
  • Rebased onto main (5398501, 2026-11-30), 61faa9f: no conflicts in this PR. Core suite (tests/unit_tests) at the stack's top: 27647 passed, 39 skipped; one failure under xdist, test_indic_in22.py::test_manifest_is_discoverable_under_its_catalog_path, passes alone and is outside this stack; agent tests: 108 passed, 1 skipped; component locks: 342 checked, 0 failed; pre-commit on the stack's files: passed. Smoke at the stack's top: BIRD-Interact Full c-Interact on the interactive pipeline and the full-meanings image, 4 query tasks: rewards 1.0, 1.0, 0.8, 0.0, as on 2026-11-24 except a debug-turn 0.8 for crypto_exchange_1 (the 0.0 is archeology_scan_1, which failed on 2026-11-24 too), no failures, nothing masked.

  • Pinned Auto Ontology's main (a00a3906, the merge of Let a ReAct episode ask the user NVIDIA/auto-ontology#559) and rebased onto main (bc5383b), 2026-11-30, 20d400a: the runner gives the episode Auto Ontology's own ask_user (ToolContext.ask_user, with TEXT_TO_SQL_REACT_ASK_USER=true) in place of the extra tool. Its tests: a refused question replies with the refusal, an unanswered or cut-short one fails the turn after the loop, and run() sets ask_user and the setting only when the task has a user to ask; leaving the setting off, or passing extra_tools again, fails them. Core suite (tests/unit_tests) at the stack's top: 27674 passed, 39 skipped; one failure under xdist in test_openshell_provider.py, which passes alone and is outside this stack; agent tests: 110 passed, 1 skipped; benchmarks/birdbench/tests: 82 passed, 5 skipped; component locks: 343 checked, 0 failed; pre-commit on the stack's files: passed. Smoke: BIRD-Interact Full c-Interact with the ReAct agent, 4 query tasks: rewards 1.0, 1.0, 1.0, 0.0, the agent asking through Auto Ontology's ask_user; no failures, nothing masked.

  • Rebased onto main (dd09637), 2026-12-01, a3befa8: no conflicts; no change in this PR. tests/unit_tests/benchmarks, config, cli and tooling pass, as do the test files that failed locally with a partial environment (the rest fail on main too, on this machine); benchmarks/birdbench/tests: 82 passed; agent tests: 110 passed, 1 skipped; component locks: 343 checked, 0 failed; pre-commit on the stack's files: passed.

  • Fourth review round, rebased onto main (0b7bcdc), 2026-12-02, 725ec6b. Review fixes (9bcc53c): only HTTP 422 is a refusal the model reads; 401, 403, 404 and 410 (token, grant, tool, episode) fail the activation as infrastructure errors; a failed call whose body is cut short, reset or timed out is still recorded and fails the activation after the loop. The check that the agent's copies of the c-Interact texts are the server's own moved into this PR (725ec6b, tests/unit_tests/benchmarks/test_auto_ontology_agent_c_interact_texts.py); a producer-only change such as User Query: to User query: fails it. Core suite (tests/unit_tests) at the stack's top: 27972 passed; the 8 that fail (tool and sandbox-transfer telemetry, two OpenSandbox script-help tests) fail on main on this machine too. benchmarks/birdbench/tests: 121 passed; agent tests: 124 passed, 1 skipped; component locks: 345 checked, 0 failed; pre-commit on the stack's files: passed. Smoke: BIRD-Interact Full c-Interact, ReAct agent, 4 tasks: 1, 1, 1, 0 (ask_user used). The zeros are archeology_scan_1, graded wrong as at the earlier pins; no masked rollouts, empty failure sidecars.

  • Docs, 2026-12-02, bdd286b: the agent README's c-Interact section now says that only a refusal of the arguments (HTTP 422) lets a turn go on; it still described the rule before 9bcc53c. No code change.

  • Rebased onto main (0cfc8d1), 2026-12-04, 2df44e7, on feat(auto_ontology_agent): run Auto Ontology's ReAct agent in Gym, one sandbox per episode #6289's lent-sandbox change: the c-Interact seed's grant check sits beside feat(auto_ontology_agent): run Auto Ontology's ReAct agent in Gym, one sandbox per episode #6289's sandbox placement, and parse_agent_context no longer refuses a lent sandbox. No other change in this PR. Agent tests at the stack's top: 118 passed, 1 skipped. Core (tests/unit_tests/benchmarks, environment, config, agents, server_runtime) at the stack's top: 6353 passed, 14 skipped; the one failure, test_resolve_config_servers_logs_unresolvable_configs[recursive_alias-ConfigError], fails on main on this machine too. Component locks: 350 checked, 0 failed; pre-commit on the stack's files: passed. Smoke at the stack's top: BIRD-Interact Full on the interactive pipeline, where the agent still starts its own sandbox: c-Interact 1.0, 1.0, 1.0, 0.0 and a-Interact 1.0, 1.0, 1.0, 0.7 (archeology_scan_1, its first phase in a-Interact). No failures, nothing masked, every sandbox stopped.

Rollout evidence

A smoke on the three public BIRD-Interact Lite tasks that have ground truth, run on a local branch that holds both stacks. Settings: Claude Opus 5.5 as the policy, local Docker sandboxes, and the Lite catalog image that benchmarks/bird_interact/auto_ontology/build_image.sh builds (pairing PR).

Task Kind Turns Questions Reward
crypto_2 Query 4: phase 1, debug, phase 2, debug 4 0.5 (phase 1 passed after its debug turn)
alien_M_2 Management 2 1 0
alien_M_3 Management 2 2 0
  • The full path ran. Every question reached the simulator, every accepted query was graded by submit_sql, and the debug turns and the follow-up opened as in the ADK. No sample was masked, there were no infrastructure failures, and every sandbox stopped.
  • The management tasks scored 0, as expected. Auto Ontology submits read-only queries, and these tasks need DDL (CREATE FUNCTION, CREATE VIEW).
  • Turns took 4 to 20 minutes while the policy endpoint returned 429s.

@copy-pr-bot

copy-pr-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ffrujeri
ffrujeri added this pull request to stack #6319 November 17, 2026 23:56
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 2e8d516

@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:agent Agent harnesses and Responses API agent behavior labels Nov 18, 2026
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test e794c18

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 58a845d

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 23, 2026
@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-c-interact branch from 58a845d to 23fc204 Compare November 23, 2026 18:06
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 23fc204

@ffrujeri
ffrujeri marked this pull request as ready for review November 23, 2026 18:28
@ffrujeri ffrujeri added the needs-review PR is ready for code review and waiting on a reviewer label Nov 23, 2026
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 23fc204

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 23, 2026 18:54
@ffrujeri
ffrujeri requested a review from yaoyu-33 November 23, 2026 18:56

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

HOLD. Final-submission delivery failures can become unmasked zero-reward episodes. I also found issues in clarification accounting, trajectory reporting and producer/parser drift coverage.

I reviewed all seven changed files and traced their callers and consumers, with three delegated reviews. Head-associated CI reports Lint check, Unit tests / Test, Unit tests / Server suite, Unit tests / Combined core coverage and Nemo_CICD_Test green. The non-blocking Environment Server compliance aggregate is red for partner_if_dispatcher and prime_agent; its Auto Ontology row is compliant.

I ran focused CPU probes in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:4e920d1b3d6c8da484351dab16436d86da1b6f23, a successful default-branch CI image selected because this head's build was skipped. Probes reproduced submission-failure scoring, failed-question accounting and empty canonical trajectories. Producer/parser round trips worked in both dialects; replay, disconnected-waiter handling, close cancellation, HTTP header delivery, environment expansion and runner-error propagation also worked. I relied on CI rather than duplicating its suites. Initial probe dependency gaps were resolved in a scratch virtual environment.

The PR supplies representative model-smoke evidence. I did not independently run a live model/catalog sandbox, and the external Auto Ontology loop was stubbed in runner probes.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

"""The BIRD-Interact ADK's c-Interact texts that the agent reads, as the bird_interact Environment Server sends them.

Copies of ``environment_servers/bird_interact/adk_prompts.py``, which this agent's tests cannot import: the agent does
not depend on that server. ``benchmarks/bird_interact/tests`` checks that the agent reads the server's own texts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RISK: The strict parser has no committed compatibility check against its producer. Could this PR include the referenced drift check rather than defer it to the pairing PR? benchmarks/bird_interact/tests is absent from this head, and the new parser tests use copied strings rather than the actual owner's prompts. All six copies match today. However, a producer-only change from User Query: to User query: makes the parser reject the first activation while these fixtures remain green.

Add a shared contract test using the dependency-free owner constants or real request builders, with concrete expected task/turn values for PostgreSQL, SQLite, debug and follow-up forms. Acceptance: changing producer framing or clarification-note syntax without updating consumption fails a committed test. Scratch probe: python /workspace/review-probes/contract-review/probe.py.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not moving it. The check exists in this stack: #6489's tests/unit_tests/benchmarks/test_bird_interact_auto_ontology.py::test_the_agent_reads_the_servers_c_interact_texts. It asserts that every constant in tests/adk_texts.py equals the one in environment_servers/bird_interact/adk_prompts.py, and that the agent's parser reads the server's own formatted instruction, phase-1 turn and follow-up turn. A producer-only change such as User Query: → User query: breaks that equality and fails the core suite. The stack goes through the merge queue together, so this PR does not land without that check.

@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-c-interact branch from 23fc204 to e5a8440 Compare November 23, 2026 19:44
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test e5a8440

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-c-interact branch from e5a8440 to f03273e Compare November 24, 2026 04:43
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test f03273e

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 24, 2026
@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-c-interact branch from 61faa9f to 20d400a Compare November 30, 2026 23:19
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 20d400a

@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-c-interact branch from 20d400a to a3befa8 Compare December 1, 2026 00:54
@ffrujeri

ffrujeri commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a3befa8

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Dec 1, 2026
@adil-a

adil-a commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

/review reset=true a3befa8

Copy link
Copy Markdown
Contributor

Invalid /review command: arguments must use key=value syntax. Usage: /review [<sha>] [approve=<true|false>] [mode=<light|strict>] [model=<codex|claude>] [prompt="<value>"] [reset=<true|false>] [role=<automation|engineer>].

@adil-a

adil-a commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

/review a3befa8 reset=true

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

HOLD. Two tool-error paths can still turn environment failures into unmasked model outcomes. The prior producer/parser drift-coverage finding also remains open in this reviewed tree.

I reviewed all eight changed files and their relevant callers and consumers, with three delegated reviews. I verified the prior findings against the current source: ordinary final-submit transport failures now propagate, refused questions no longer consume the local allowance, unavailable trajectory turns are explicitly marked, and published docs expose the integration. The previous review commit was unreachable, so I could not compare directly against it.

CI evidence: Lint check, core shards 0–3, Unit tests / Sandbox tests, Unit tests / Combined core coverage, Unit tests / Changed server tests, Unit tests / Test, the server-suite aggregate and Nemo_CICD_Test succeeded. The changed-server log reports 60 passing Auto Ontology tests. The full server matrix and session-routing end-to-end row were skipped, not passed.

I ran focused CPU probes in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:c2974f7bd962fd921ae90176f19d983bccbdebff, a successful default-branch CI image selected because this head’s container build was skipped. Probes covered replay, disconnected waiters, close cancellation, trajectory collection, clarification accounting, real producer-text parsing and tool-failure propagation. They reproduced both scoring hazards below. The consumer probe needed sqlglot==30.20.0, installed in a scratch virtual environment; corrected probes completed successfully. I relied on CI rather than duplicating its suites.

The PR supplies representative model-smoke evidence. I did not independently run a model/catalog sandbox. Runner probes stubbed the external Auto Ontology loop using the exception-catching contract documented by this adapter; they do not validate the external implementation.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

reply = response.read().decode(errors="replace")
except urllib.error.HTTPError as error:
body = error.read().decode(errors="replace")
raise ToolCallError(f"The tool call failed with HTTP {error.code}: {body[:2000]}", refused=error.code < 500)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BLOCKER: Environment access failures are treated as model argument refusals. Could refused distinguish argument errors from unavailable grants instead of accepting every HTTP 4xx? The actual tool server returns 401/403 for token or grant problems and 410 for an episode it does not hold; a missing tool returns 404. The model controls neither the granted URL nor its headers.

For these statuses, ask_user() returns error text and run() excludes the call from its undelivered-call check. My runner/caller probes produced completed invocations for 401, 403, 404 and 410. With two unsubmitted turns, the real BIRD-Interact consumer methods produced stop_reason=no_sql_submitted, reward=0.0, mask_sample=False. An access or routing failure can therefore contaminate evaluation scores.

Please keep model-fixable argument refusals, such as this endpoint’s 422, recoverable, but propagate grant/authentication/routing failures through the existing infrastructure-error envelope. Preserve successful answers and HTTP-200 graded-wrong SQL replies, and do not retry ambiguous stateful calls. Acceptance: caller-level coverage for 401/403/404/410 fails the activation, while 422 remains recoverable without adding an exchange. Probe: /workspace/review-probes/leader/access_failures.py.

The earlier failed-question accounting fix correctly excludes refused calls from answer history; this is a separate classification gap.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9bcc53c. refused is now true only for HTTP 422, the Environment Server's refusal of the arguments. 401 and 403 (the episode's token or grant), 404 (an unknown tool) and 410 (an episode the server does not hold) are calls the model cannot make work: they are recorded as undelivered and fail the activation through the infrastructure-error path, as 5xx and transport failures do. test_a_tool_call_the_server_does_not_answer_raises now covers 401, 403, 404 and 410; a 422 still replies with the refusal and adds no exchange. The README's rule says the same.

with urllib.request.urlopen(request, timeout=TOOL_TIMEOUT_SECONDS) as response:
reply = response.read().decode(errors="replace")
except urllib.error.HTTPError as error:
body = error.read().decode(errors="replace")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BLOCKER: A truncated HTTP error body bypasses delivery-failure recording. Reading error.read() inside this exception handler is outside the protection of the following except (OSError, http.client.HTTPException). A truncated response, reset or timeout here escapes as a raw exception. ask_user() records only ToolCallError, so the documented exception-catching loop can continue without leaving an undelivered call for run() to reject.

A real local HTTP server sending 503 headers with a truncated body produced IncompleteRead and environment_tool_calls=[]. With a catching-loop stub, the runner returned an ordinary no-query result; the real answer/outcome policy selected verify, and the BIRD-Interact consumer produced an unmasked zero-reward result after two no-query turns. A proxy failure before the environment handler need not set the server’s own failure flag.

Could diagnostic-body reads be best-effort and guarded, so a failed request always becomes the appropriate structured ToolCallError even when its body cannot be read? Keep 5xx or unknown-delivery errors non-refused, preserve genuine argument refusals and graded task replies, and do not retry the call. Acceptance: truncated 503 bodies, body-read resets and timeouts remain recorded and fail the activation after a loop catches callback exceptions. Probe: /workspace/review-probes/leader/error_body_episode.py.

The earlier final-submit fix works for its stated cases. This hole concerns ask_user inside the loop, not final submission outside it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9bcc53c. Reading a failed call's body is now best-effort: an OSError or HTTPException while reading it leaves the call's own failure, with (no body: ...) in its message. The call is recorded as undelivered and fails the activation after the loop, as a cut-short 200 does. test_a_failed_call_whose_body_does_not_arrive_is_still_unanswered covers a 503 whose body is truncated (IncompleteRead), reset, or timed out.

"""The BIRD-Interact ADK's c-Interact texts that the agent reads, as the bird_interact Environment Server sends them.

Copies of ``environment_servers/bird_interact/adk_prompts.py``, which this agent's tests cannot import: the agent does
not depend on that server. ``benchmarks/bird_interact/tests`` checks that the agent reads the server's own texts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RISK: The producer/parser compatibility check is still outside the reviewed change. Both parser and activation tests consume these copied strings, but neither the referenced benchmarks/bird_interact/tests check nor the author’s cited tests/unit_tests/benchmarks/test_bird_interact_auto_ontology.py exists at this head. The author says the check lands with stacked PR #6489; I cannot verify that dependency from the admitted tree.

All six copies match the owner’s constants today. My probe changed only producer framing from User Query: to User query:: the production parser rejected it while the copied fixture still parsed. A producer-only change can therefore break every c-Interact activation without this suite detecting the mismatch.

Could you include the shared owner/consumer check with this reviewed change? Import the dependency-free owner constants or use its real request builders, then assert concrete parsed values for both dialects, debug/follow-up forms and clarification-note stripping. The isolated agent suite can keep copies if the shared check also compares them with their owner. Acceptance: a producer-only framing change or consumer parsing regression fails a committed test, while current request semantics stay unchanged. This is the unresolved prior finding comment:4670669406.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved into this PR in 725ec6b: tests/unit_tests/benchmarks/test_auto_ontology_agent_c_interact_texts.py checks that every constant in tests/adk_texts.py equals the one in environment_servers/bird_interact/adk_prompts.py, and that the agent reads the server's formatted instruction, phase-1 turn and follow-up. I checked it against your probe: changing only the server's User Query: to User query: fails it. #6489 no longer carries a copy.

@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-c-interact branch from a3befa8 to 725ec6b Compare December 2, 2026 02:43
@ffrujeri

ffrujeri commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 725ec6b

@nemo-pr-automation
nemo-pr-automation Bot requested a review from a team December 2, 2026 02:44
@ffrujeri

ffrujeri commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test bdd286b

@adil-a adil-a left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Notes from a pass over the stack at this head. Each inline comment says how it was established, and anything not confirmed from the code is put as a question.

) -> None:
if not isinstance(state, AutoOntologySessionState):
raise TypeError("Expected Auto Ontology session state")
refuse_unsupported_request_fields(body, model=self.config.model, honored={"input", "tools"})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RISK: The agent ignores the turn budget the server sends.
On every activation the bird_interact server puts the time left for the turn into metadata (AGENT_TIMEOUT_METADATA_KEY, set in environment_servers/bird_interact/agent_session.py): the lesser of the turn deadline and what remains of the conversation limit. This check lets metadata through, and the episode then always runs with episode_timeout_seconds (1800 s). So when less time is left, the server's deadline fires first: the turn fails or the conversation is cut while the sandbox keeps working on it. Core has resolve_agent_timeout (nemo_gym/agents/utils/task_timeout.py) for this, and other agents such as pi_agent and codex_agent apply it. Could the sandbox run use resolve_agent_timeout(body.metadata, ceiling=self.config.episode_timeout_seconds), less a small margin for collecting the result?

@pytest.mark.parametrize(
"error", [http.client.IncompleteRead(b'"A vis', 20), ConnectionResetError("reset by peer")], ids=type
)
def test_a_reply_cut_short_fails_the_episode_after_the_loop(monkeypatch: pytest.MonkeyPatch, error: Exception) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NOTE: No test runs run() through a loop that swallows ask_user's error.
This test and test_an_unanswered_question_fails_the_episode_after_the_loop check that ask raises and records the call, but not that run() then raises. With the raise ToolCallError(undelivered[0]["error"], refused=False) after run_episode replaced by pass, the agent's suite still passes, so nothing guards the fix for unanswered questions. Could one test use _auto_ontology_stub with a run_episode that calls context.ask_user inside try/except Exception, as Auto Ontology's loop does, and assert that run() raises ToolCallError? A smaller gap of the same kind: with the refuse_unsupported_request_fields(...) call removed from _validate_agent_activation, every test still passes, because only the single-activation path checks the 422.

@@ -0,0 +1,185 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""BIRD-Interact's c-Interact for Auto Ontology's ReAct agent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NOTE: Should the c-Interact readers live with the bird_interact server?
From this PR on, the agent carries a parser for one Environment Server's texts (read_task, read_turn, the ADK's headings and notes). Its non-test code grows from about 560 lines to about 1,070, and to about 1,870 at the stack tip. The add-harness skill says that a pairing needing pair-specific adapter code is a design problem, and "Never add a pair-specific adapter or launcher". Could environment_servers/bird_interact export the readers of its ADK texts, as resources_servers/gymnasium exports extract_text to its agent? Only Auto Ontology's own strategy (the evidence text, the asking prompt) would stay here. That would also remove the copies in tests/adk_texts.py. If keeping them in the agent is deliberate, a sentence in the README on why would help whoever pairs the next harness.

@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NOTE: The copied ADK texts carry no provenance header.
This file holds six BIRD-Interact ADK texts verbatim. Their source in Gym, environment_servers/bird_interact/adk_prompts.py, records the ADK's URL, revision 451fe2c3 and its MIT notice. This file's header has only the Apache SPDX lines. AGENTS.md ("Code provenance") asks for the source, revision and license in the header of every file that holds copied code. Could you add the same block here? If the agent's tests can read the texts from adk_prompts instead, the copy and its header go away.

ffrujeri and others added 8 commits December 4, 2026 00:24
…sking the user through the Environment Server

A multi-turn session, as the bird_interact Environment Server seeds for c-Interact:
no agent context, and a direct HTTP grant of the server's ask_user and submit_sql.
Each turn runs one Auto Ontology episode in the session's sandbox, in the turn's own
directory. The agent reads the ADK's texts (the database, the visible knowledge, the
request, the debug message and the follow-up question) and gives Auto Ontology the
question, evidence that carries the user's earlier answers and queries, and a prompt
section on asking. Auto Ontology gets ask_user as an extra tool of its ReAct loop
(NVIDIA/auto-ontology#559); the query it accepts goes to submit_sql. The close
returns each turn's input, answer and duration.

The episode runner calls the server's tools over HTTP from the sandbox, and expands
${NAME} in the image's settings, so a source database can name the episode's
catalog port. A single-activation session (BIRD dev) runs as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…report a failed episode's cause

A call of an Environment Server's tool that the server failed (such as
BIRD-Interact's submit_sql on a task whose solution SQL does not run)
raised in the episode runner, which then wrote no result file, so the
activation failed with a docker cp error that hid the cause.

The runner now replies to a failed tool call (an HTTP error, a refused
connection or a timeout) with its error, which the model reads as the
tool's result, and the episode goes on. An episode that raises writes its
error to the result file and exits 1, and the activation fails with that
error (AutoOntologyEpisodeError).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…oes not answer, and report the turns unavailable

A tool call the server did not answer (a refused connection, a timeout or HTTP 5xx) came back as text. The final
submit_sql then left the server with no submission, and the task was graded no_sql_submitted with reward 0, unmasked:
an infrastructure failure scored as the model's. A failed ask_user became the user's answer and spent a question.
call_tool now raises ToolCallError. The runner's own submit fails the activation; a tool the model calls replies with
a refusal (HTTP 4xx), which the model reads and which does not count as a question, and a call with no reply fails
the activation once Auto Ontology's loop returns, since the loop catches what a tool raises.

The close's trajectory held the turns' records and no turns, which rollout health read as an episode with no agent
turns: every BIRD-Interact rollout was unhealthy (rollout_missing_agent_turns). This server does not see the model
calls, so the trajectory now carries a turns_unavailable gap, and health reports the turn checks unobserved.

c-Interact turns refuse request controls the loop does not honor, as the single activation does; they honor the
input and the tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…ort, and record a turn whose model call failed

A 200 from ask_user whose body did not arrive whole raised http.client.IncompleteRead while reading it. That is not a
URLError, so call_tool let it through, Auto Ontology's loop turned it into tool feedback, and the call was never
recorded: the turn could go on to a scored submission although the server may have counted the question. call_tool now
treats any failure to read the reply (IncompleteRead, a reset connection) as a call that got no reply, which run()
raises once the loop returns, so the activation fails without asking again.

A c-Interact turn whose model call the loop gave up on now answers `failed`, by the model failure fix in #6289, and its
invocation record says `failed` too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…sk_user tool

NVIDIA/auto-ontology#559 merged with ask_user as one of the ReAct loop's own tools, in place of the extra-tools hook
this agent used: ToolContext.ask_user takes the model's question and returns the user's reply, and the episode offers
the tool only when TEXT_TO_SQL_REACT_ASK_USER is on. The runner sets both when the task has the Environment Server's
ask_user, and records each question as before: a refused one replies with the refusal, and one that got no reply
fails the turn once the loop returns.

The model now reads Auto Ontology's description of ask_user, not the Environment Server's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…annot correct

call_tool treated every HTTP 4xx as a refusal of the model's arguments, which the model reads and the turn
survives. The Environment Server also answers 401 and 403 (the episode's token or grant), 404 (an unknown tool)
and 410 (an episode it does not hold), which the model cannot change: an access or routing failure then became
a graded no-query turn. Only 422 is a refusal now; the others fail the activation as an infrastructure error.

Reading a failed call's body was also outside the guard for a reply cut short, so a 503 whose body was
truncated or reset escaped as a raw error, which Auto Ontology's loop reads as tool feedback. The body is now
read best-effort, and the call is recorded as one that got no reply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…ver in this PR

The agent's tests parse copies of the bird_interact Environment Server's c-Interact texts. The check that
the copies are the server's own, and that the agent reads the server's formatted instruction, phase-1 turn
and follow-up, was in #6489, above this PR. It is now a core test here, so a producer-only change such as
'User Query:' to 'User query:' fails with this PR alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…ets a c-Interact turn go on

The c-Interact section still said that a call the server fails or refuses replies with its error and the
episode goes on. Since 9bcc53c only an HTTP 422 does; any other failed call fails the activation, as the
known limits say.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-c-interact branch from bdd286b to 2df44e7 Compare December 4, 2026 00:35
@ffrujeri

ffrujeri commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2df44e7

@nemo-pr-automation
nemo-pr-automation Bot requested a review from a team December 4, 2026 00:41

This branch has not been deployed

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

Labels

area:agent Agent harnesses and Responses API agent behavior feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants