Use saved web and Gitea access from a fresh chat

This commit is contained in:
Mark Gregory
2026-11-16 16:18:39 +00:00
parent 00ea78671b
commit 4ebf2b82be
6 changed files with 79 additions and 15 deletions
+22 -3
View File
@@ -632,6 +632,7 @@ final class ToolboxRepairTests: XCTestCase {
XCTAssertTrue(found.reference.contains("A fixture & summary"))
let unavailable = try await search.resolve(searchEndpoint: "")
XCTAssertTrue(unavailable.status.contains("SearXNG"))
XCTAssertEqual(unavailable.browserFallback?.host, "duckduckgo.com")
}
func testLiveLaravelRetrieval() async throws {
@@ -787,14 +788,32 @@ final class ConnectedChatTests: XCTestCase {
XCTAssertEqual(studio.webStatus, "Gitea repositories checked.")
}
@MainActor
func testChatRetrievesPageWithoutToolboxConnection() async throws {
guard let address = ProcessInfo.processInfo.environment["AISTUDIO_TEST_WEB_URL"],
let base = URL(string: address)?.deletingLastPathComponent() else {
throw XCTSkip("Run Scripts/test.sh to configure the fixture.")
}
let directory = FileManager.default.temporaryDirectory.appending(path: UUID().uuidString)
defer { try? FileManager.default.removeItem(at: directory) }
let studio = StudioModel()
studio.open(databaseURL: directory.appending(path: "studio.sqlite"))
studio.prompt = "Can you read \(base.appending(path: "article").absoluteString)?"
studio.send(endpoint: base.appending(path: "chat-web").absoluteString, model: "fixture", mlxPath: "",
thinking: .off, failover: false, mlxOnly: false, compatible: false, recall: false,
useDocuments: false, instructions: "", settings: GenerationSettings())
let deadline = ContinuousClock.now + .seconds(8)
while studio.running && ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) }
XCTAssertTrue(studio.activeToolsets.isEmpty)
XCTAssertEqual(studio.messages.last?.content, "Page received.")
}
func testLiveConnectedGiteaRepositoryLookup() async throws {
let env = ProcessInfo.processInfo.environment
guard let path = env["AISTUDIO_TEST_REAL_MCP_CONFIG"], env["AISTUDIO_TEST_REAL_GITEA"] == "1" else {
throw XCTSkip("Enable the installed Gitea smoke test explicitly.")
}
let file = try MCPServerConfiguration.File.read(URL(fileURLWithPath: path))
let client = try XCTUnwrap(file.mcpServers["absdev-gitea"]).makeClient()
_ = try await client.listTools()
let client = try await GiteaRepositoryLookup.configuredClient(pathOverride: path)
let result = try await GiteaRepositoryLookup.references(client: client)
XCTAssertFalse(result.contains("Gitea returned no repository entries."))
}