Skip to content

[Java] Add replay-proxy E2E coverage for inline lambda-defined tools#1881

Merged
edburns merged 3 commits into
edburns/1810-java-tool-ergonomics-tool-as-lambdafrom
copilot/add-java-e2e-integration-test
Jul 1, 2026
Merged

[Java] Add replay-proxy E2E coverage for inline lambda-defined tools#1881
edburns merged 3 commits into
edburns/1810-java-tool-ergonomics-tool-as-lambdafrom
copilot/add-java-e2e-integration-test

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This change covers Phase 4.5 of the Java tool-as-lambda work by adding real-session E2E validation for inline lambda-defined tools against the replay proxy. It verifies both assistant-visible behavior and in-session tool side effects while following the existing snapshot-reuse strategy.

  • E2E coverage: inline lambda tool definitions

    • Extended ErgonomicToolDefinitionIT with lambdaToolDefinition().
    • Defines tools inline via ToolDefinition.from(...) + Param.of(...) (no annotation-processor path).
    • Exercises the same end-to-end prompt/tool-invocation flow used by existing tool-definition integration tests.
  • Behavior asserted in-session

    • Confirms assistant response includes expected phase/search content.
    • Confirms lambda tool side effect (currentPhase) mutates to "analyzing" during the session.
  • Snapshot strategy + plan bookkeeping

    • Reuses existing tools/ergonomic_tool_definition snapshot (no new test/snapshots/tools/* YAML needed).
    • Marks Phase 4.5 complete in the implementation plan checklist.
ToolDefinition setCurrentPhase = ToolDefinition.from(
    "set_current_phase",
    "Sets the current phase of the agent",
    Param.of(String.class, "phase", "The phase to transition to"),
    phase -> {
        tools.currentPhase = phase;
        return "Phase set to " + phase;
    });

@edburns edburns changed the base branch from main to edburns/1810-java-tool-ergonomics-tool-as-lambda July 1, 2026 21:57
Copilot AI and others added 2 commits July 1, 2026 22:26
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
…-test' into copilot/add-java-e2e-integration-test

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Java E2E integration test with replay proxy [Java] Add replay-proxy E2E coverage for inline lambda-defined tools Jul 1, 2026
Copilot AI requested a review from edburns July 1, 2026 22:29
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR adds E2E replay-proxy coverage for Java's ToolDefinition.from(...) + Param.of(...) lambda-based tool definition API (Phase 4.5 of the Java tool-as-lambda work). The changes are test-only (plus a planning doc update), so I focused on whether the feature under test has equivalent coverage in other SDKs.

Summary

No cross-SDK consistency issues found. All six SDK implementations already provide their own language-idiomatic ergonomic tool definition patterns:

SDK Ergonomic inline tool pattern
Java (this PR) ToolDefinition.from(name, desc, Param.of(...), lambda)
Node.js defineTool(name, { description, parameters: zodSchema, handler })
Python define_tool(description=..., handler=fn) / @define_tool decorator
Go DefineTool[T](name, desc, func(T, ToolInvocation) (any, error))
.NET CopilotTool.DefineTool(name, ...) with delegate handler
Rust ToolHandler trait + schema_for::<T>()

All SDKs have equivalent mechanisms for defining tools inline without manually constructing raw JSON schema maps. The Param.of(...) pattern is Java's idiomatic approach and is appropriately gated with @CopilotExperimental.

Minor observation

The class-level Javadoc for ErgonomicToolDefinitionIT still describes only the @CopilotTool + fromObject() path:

/**
 * Failsafe integration test for the ergonomic {`@code` `@CopilotTool`} +
 * {`@code` ToolDefinition.fromObject()} API.

Now that the class also covers the ToolDefinition.from(...) / lambda path, it may be worth updating the class-level doc to mention both approaches. This is not a blocking issue.


Reviewed for cross-SDK API consistency across Node.js, Python, Go, .NET, Java, and Rust implementations.

Generated by SDK Consistency Review Agent for issue #1881 · sonnet46 1.3M ·

@edburns edburns marked this pull request as ready for review July 1, 2026 22:37
@edburns edburns requested a review from a team as a code owner July 1, 2026 22:37
Copilot AI review requested due to automatic review settings July 1, 2026 22:37

Copilot AI 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.

Pull request overview

Adds Java failsafe E2E coverage to validate the inline/lambda ToolDefinition.from(...) + Param.of(...) tool-definition path against the replay proxy, ensuring it produces the same end-to-end behavior (and snapshot compatibility) as the existing annotation-based ergonomic tool API.

Changes:

  • Extends ErgonomicToolDefinitionIT with a new lambdaToolDefinition() integration test that defines tools inline using ToolDefinition.from(...) and Param.of(...).
  • Asserts both assistant-visible output (phase + search results) and an in-process side effect (currentPhase mutation) during the session.
  • Marks Phase 4.5 (“E2E integration test”) complete in the implementation plan checklist.
Show a summary per file
File Description
java/src/test/java/com/github/copilot/e2e/ErgonomicToolDefinitionIT.java Adds a new replay-proxy-backed E2E test covering inline lambda-defined tools via ToolDefinition.from(...) + Param.of(...).
1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md Updates the Phase 4.5 checklist item to completed.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Low

@edburns edburns merged commit 53d3282 into edburns/1810-java-tool-ergonomics-tool-as-lambda Jul 1, 2026
14 of 15 checks passed
@edburns edburns deleted the copilot/add-java-e2e-integration-test branch July 1, 2026 22:48
edburns added a commit that referenced this pull request Jul 2, 2026
…1881)

* Initial plan

* Add Java lambda-based E2E tool definition coverage

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
edburns added a commit that referenced this pull request Jul 2, 2026
…1881)

* Initial plan

* Add Java lambda-based E2E tool definition coverage

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
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.

[Java] Tool-as-lambda 4.5: Add Java E2E integration test with replay proxy

3 participants