Skip to content

Commit 951d4bf

Browse files
committed
Fix Go sqlite stub and Python resetSessionApprovals call for CLI 1.0.76-0
Two follow-ups from the CLI bump: * The Go e2e sqlite provider is a stub (no cgo sqlite dependency) that returned a canned {id, name} row for every SELECT. The runtime now reads its own inbox_entries bookkeeping table through the SessionFS sqlite provider and deserializes those rows into typed structs, so it rejected the canned row with 'Invalid inbox row: missing field recipient_session_id'. Scope the canned row to the `items` table the test actually models and return an empty result set for everything else. * permissions.resetSessionApprovals now takes a params object, which is a required argument in the generated Python API. Pass PermissionsResetSessionApprovalsRequest() at the e2e call site (the Go and Rust call sites were already updated). Generated by Copilot Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e615d062-bcb7-431e-aa9c-d3e47405723a
1 parent 094b0aa commit 951d4bf

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

go/internal/e2e/session_fs_sqlite_e2e_test.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,12 @@ func (p *inMemorySqliteProvider) runQueryLocked(queryType rpc.SessionFSSqliteQue
238238
LastInsertRowid: &lastID,
239239
}
240240
case rpc.SessionFSSqliteQueryTypeQuery:
241-
if strings.Contains(upper, "SELECT") {
241+
// Only the "items" table the test asks the agent to create is modelled
242+
// here. The runtime also reads its own bookkeeping tables (for example
243+
// inbox_entries) through this provider and deserializes those rows into
244+
// typed structs, so returning the canned item row for every SELECT would
245+
// make the runtime reject rows it cannot parse.
246+
if strings.Contains(upper, "SELECT") && readsTable(upper, "ITEMS") {
242247
return &copilot.SessionFSSqliteQueryResult{
243248
Columns: []string{"id", "name"},
244249
Rows: []map[string]any{{"id": "a1", "name": "Widget"}},
@@ -249,6 +254,18 @@ func (p *inMemorySqliteProvider) runQueryLocked(queryType rpc.SessionFSSqliteQue
249254
return &copilot.SessionFSSqliteQueryResult{Columns: []string{}, Rows: []map[string]any{}}
250255
}
251256

257+
// readsTable reports whether an upper-cased SQL statement selects from the given
258+
// table, tolerating the quoting styles the agent may emit.
259+
func readsTable(upperQuery string, table string) bool {
260+
names := []string{table, `"` + table + `"`, "`" + table + "`", "[" + table + "]", "MAIN." + table}
261+
for _, name := range names {
262+
if strings.Contains(upperQuery, "FROM "+name) {
263+
return true
264+
}
265+
}
266+
return false
267+
}
268+
252269
func (p *inMemorySqliteProvider) SqliteExists() (bool, error) {
253270
p.mu.Lock()
254271
defer p.mu.Unlock()

python/e2e/test_rpc_session_state_e2e.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
ModeSetRequest,
3434
NameSetAutoRequest,
3535
NameSetRequest,
36+
PermissionsResetSessionApprovalsRequest,
3637
PermissionsSetApproveAllRequest,
3738
PlanUpdateRequest,
3839
SessionSetCredentialsParams,
@@ -594,7 +595,9 @@ async def test_should_call_session_usage_and_permission_rpcs(self, ctx: E2ETestC
594595
)
595596
assert approve_all.success
596597

597-
reset = await session.rpc.permissions.reset_session_approvals()
598+
reset = await session.rpc.permissions.reset_session_approvals(
599+
PermissionsResetSessionApprovalsRequest()
600+
)
598601
assert reset.success
599602
finally:
600603
await session.rpc.permissions.set_approve_all(

0 commit comments

Comments
 (0)