mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-07 07:23:08 +02:00
test(runner): remove provider-specific model choices from ACPX fixtures
Use generic model IDs in offline permissions, continuation, backend, and usage tests. Have the fake sidecar preserve the admitted identity during suspension instead of inventing a fixed Codex model. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
9a070808b4
commit
dd59d7e82b
7 files changed
+49
-58
No files matched your search
@@ -2278,21 +2278,13 @@ mod tests {
|
||||
|
||||
fn descriptor(agent: &str) -> Value {
|
||||
let profile = acpx_release_profile(agent).unwrap();
|
||||
let model = match agent {
|
||||
"claude" => "claude-sonnet-5",
|
||||
"cursor" => "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]",
|
||||
"pi" => "openrouter/deepseek/deepseek-v4-flash-0731",
|
||||
"grok" => "grok-4.7",
|
||||
"copilot" => "explicit-test-model",
|
||||
_ => "gpt-5.6-sol",
|
||||
};
|
||||
let mut value = json!({
|
||||
"kind": "acpx",
|
||||
"provider": "acpx",
|
||||
"driver": "acpx_runtime",
|
||||
"providerVersion": QUALIFIED_ACPX_VERSION,
|
||||
"agent": agent,
|
||||
"model": model,
|
||||
"model": "explicit-test-model",
|
||||
"acpxVersion": QUALIFIED_ACPX_VERSION,
|
||||
"agentServerPackage": profile.agent_server_package,
|
||||
"agentServerVersion": profile.agent_server_version,
|
||||
|
||||
@@ -44,6 +44,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut stdout = io::stdout().lock();
|
||||
let mut next_sequence = 1_u64;
|
||||
let mut goal = Value::Null;
|
||||
let mut session_identity = Value::Null;
|
||||
for line in stdin.lock().lines() {
|
||||
let request: Value = serde_json::from_str(&line?)?;
|
||||
let id = request
|
||||
@@ -64,7 +65,14 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
&& request["params"]["result"] == json!({"id":"issue-1"})
|
||||
&& request["params"]["error"].is_null()}})
|
||||
} else {
|
||||
bootstrap_success(id, command, &request, mode, profile_digest)
|
||||
bootstrap_success(
|
||||
id,
|
||||
command,
|
||||
&request,
|
||||
mode,
|
||||
profile_digest,
|
||||
&mut session_identity,
|
||||
)
|
||||
};
|
||||
write_json(&mut stdout, &response)?;
|
||||
if command == "turn.start" {
|
||||
@@ -122,7 +130,14 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
if command == "permission.resolve" {
|
||||
write_json(
|
||||
&mut stdout,
|
||||
&bootstrap_success(id, command, &request, mode, profile_digest),
|
||||
&bootstrap_success(
|
||||
id,
|
||||
command,
|
||||
&request,
|
||||
mode,
|
||||
profile_digest,
|
||||
&mut session_identity,
|
||||
),
|
||||
)?;
|
||||
continue;
|
||||
}
|
||||
@@ -305,7 +320,14 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
write_json(
|
||||
&mut stdout,
|
||||
&bootstrap_success(id, command, &request, mode, profile_digest),
|
||||
&bootstrap_success(
|
||||
id,
|
||||
command,
|
||||
&request,
|
||||
mode,
|
||||
profile_digest,
|
||||
&mut session_identity,
|
||||
),
|
||||
)?;
|
||||
let params = request.get("params").unwrap_or(&Value::Null);
|
||||
let turn_id = params
|
||||
@@ -755,6 +777,7 @@ fn bootstrap_success(
|
||||
request: &Value,
|
||||
mode: &str,
|
||||
profile_digest: &str,
|
||||
session_identity: &mut Value,
|
||||
) -> Value {
|
||||
if command == "permission.resolve" {
|
||||
if mode.starts_with("permissions-") {
|
||||
@@ -790,7 +813,7 @@ fn bootstrap_success(
|
||||
.get("model")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("missing");
|
||||
json!({
|
||||
let result = json!({
|
||||
"sidecarPid": std::process::id(),
|
||||
"identity": {
|
||||
"kind": "acpx",
|
||||
@@ -808,7 +831,9 @@ fn bootstrap_success(
|
||||
},
|
||||
"status": {},
|
||||
"turnControls": {"steering": matches!(mode, "controls" | "controls-wrong-ack" | "controls-downgrade"), "queuedFollowUp":matches!(mode, "controls" | "controls-wrong-ack" | "controls-downgrade")},
|
||||
})
|
||||
});
|
||||
*session_identity = result["identity"].clone();
|
||||
result
|
||||
}
|
||||
"run.attach" => json!({
|
||||
"runId": if mode == "bootstrap-wrong-run" { "wrong-run" } else { params.get("runId").and_then(Value::as_str).unwrap_or("missing") },
|
||||
@@ -825,22 +850,18 @@ fn bootstrap_success(
|
||||
"turn.cancel" => {
|
||||
json!({"cancelled":mode != "turns-wrong-cancel", "sessionClosed":matches!(mode, "turns-retired" | "turns-retired-terminal-first")})
|
||||
}
|
||||
"session.suspend" => json!({
|
||||
"suspended":mode != "suspend-wrong-ack",
|
||||
"identity": if mode == "suspend-missing-identity" { Value::Null } else { json!({
|
||||
"kind": "acpx",
|
||||
"normalizedSessionId": if mode == "suspend-wrong-identity" { "another-session" } else { "session-1" },
|
||||
"acpxRecordId": "record-1",
|
||||
"backendSessionId": "backend-1",
|
||||
"agentSessionId": "agent-1",
|
||||
"profileDigest": profile_digest,
|
||||
"workspaceDigest": format!("sha256:{}", "2".repeat(64)),
|
||||
"requestedModel": "gpt-5.6-sol",
|
||||
"effectiveModel": "gpt-5.6-sol",
|
||||
"permissionMode": "approve-reads",
|
||||
"providerLifetimeFenceCandidates": [60001, 60002, 60003],
|
||||
})},
|
||||
}),
|
||||
"session.suspend" => {
|
||||
let mut identity = session_identity.clone();
|
||||
if mode == "suspend-missing-identity" {
|
||||
identity = Value::Null;
|
||||
} else if mode == "suspend-wrong-identity" {
|
||||
identity["normalizedSessionId"] = json!("another-session");
|
||||
}
|
||||
json!({
|
||||
"suspended": mode != "suspend-wrong-ack",
|
||||
"identity": identity,
|
||||
})
|
||||
}
|
||||
"tool.resolve" => json!({
|
||||
"resolved":if mode == "resolutions-error-redaction" {
|
||||
params.get("callId").and_then(Value::as_str) == Some("call-1")
|
||||
|
||||
+1
-11
@@ -42,7 +42,7 @@ fn config(mode: &str) -> AcpxProviderSessionConfig {
|
||||
shutdown_grace: Duration::from_millis(100),
|
||||
},
|
||||
agent: "codex".to_owned(),
|
||||
model: "gpt-5.6-sol".to_owned(),
|
||||
model: "explicit-test-model".to_owned(),
|
||||
run_id: "run-1".to_owned(),
|
||||
catalog_revision: 1,
|
||||
runtime_directory: std::env::temp_dir(),
|
||||
@@ -270,7 +270,6 @@ fn interactive_permission_requires_an_offered_action_and_acknowledgement() {
|
||||
for mode in ["permissions-interactive", "permissions-wrong-ack"] {
|
||||
let mut cfg = config(mode);
|
||||
cfg.agent = "claude".to_owned();
|
||||
cfg.model = "claude-sonnet-5".to_owned();
|
||||
let mut session = AcpxProviderSession::start(&cfg).unwrap();
|
||||
session
|
||||
.start_turn("turn-1", "Run validation", &std::env::temp_dir())
|
||||
@@ -309,14 +308,6 @@ fn permission_origin_is_bound_to_the_admitted_connection_and_survives_projection
|
||||
for agent in ["claude", "copilot", "cursor", "pi"] {
|
||||
let mut cfg = config("permissions-interactive");
|
||||
cfg.agent = agent.to_owned();
|
||||
cfg.model = if agent == "claude" {
|
||||
"claude-sonnet-5"
|
||||
} else if agent == "pi" {
|
||||
"openrouter/deepseek/deepseek-v4-flash-0731"
|
||||
} else {
|
||||
"explicit-test-model"
|
||||
}
|
||||
.to_owned();
|
||||
if agent == "cursor" {
|
||||
cfg.mode = Some("agent".to_owned());
|
||||
}
|
||||
@@ -353,7 +344,6 @@ fn permission_origin_is_bound_to_the_admitted_connection_and_survives_projection
|
||||
fn rejects_a_permission_origin_claim_from_another_provider() {
|
||||
let mut cfg = config("permissions-forged-origin");
|
||||
cfg.agent = "claude".to_owned();
|
||||
cfg.model = "claude-sonnet-5".to_owned();
|
||||
let mut session = AcpxProviderSession::start(&cfg).unwrap();
|
||||
session
|
||||
.start_turn("turn-1", "Request permission", &std::env::temp_dir())
|
||||
|
||||
@@ -42,12 +42,7 @@ fn config(mode: &str) -> AcpxProviderSessionConfig {
|
||||
"codex"
|
||||
}
|
||||
.to_owned(),
|
||||
model: if mode.starts_with("controls") {
|
||||
"openrouter/deepseek/deepseek-v4-flash-0731"
|
||||
} else {
|
||||
"gpt-5.6-sol"
|
||||
}
|
||||
.to_owned(),
|
||||
model: "explicit-test-model".to_owned(),
|
||||
run_id: "run-1".to_owned(),
|
||||
catalog_revision: 1,
|
||||
runtime_directory: std::env::temp_dir(),
|
||||
|
||||
+1
-3
@@ -199,7 +199,7 @@ fn prepare_payload_with_mode(directory: &Path, agent: &str, mode: &str) -> Value
|
||||
"driver": "acpx_runtime",
|
||||
"providerVersion": "0.13.1",
|
||||
"agent": agent,
|
||||
"model": "gpt-5.6-sol",
|
||||
"model": "explicit-test-model",
|
||||
"acpxVersion": "0.13.1",
|
||||
"agentServerPackage": "@agentclientprotocol/codex-acp",
|
||||
"agentServerVersion": "1.6.2",
|
||||
@@ -228,7 +228,6 @@ fn prepare_payload_with_mode(directory: &Path, agent: &str, mode: &str) -> Value
|
||||
fn pi_prepare_payload(directory: &Path, mode: &str) -> Value {
|
||||
let mut payload = prepare_payload_with_mode(directory, "pi", mode);
|
||||
let provider = &mut payload["provider"];
|
||||
provider["model"] = json!("openrouter/deepseek/deepseek-v4-flash-0731");
|
||||
provider["agentServerPackage"] = json!("pi-acp");
|
||||
provider["agentServerVersion"] = json!("0.0.33");
|
||||
provider["agentRuntimePackage"] = json!("@earendil-works/pi-coding-agent");
|
||||
@@ -262,7 +261,6 @@ fn pending_acpx_runtime_request(
|
||||
.unwrap() = digest.into();
|
||||
let provider = &mut payload["provider"];
|
||||
provider["agent"] = json!("claude");
|
||||
provider["model"] = json!("claude-sonnet-5");
|
||||
provider["agentServerPackage"] = json!("@agentclientprotocol/claude-agent-acp");
|
||||
provider["agentServerVersion"] = json!("0.73.0");
|
||||
provider["agentRuntimePackage"] = json!("@anthropic-ai/claude-agent-sdk");
|
||||
|
||||
@@ -99,12 +99,7 @@ function acpxExecution(
|
||||
provider: {
|
||||
kind: "acpx",
|
||||
agent,
|
||||
model:
|
||||
agent === "codex"
|
||||
? "gpt-5.6-sol"
|
||||
: agent === "pi"
|
||||
? "openrouter/deepseek/deepseek-v4-flash-0731"
|
||||
: "claude-sonnet-5",
|
||||
model: "explicit-test-model",
|
||||
permissionPolicy: "interactive",
|
||||
profile: {
|
||||
driverKind: "acpx_runtime",
|
||||
@@ -476,7 +471,7 @@ describe("native backend factory", () => {
|
||||
async (agent) => {
|
||||
const input = acpxExecution();
|
||||
if (input.provider.kind !== "acpx") throw new Error("Invalid ACPX fixture");
|
||||
const model = agent === "grok" ? "grok-4.7" : agent === "claude" ? "claude-sonnet-5" : "gpt-5.6-sol";
|
||||
const model = "explicit-test-model";
|
||||
Object.assign(input.provider, { agent, model, profile: resolveQualifiedAcpxProfile(agent, model) });
|
||||
const backend = createNativeSessionBackend(input, {
|
||||
codexTransportFactory: () => {
|
||||
|
||||
@@ -1182,7 +1182,7 @@ describe("Capability live runnerd and Codex session", () => {
|
||||
});
|
||||
const session = await service.create({
|
||||
provider: "acpx", acpxAgent,
|
||||
requestedModel: acpxAgent === "pi" ? "openrouter/deepseek/deepseek-v4-flash-0731" : "exact-model",
|
||||
requestedModel: "explicit-test-model",
|
||||
});
|
||||
const result = await session.sendMessage("Orient to this task.");
|
||||
expect(result.status).toBe("completed");
|
||||
|
||||
Reference in new issue
Block a user