Repository navigation
Chunk 59: a small bug-fix chunk after 0.50.0 (MCP sessions held, turn cost counted, transcript window, session list order, logout hand-over, gateway fields checked) - #1269
Merged
Conversation
…on, and a stop waits once Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
…and-over was in flight A TUI's hand-over reads the sign-in, then asks the daemon who it is and links it. A troupe logout that ran between those steps took the token back, and the link then gave it again. The hand-over now reads the sign-in once the daemon has the token and, finding it gone, sends identity.sign_out itself, so whichever ends last, the daemon holds none. Fixes #1245. Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
The daemon holds no plane token for a person who signed out while a hand-over was in flight
…connection is left waiting; Decision 1126 Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
…ix/1046-mcp-sessions Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
The daemon keeps one MCP session per connection for mcp.tools and mcp.call, a stop waits once, and a person's renewed token drops their older session
…hropic A loopback stand-in for LiteLLM's /v1/messages and /anthropic routes asserts that the cache_control marks, adaptive thinking's output_config and the thinking-binding anthropic-beta header reach the gateway as the provider sends them direct. Nothing was dropped on Troupe's side. The admin page says what LiteLLM does with them: the pass-through forwards body and headers unchanged; /v1/messages carries the beta to Bedrock as anthropic_beta, the thinking-binding beta from LiteLLM v1.103.0, so an older proxy needs thinking_binding left at default; and drop_params can drop output_config for a model it lists without effort. Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
… no longer helps A summary that fails (refused, timed out, its stream crashed) is written as compaction_failed, with the call as stopped, so a replay, the listing, the ledger and the session's summary count it; Session.Summary.fold counts the summariser's call on compacted and a stopped call on llm_error, cancelled and compaction_failed, so its totals agree with the listing. A pod reports what a session has cost as calls are folded, at most once every five seconds, so the plane's row says a subagent's calls while its root waits. compacted carries thinking_resent, thinking_dropped and prefix_mismatch, which Bench.Prefix counts. A compaction that leaves the prompt over the threshold holds compacting until a prompt is under it again, said in a config_note when it starts to, rather than compacting before every call. prompt_bytes.brief is the brief's size under a stable system prompt too, where it is part of the conversation. Refs #1050 Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
The Anthropic provider sends a gateway what it sends Anthropic, and the docs say what LiteLLM needs to pass it on
…ome in one pass visible_to/2 joined the ACL and needed distinct on the id, which Postgres sorts by before last_active_at: rows came back in id order and a limit kept the lowest ids. The ACL is now asked with exists, the order is last activity descending (never-active last, then newest made), and a limit keeps the most recent rows. sessions.list computed each row's role with role_for/2, up to three queries a session. Sessions.roles_for/2 answers a page with one ACL query, the memberships once and the page's teams once, by role_for/2's rules; harness.ex's session_rows/2 uses it. A listing of 2 or 10 visible sessions now costs 16 queries either way (17 and 57 before). Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
…UI formats Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
…ix/1050-turn-cost Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
Credo's nesting depth: the owner, team and invited cases of roles_for/2 are function heads. Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
The session listing comes back most recently active first, and its roles are computed for the page at once
A session that never compacted, or one paged all the way back, drew every turn in one render: about 21,000 elements for 10,000 events. The transcript now draws the turns within a screen above and below what is on it, five more either side, and keeps the room of the rest as a block above and one below, so the scrollbar stays the whole session's. holdPlace keeps the reader's place whenever the drawn turns change, and looks into a turn's children now that a turn is a box-less .turn-group. New content draws the tail again and scrolls there. aria-live moves to a box holding the newest turn, what is under way and what is queued, so turns drawn by scrolling are not read out. @troupe/test-support gains layOut and readThrough: jsdom lays nothing out, so a test that reads a whole transcript scrolls through a laid-out screen. Decision 1125 narrows 1095. Closes #1192. Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
A turn's cost counts every call it made, the plane's row follows it, and compacting stops when it no longer helps
The desktop's transcript draws only the turns near the reader, so a long session that never compacted opens with some 660 elements, not 21,000
Its setup installed only the publish function, so the gate's question to the host about a new version went to whatever host the VM held. In the umbrella's run that was the daemon's, left by the gateway suite, whose about/2 calls Troupe.Gateway.Plane; no such process runs in the worker suite, so the publish call's task crashed before it reached the approval gate, and the deny test saw a turn_ended with no approval_decided. The setup now installs the pod's host first and lays the test's publish over it. Signed-off-by: Martin Johannesson <martin.johannesson@it-minds.dk>
The worker's proposal-run test sets up the pod's whole artifacts host, so its deny run always reaches the approval gate
Merged
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this chunk is. A small bug-fix chunk after 0.50.0: four entries from the known-defects issues, one performance item, and one defect the chunk's own code research found. One pull request per issue into this branch, each verified in its own body.
What changed.
troupe logoutno longer leaves the daemon holding the token (The daemon holds no plane token for a person who signed out while a hand-over was in flight #1259 closes A TUI's plane token hand-over in flight during troupe logout leaves the daemon holding the token #1245): the hand-over reads the sign-in again once the daemon has answeredidentity.linkand, finding it gone, sendsidentity.sign_outitself, so whichever of the two ends last, the daemon holds no token for a person who signed out. The logout's wording is true in both orders. A test parks a hand-over at the token store and at itsidentity.get, runs the logout, lets it go, and sees the daemon's token nil; failing before. Left: a daemon-side refusal of a link after a sign-out would hold for every client but needs the daemon to remember signed-out tokens; named in the PR.mcp.toolsandmcp.callkeep oneTroupe.MCP.Sessionsper connection and workspace under a newTroupe.Gateway.MCPSessions, started on the first call and ended with itsDELETEs when the connection closes or the server entry goes (mcp.add,mcp.remove, a hand edit caught on the next call); a stateless server and a call with no connection behave as before; the sensitive-session marking and refusal stay where they were. Ending a caller's sessions is one bounded wait, everyDELETEsent at once and 1.5 s for them all instead of 3 s each eight at a time; aDELETEruns in a process killed when the wait is up, since Finch put a connection whose request timed out back in its pool still waiting on that answer and the next request lent it waited too (measured on the old code: 6.0 s to stop nine slow sessions, 3.0 s for the next request; now bounded, tests failing before). On a pod, a person-mode call carries whose credential it is (Troupe.MCP.Server.owner) and the session it opens drops the same person's older one from the table; the pod holds no credential to end it at the server, so the server's expiry does that, named in the decision. Filed A timed-out MCP request leaves its pooled connection waiting for the next request #1260 for the same pooled-connection shape on atools/listortools/callthat runs pasttimeout_ms.compaction_failedwithreason,error,model,prompt_bytesandstopped, and everything that counts cost reads it (the agent's replay,Spend.of,Log.Fold, the ledger, the index's dormant totals, the live bench,Session.Summary, the TUI and the GUI client), so a session summary's totals agree with the listing; a new event rather thanllm_errorwith a field, since the desktop and A2A readllm_erroras the turn ending and this turn goes on. The worker's manager reports a plane row's cost when a turn's cost is folded, for any agent, coalesced to one report in five seconds (a subagent's calls reach the row while the root waits; failing before).compactedcarriesthinking_resent,thinking_droppedandprefix_mismatchforBench.Prefix.count/1; a prompt still over the threshold right after a compaction holds compacting until a prompt is under it, told once as aconfig_notewith keycompaction, instead of compacting before every call forever;prompt_bytes.briefis the brief's size under the stable prompt. Schema regenerated (230 documents), PROTOCOL.md says what each carries. Decision 793 unchanged: on the fake,tools_changedis true once a turn at call 11 on a model that does not bind its thinking and never on one that does; the recordings show one change in 33 requests; the PR carries a proposal (offer the todo tools from call 1 on every model and refuse an earlytodo_writein the tool) for a later decision. Left and noted:Session.Checkpointfacts count nostoppedspend; a normal turn'sllm_errorafter a stream that reported usage is still not counted./v1/messageswith a bearer key,/anthropicpass-through withx-api-key) and asserts thecache_controlmarks,output_configwith adaptive thinking andblock_binding, the signed thinking block and theanthropic-betaheader reach the wire as the provider sends them to Anthropic; emptying the beta header made two of the four fail. Read from LiteLLM's source at its current main (lines quoted with permalinks in the PR): the pass-through forwards body and headers unchanged;/v1/messagescopiesanthropic-versionandanthropic-betato Anthropic, Bedrock and Vertex; Bedrock filters betas through its allow-list and puts the survivors in the body asanthropic_beta, the thinking-binding beta since v1.103.0;cache_controlandoutput_configpass;metadatais not passed on, so the owner's user id never reaches Anthropic through a proxy.docs/admin/integrations.md§5 and the providers page say so, with the minimum LiteLLM version. No behaviour changed, no decision.window.ts,useTurnWindow): the last 30 turns before layout, then the turns within one screen above and below plus five each side, re-checked on scroll, resize and change; undrawn turns keep their room as two blocks sized by measured or average height so the scrollbar stays true;holdPlacelooks inside a turn and skips the blocks; a line that arrives while the reader is far up draws the tail and scrolls to the foot;aria-livemoved to a box holding the newest turn and the part under way. Measured on the 10,000-event fake session: 21,004 elements to 664 at open and 224 settled, longest main-thread block 1.47 s to 0.25 s, click to the last answer 2.0 s to 0.9 s;content-visibility: autoalone still built every element (1.0 s longest block), which is why the window. Four tests failing before;from-checkpointandsession-chatread through the window with new@troupe/test-supporthelpers (layOut,readThrough). Left: a very large turn is drawn whole; things opened inside a turn close when it leaves the window or stops being the newest; the console's shorter list stays whole; the desktop has no deep link to an entry and no find, so neither was tested.mix check(360/361): the test installed only a publish function, and in the umbrella's run the gateway suite ahead of it left a daemon'saboutin the VM, which called aGateway.Planethat does not run in the worker suite, so the publish crashed before any decision was written; test only, 20 of 20 under load with the leak injected. Not the product's event order, and not A turn's cost counts every call it made, the plane's row follows it, and compacting stops when it no longer helps #1265.visible_to/2saiddistinct: s.idwithorder_by: [desc: s.last_active_at], which Ecto emits asDISTINCT ON (s.id) … ORDER BY s.id, so rows came back in id order and alimitkept the wrong page (the desktop re-sorts, which hid it); the ACL is now anexistssubquery and the order islast_active_atdescending with never-active last, then newest made, then id.Sessions.roles_for/2computes a page's roles in one ACL query plus the memberships already fetched, the rules those ofrole_for/2(a test asserts they agree across owner, team, invitation and hidden), used bysession_rows/2and so by every method that answers a row: a listing of 10 team sessions went from 57 queries to 16, of 2 from 17 to 16. No defaultlimit: no client passes one; a page size is a visible rule for a later decision, named in the PR.Verified on this branch's head (d711e6c, before #1268's one-file test change): root
mix check(protocol 325, operator 193, plane 1609, core 2029/2041 with the known 12rg-shim failures, gateway 441, worker 360/361 whole, the one being the proposal-run test's host leak that #1268 fixes, 361 after; daemon 32, a2a 53; credo 21559 no issues, format, boundaries ok),clients/tuimix check988/998 whole (the 3 known bench and doctor--benchshim tests, andAgentsManagerTestandNewSessionScreenTestunder load, 27/27 alone; credo 6463 no issues, format, xref, CLI reference current), GUI client 527 / console 409 / desktop 556 with 2 skipped, with build, tokens, icons and lines; decisions 649 in shape; schema 230 documents unchanged after regeneration; admin reference current; 58 files changed sinceorigin/mainand none adds a decision number to code; doc-size 766; doc-links 1171; locks agree 24; licences 931;mix hex.auditclean at root and TUI. Every pull request's own walk is in its body.Before you upgrade a plane: no migration, no CRD change. Schema: one new event,
compaction_failed;compactedgainsthinking_resent,thinking_dropped,prefix_mismatch;config_notegainskey: compaction. A client of the last release shows a failed compaction as nothing and counts its cost from the listing only. Behind a LiteLLM proxy older than v1.103.0, keepthinking_bindingatdefault(the docs say so). Decisions 1125 and 1126 taken; markers unchanged.Closes #1245, closes #1046, closes #1050, closes #1048, closes #1192, closes #1261.
git commit -s, the DCO); thedcocheck fails otherwise.