Skip to content

Commit 94c787a

Browse files
authored
Merge branch 'main' into edburns/dd-3012834-experimental-annotation
2 parents b7378ae + 7d6bc92 commit 94c787a

8 files changed

Lines changed: 83 additions & 16 deletions

File tree

.github/workflows/update-copilot-dependency.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ jobs:
114114
working-directory: ./java
115115
run: mvn generate-sources -Pcodegen
116116

117-
- name: Compile Java SDK (validate generated code)
118-
working-directory: ./java
119-
run: mvn compile -Pskip-test-harness
120-
121117
- name: Create pull request
122118
env:
123119
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dotnet/test/E2E/SessionFsE2ETests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,10 @@ public async Task Should_Write_Workspace_Metadata_Via_SessionFs()
410410
Assert.Contains("56", msg?.Data.Content ?? string.Empty);
411411

412412
var workspaceYamlPath = GetStoredPath(providerRoot, session.SessionId, $"{SessionFsConfig.SessionStatePath}/workspace.yaml");
413-
await WaitForConditionAsync(() => File.Exists(workspaceYamlPath), TimeSpan.FromSeconds(30));
414-
Assert.Contains(session.SessionId, await ReadAllTextSharedAsync(workspaceYamlPath));
413+
await WaitForConditionAsync(
414+
async () => File.Exists(workspaceYamlPath)
415+
&& (await ReadAllTextSharedAsync(workspaceYamlPath)).Contains(session.SessionId),
416+
TimeSpan.FromSeconds(30));
415417

416418
var indexPath = GetStoredPath(providerRoot, session.SessionId, $"{SessionFsConfig.SessionStatePath}/checkpoints/index.md");
417419
await WaitForConditionAsync(() => File.Exists(indexPath), TimeSpan.FromSeconds(30));
@@ -442,8 +444,10 @@ public async Task Should_Persist_Plan_Md_Via_SessionFs()
442444
await session.Rpc.Plan.UpdateAsync("# Test Plan\n\nThis is a test.");
443445

444446
var planPath = GetStoredPath(providerRoot, session.SessionId, $"{SessionFsConfig.SessionStatePath}/plan.md");
445-
await WaitForConditionAsync(() => File.Exists(planPath), TimeSpan.FromSeconds(30));
446-
Assert.Contains("This is a test.", await ReadAllTextSharedAsync(planPath));
447+
await WaitForConditionAsync(
448+
async () => File.Exists(planPath)
449+
&& (await ReadAllTextSharedAsync(planPath)).Contains("This is a test."),
450+
TimeSpan.FromSeconds(30));
447451

448452
await session.DisposeAsync();
449453
}

python/e2e/test_session_fs_e2e.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ async def test_should_write_workspace_metadata_via_sessionfs(
235235
workspace_yaml_path = provider_path(
236236
provider_root, session.session_id, f"{SESSION_STATE_PATH}/workspace.yaml"
237237
)
238-
await wait_for_path(workspace_yaml_path)
239-
yaml_content = workspace_yaml_path.read_text(encoding="utf-8")
240-
assert "id:" in yaml_content
238+
await wait_for_content(workspace_yaml_path, "id:")
241239

242240
# Checkpoint index should also exist
243241
index_path = provider_path(
@@ -265,9 +263,7 @@ async def test_should_persist_plan_md_via_sessionfs(
265263
plan_path = provider_path(
266264
provider_root, session.session_id, f"{SESSION_STATE_PATH}/plan.md"
267265
)
268-
await wait_for_path(plan_path)
269-
content = plan_path.read_text(encoding="utf-8")
270-
assert "# Test Plan" in content
266+
await wait_for_content(plan_path, "# Test Plan")
271267

272268
await session.disconnect()
273269

rust/src/generated/api_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Auto-generated from api.schema.json — do not edit manually.
22

33
#![allow(clippy::large_enum_variant)]
4+
#![allow(dead_code)]
45

56
use std::collections::HashMap;
67

rust/src/generated/rpc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
#![allow(missing_docs)]
99
#![allow(clippy::too_many_arguments)]
10+
#![allow(dead_code)]
1011

1112
use super::api_types::{rpc_methods, *};
1213
use super::session_events::SessionMode;

scripts/codegen/go.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,27 @@ function goVariantMatchFunctionLines(
17311731
return lines;
17321732
}
17331733

1734+
function goDiscriminatorMethodName(
1735+
typeName: string,
1736+
discriminatorProp: string,
1737+
discGoName: string,
1738+
variants: GoDiscriminatedUnionVariant[],
1739+
ctx: GoCodegenCtx
1740+
): string {
1741+
const collidesWithVariantField = variants.some((variant) => {
1742+
const resolved = resolveSchema(variant.schema, ctx.definitions) ?? variant.schema;
1743+
const objectSchema = resolveObjectSchema(resolved, ctx.definitions) ?? resolved;
1744+
return Object.keys(objectSchema.properties ?? {}).some((propName) => {
1745+
if (propName === discriminatorProp) {
1746+
return variant.discriminatorValues.length > 1 && discGoName === "Discriminator";
1747+
}
1748+
return toGoFieldName(propName) === discGoName;
1749+
});
1750+
});
1751+
1752+
return collidesWithVariantField ? `${toGoUnexportedIdentifier(typeName)}${discGoName}` : discGoName;
1753+
}
1754+
17341755
/**
17351756
* Emit a Go interface for a discriminated union (anyOf with const discriminator).
17361757
*/
@@ -1748,7 +1769,7 @@ function emitGoFlatDiscriminatedUnion(
17481769
const mapping = discriminator.mapping;
17491770
const unionVariants = [...discriminator.variants].sort((left, right) => compareGoTypeNames(left.typeName, right.typeName));
17501771
const discGoName = toGoFieldName(discriminatorProp);
1751-
const discriminatorMethodName = discGoName;
1772+
const discriminatorMethodName = goDiscriminatorMethodName(typeName, discriminatorProp, discGoName, unionVariants, ctx);
17521773
let discEnumName: string | undefined;
17531774
let discGoType = "bool";
17541775
if (discriminator.valueKind === "string") {

scripts/codegen/rust.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,7 @@ function generateApiTypesCode(
15451545
out.push("//! Auto-generated from api.schema.json — do not edit manually.");
15461546
out.push("");
15471547
out.push("#![allow(clippy::large_enum_variant)]");
1548+
out.push("#![allow(dead_code)]");
15481549
out.push("");
15491550
out.push("use std::collections::HashMap;");
15501551
out.push("");
@@ -1776,6 +1777,17 @@ function getResultTypeName(
17761777
return `${toPascalCase(method.rpcMethod)}Result`;
17771778
}
17781779

1780+
function methodUsesInternalSchema(
1781+
schema: JSONSchema7 | null | undefined,
1782+
defCollections: DefinitionCollections,
1783+
): boolean {
1784+
if (!schema) return false;
1785+
1786+
const nonNullable = getNullableInner(schema) ?? schema;
1787+
const resolved = resolveSchema(nonNullable, defCollections) ?? nonNullable;
1788+
return isSchemaInternal(resolved);
1789+
}
1790+
17791791
function pushNamespaceMethodBody(
17801792
out: string[],
17811793
constName: string,
@@ -1884,7 +1896,12 @@ function emitNamespaceMethod(
18841896
};
18851897

18861898
const paramArg = hasParams ? `, params: ${paramsTypeName}` : "";
1887-
const fnVis = method.visibility === "internal" ? "pub(crate)" : "pub";
1899+
const fnVis =
1900+
method.visibility === "internal" ||
1901+
methodUsesInternalSchema(method.params, defCollections) ||
1902+
methodUsesInternalSchema(method.result, defCollections)
1903+
? "pub(crate)"
1904+
: "pub";
18881905

18891906
if (hasParams && paramsInfo.optional) {
18901907
out.push(...buildDocs(false));
@@ -1949,6 +1966,7 @@ function generateRpcCode(apiSchema: ApiSchema): string {
19491966
out.push("");
19501967
out.push("#![allow(missing_docs)]");
19511968
out.push("#![allow(clippy::too_many_arguments)]");
1969+
out.push("#![allow(dead_code)]");
19521970
out.push("");
19531971
out.push("use super::api_types::{rpc_methods, *};");
19541972
const externalTypeRefs = new Map<string, Set<string>>();

test/snapshots/builtin_tools/should_search_for_patterns_in_files.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,33 @@ conversations:
5050
The search found **2 lines** starting with 'ap':
5151
- Line 1: `apple`
5252
- Line 3: `apricot`
53+
- messages:
54+
- role: system
55+
content: ${system}
56+
- role: user
57+
content: Search for lines starting with 'ap' in the file 'data.txt'. Tell me which lines matched.
58+
- role: assistant
59+
tool_calls:
60+
- id: toolcall_0
61+
type: function
62+
function:
63+
name: report_intent
64+
arguments: '{"intent":"Searching file for pattern"}'
65+
- id: toolcall_1
66+
type: function
67+
function:
68+
name: grep
69+
arguments: '{"pattern":"^ap","path":"${workdir}/data.txt","output_mode":"content","-n":true}'
70+
- role: tool
71+
tool_call_id: toolcall_0
72+
content: Intent logged
73+
- role: tool
74+
tool_call_id: toolcall_1
75+
content: |-
76+
${workdir}/data.txt:1:apple
77+
${workdir}/data.txt:3:apricot
78+
- role: assistant
79+
content: |-
80+
The search found **2 lines** starting with 'ap':
81+
- Line 1: `apple`
82+
- Line 3: `apricot`

0 commit comments

Comments
 (0)