keep a session's given name when its workspace changes
the workspace route put the session's own copy of its info back into the registry, and that copy still has the title the session started with. a renamed root then went back to its old title in the workspace reply and as the sender name on its children's task letters. remember now re-reads the stored row, which has the new workspace, the given name, and the latest title, and answers with it.
250 unmodified linesExpand all2512522532542552562572582592602612622632642652667 unmodified lines27427527627727827928028128228328421 unmodified lines250 unmodified linesExpand all assert deleted["deleted"] == 2, deleted listed = [s["id"] for s in api("/sessions")] assert lead not in listed and coder not in listed, listed
# Moving a renamed session keeps its name, and its children hear # from it by that name. api(f"/sessions/{radio}", {"name": "radio desk"}, method="PATCH") moved = workspace.parent / "moved" moved.mkdir() assert api(f"/sessions/{radio}/workspace", {"workspace": str(moved)})["title"] == "radio desk" assert [s["title"] for s in api("/sessions") if s["id"] == radio] == ["radio desk"]
# A child can use a different configured provider without changing its parent. try: api(f"/sessions/{radio}/children", {"name": "missing", "task": "should not run", "model": "beta/no-such-model"})7 unmodified lines assert child["session"]["provider"] == "beta", child assert child["session"]["model"] == "fixture-beta", child assert child["member"]["parent"] == radio, child settle(child["session"]["id"]) assert len(asked('kind="task">\ncross-provider')) == 2 assert all('from="radio desk"' in task for task in asked('kind="task">\ncross-provider')), \ asked("cross-provider task") assert sum("/beta/" in path for path in Provider.paths) >= 2, Provider.paths print("spawn, renaming, cross-provider routing, forwarded answers, mail, and deletion hold") finally: if connection:21 unmodified lines77 unmodified lines7879808182838283848586878889134 unmodified linesExpand all2242252262272262272282282292302312322332342352362372382352392402412422432442451667 unmodified linesExpand all1913191419151916191219131914191719181919192019211922216 unmodified linesExpand all77 unmodified lines ReadHistory(String, Option(Int), Int, Subject(Result(String, String))) Fork(String, Int, Subject(Result(conversation.Info, String))) DeleteSession(String, Subject(Result(Nil, String))) Rename(String, String, Subject(Result(conversation.Info, String))) /// A session's info changed; the session itself already knows. Remember(String, conversation.Info) /// A session's info changed; the session itself already knows. The stored /// row is re-read, since the session's own copy keeps the title it started /// with rather than a later message's title or a name it was given. Remember(String, Subject(Result(conversation.Info, String))) WorkerDown(process.Down) Sweep ScheduleTick Shutdown134 unmodified linesExpand all let #(state, found) = activate(state, id) process.send(reply, found) actor.continue(state) } Remember(id, info) -> case dict.get(state.sessions, id) { Ok(#(_, worker)) -> Remember(id, reply) -> { let stored = conversation.get(runtime.ledger(state.host), id) process.send(reply, stored) case stored, dict.get(state.sessions, id) { Ok(info), Ok(#(_, worker)) -> actor.continue( State( ..state, sessions: dict.insert(state.sessions, id, #(info, worker)), ), ) Error(_) -> actor.continue(state) _, _ -> actor.continue(state) } } List(reply) -> { let db = runtime.ledger(state.host) let children = family.descendants(db) |> result.unwrap([]) |> set.from_list1667 unmodified linesExpand all decode.field("workspace", decode.string, decode.success), ) // The session answers here, off the registry. |> result.try(session.set_workspace(worker, _)) |> result.map(fn(info) { process.send(registry, Remember(id, info)) info |> result.try(fn(_) { actor.call(registry, 5000, Remember(id, _)) }) { Ok(info) -> reply(200, info_json(info)) Error(e) -> error(409, e)216 unmodified linesExpand all