Repository navigation
test(shells,cron): cover the #75 follow-ups; pin per-response subagent pricing (#78) - #131
Merged
Merged
Conversation
…t pricing (#78) Already covered on main: the router test-isolation fix (the client fixture stubs _maybe_sync), and get_primary_model's non-determinism, which #106 removed by pricing each response with its own model. This adds tests for _is_session_ended, POST /shells/{id}/kill with lsof and kill stubbed, <task-notification> natural exits through both the tool-use-id path and the task-id fallback, Read-on-output-file polls, and !-backgrounded Manual shells. It also adds the v19 background_shells rebuild starting from the real v13 and v18 table shapes, the croniter-absent guard, and the cron_jobs deleted_at/deleted_via coherence CHECK. A mixed-model subagent test pins per-response pricing so a single primary-model pick cannot return. No production code changes. Claude-Session: https://claude.ai/code/session_019dHRodCxwuwTvnKtUNrUU7
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.
Problem
#78 listed the risky paths from the bg-shells/cron data layer (#75) that had no tests. Tests only; no production code changes.
Changes
_is_session_ended: ENDED/LIVE/WAITING/STALE states and the absent-file stale/fresh mtime cases.POST /shells/{id}/kill:terminated_by='kill'even when lsof finds no PID;pids_signalledmirrors stubbed lsof; no lsof → nothing runs; already-terminated left alone; unknown id 404.<task-notification>natural exit:<tool-use-id>path (completed/failed/timeout) and the<task-id>fallback for!-backgrounded shells.!) shell extraction incl. the synthetic poll and persistence.background_shellsrebuild, parametrized from the real v13 and v18 shapes: reaches v24, keeps rows and child polls, accepts'Manual', keeps FKs on, flags reindex.cron_jobs(deleted_at, deleted_via)CHECK.get_primary_modelwas removed in Fix session analytics accuracy: dedupe usage, current pricing, active time #106, so the non-determinism item is moot).Verification
Each new test was checked to fail with its code path broken (guard removed, check inverted, branch deleted). Full
apisuite alone: 2066 passed, 6 skipped (23 new). ruff check and format clean on the touched files.Follow-ups
session_uuidFK withON DELETE CASCADEonbackground_shellsthat fresh installs have; harmless today because the indexer deletes child rows explicitly (subagent_tools holds rows whose invocation_id has no subagent_invocations row #107), but the schemas differ. Tracked in a new issue.Closes #78
https://claude.ai/code/session_019dHRodCxwuwTvnKtUNrUU7