Repository navigation
agent: -m with --session is a turn on that session; stats reset no longer re-caches old totals - #641
Merged
Merged
Conversation
…s back Review finding on #640. POST /v1/stats/reset cleared the cached /v1/stats answer, but a /v1/stats request already reading the sessions at that moment stored its pre-reset answer afterwards, and the old totals were served for another five seconds. - The cache has a generation that goes up when it is dropped. An answer is stored only if the cache has not been dropped since the request started (StatsCacheGet / StatsCachePut / StatsCacheDrop). - The Stats tab draws only the newest request's answer. A poll sent just before the reset could answer after the reset's own refresh and put the old totals back on screen until the next poll. Tests: gateway_stats_buckets_tests pins the cache (an answer from before a drop is refused, one from after is kept); removing the generation check fails it. The page's ordering was checked in a browser with a held request: with the check the totals stay at zero, without it the old ones come back. No committed test for the page. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
… for it `pasclaw agent -m "..." --session ID` sent the model the new prompt alone and then saved that turn's history over the session file. So: - the reply was never saved: the loop's history stops one message short of it, and only the history was written; - the model did not see the conversation so far; - the conversation so far was replaced by the latest question, whatever the session held -- an interactive session passed here lost its transcript. The one-shot path now runs the turn the way the interactive prompt resumes a session: - the stored messages come first, then the prompt; - the prompt, tool calls and results, and the reply are added to the transcript; a provider refusal's error text is printed, not saved as a reply, and the question is kept; - the session's own prompt is used and saved back (after a compaction the summary lives there), with the working-state snapshot in front of it for the turn only and brought up to date afterwards; - the turn works in the directory the session works in. Without --session a one-shot still saves nothing. `profile bench` uses a fresh id per run and is unaffected. StripWorkingStatePrefix is the interactive path's inline code, moved out so both paths share it. Tests: oneshot_session_e2e.py runs the real binary against a scripted fake provider (plain replies, a tool call, a 401, a compacting turn). Each of the nine behaviours, reverted alone, fails it. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
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.
Two unrelated fixes, one commit each.
1.
pasclaw agent -m "..." --session ID(d685bad)The command sent the model the new prompt alone and then saved that turn's history over the session file. So:
Three one-shot turns on one session, on
main:With this change, turn 3 sends both earlier questions and replies before the third question, and the session holds all six messages.
The one-shot path now runs the turn the way the interactive prompt resumes a session:
Behaviour change: a one-shot launched from a different directory than the session's now runs its tools in the session's directory, as
pasclaw resumedoes.Unchanged: without
--sessiona one-shot saves nothing.profile benchuses a fresh id per run and is unaffected.StripWorkingStatePrefixis the interactive path's inline code, moved out so both paths share it.2. Stats reset and the cached answer (
3d8b58f)Review finding on #640.
POST /v1/stats/resetcleared the cached/v1/statsanswer, but a/v1/statsrequest already reading the sessions at that moment stored its pre-reset answer afterwards. The old totals were then served for another five seconds.Tests
make test-oneshot-session-e2e(oneshot_session_e2e.py): the real binary against a scripted fake provider — plain replies, a tool call, a 401, a session that works in another directory, a compacting turn. Each of the nine behaviours, reverted alone, fails it.make test-gateway-stats-buckets: an answer from before a cache drop is refused, one from after is kept. Removing the generation check fails it.make testpasses on FPC 3.2.2. Not built with Delphi.Generated by Claude Code