Skip to content

Commit 38e39db

Browse files
committed
fix(agent): pin host-scope resource runtime
1 parent 300114d commit 38e39db

18 files changed

Lines changed: 196 additions & 329 deletions

Cargo.lock

Lines changed: 13 additions & 163 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ hyper = { version = "1", features = ["client", "http1"] }
2525
hyper-util = { version = "0.1", features = ["client-legacy", "http1", "tokio"] }
2626
parking_lot = "0.12"
2727
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
28-
rustscript-vm = { package = "pd-vm", git = "https://github.com/rustscript-lang/rustscript.git", rev = "fd4b570d08d7cc90cc29e3b05df59c9e9bf3b88e", default-features = false, features = ["runtime", "http-client", "sqlite"] }
28+
rustscript-vm = { package = "pd-vm", git = "https://github.com/rustscript-lang/rustscript.git", rev = "8763366c4a0d9d43ea9efabf7e8ed08df6ce6d92", default-features = false, features = ["runtime", "http-client", "sqlite"] }
2929
serde = { version = "1", features = ["derive"] }
3030
serde_json = "1"
3131
tokio = { version = "1", features = ["full"] }

rss/storage/admission.rss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct AdmissionCreateInput {
3030
expires_at_ms: int
3131
}
3232

33-
pub fn storage_admission_create(db_id: int, payload_json: string) -> map {
33+
pub fn storage_admission_create(db_id: resource<sqlite.connection>, payload_json: string) -> map {
3434
let input: AdmissionCreateInput = json::decode::<AdmissionCreateInput>(payload_json);
3535
let mut failed: bool = false;
3636
let mut failure_code: string = "";
@@ -55,7 +55,7 @@ pub fn storage_admission_create(db_id: int, payload_json: string) -> map {
5555
if failed == false {
5656
if input.idempotency_key.copy() != "" {
5757
let existing: map = sqlite::query(
58-
db_id,
58+
&db_id,
5959
"SELECT scope, key, request_hash, resource_type, resource_id, state, response_json FROM idempotency_records WHERE scope = ? AND key = ? LIMIT 1",
6060
[&input.idempotency_scope, &input.idempotency_key],
6161
{ max_rows: 1, max_result_bytes: 8192 }
@@ -116,12 +116,12 @@ pub fn storage_admission_create(db_id: int, payload_json: string) -> map {
116116
sql: "INSERT INTO run_retention (run_id, first_seq, high_water_seq, updated_at_ms) SELECT ?, COALESCE((SELECT MIN(seq) FROM run_events WHERE run_id = ?), 0), COALESCE((SELECT MAX(seq) FROM run_events WHERE run_id = ?), 0), ? WHERE EXISTS (SELECT 1 FROM runs WHERE id = ?) ON CONFLICT (run_id) DO UPDATE SET first_seq = excluded.first_seq, high_water_seq = MAX(run_retention.high_water_seq, excluded.high_water_seq), updated_at_ms = excluded.updated_at_ms",
117117
params: [&input.run_id, &input.run_id, &input.run_id, input.now_ms.copy(), &input.run_id]
118118
};
119-
sqlite::transaction(db_id, statements);
119+
sqlite::transaction(&db_id, statements);
120120
}
121121
}
122122
let query_run_id: string = if replay => { existing_run_id } else => { input.run_id.copy() };
123123
let run_result: map = sqlite::query(
124-
db_id,
124+
&db_id,
125125
"SELECT id, session_id, parent_run_id, status, input_json, provider, model, script_hash, idempotency_scope, idempotency_key, turn_count, input_tokens, output_tokens, error_code, error_message, recovery_reason, created_at_ms, started_at_ms, finished_at_ms, updated_at_ms FROM runs WHERE id = ? LIMIT 1",
126126
[&query_run_id],
127127
{ max_rows: 1, max_result_bytes: 65536 }
@@ -141,13 +141,13 @@ pub fn storage_admission_create(db_id: int, payload_json: string) -> map {
141141
}
142142
}
143143
let session_result: map = sqlite::query(
144-
db_id,
144+
&db_id,
145145
"SELECT id, profile, platform, account_id, chat_id, thread_id, user_id, generation, status, system_prompt, model, provider, toolset_hash, metadata_json, last_message_seq, created_at_ms, updated_at_ms FROM sessions WHERE id = ? LIMIT 1",
146146
[&input.session_id],
147147
{ max_rows: 1, max_result_bytes: 65536 }
148148
);
149149
let message_result: map = sqlite::query(
150-
db_id,
150+
&db_id,
151151
"SELECT id, session_id, ordinal, role, content_json, name, tool_call_id, parent_message_id, token_estimate, compacted, metadata_json, run_id, finish_reason, created_at_ms FROM messages WHERE id = ? AND session_id = ? LIMIT 1",
152152
[&input.message_id, &input.session_id],
153153
{ max_rows: 1, max_result_bytes: 65536 }
@@ -156,7 +156,7 @@ pub fn storage_admission_create(db_id: int, payload_json: string) -> map {
156156
{ columns: [], rows: [] }
157157
} else => {
158158
sqlite::query(
159-
db_id,
159+
&db_id,
160160
"SELECT scope, key, request_hash, resource_type, resource_id, state, response_json, created_at_ms, expires_at_ms, completed_at_ms FROM idempotency_records WHERE scope = ? AND key = ? LIMIT 1",
161161
[&input.idempotency_scope, &input.idempotency_key],
162162
{ max_rows: 1, max_result_bytes: 8192 }

0 commit comments

Comments
 (0)