Repository navigation
feat(statusline): report session end so ShellTime summarizes it right away - #12
Merged
Merged
Conversation
… away
Register a session.end hook that POSTs {sessionId, reason} to
/api/v1/cc/session-end. ShellTime then writes the session's AI summary
about 30 seconds later and updates the PR cost comment right after,
instead of waiting for its 20-minute or 24-hour runs.
The request runs alongside the engine's own end step, inside the exit's
shared 1.5 s bound, and never throws, so an exit is never held up or
failed. Without a token nothing is sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C1wVAG9ZuUfqMapByqem9
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
Summary
Adds a
session.endhook, the mod form of Claude Code's SessionEnd event. When a session ends, the hook sends ShellTime one request:The server writes the session's AI title, description and summary about 30 seconds later, then updates the PR cost comment straight away. Today the summary waits for the 20-minute or 24-hour run. The server side is in shelltime/server, branch
claude/relaxed-tesla-gdpksy.Details
session.endhook shares one 1.5 s wall-clock bound, and plugin hook timeouts can't raise it. So the hook sends one POST with no retry, and runs it alongside the engine's own end step rather than ahead of it.logOnce. If the request doesn't make it, the server's timed runs still summarize the session.$.http.fetchdirectly, likesession-project, so it needs no CLI release or daemon.Changes
hooks/api.ts:sessionEndRequest.hooks/register.tsx:sendSessionEndand thesession.endhook.hooks/sessionEnd.test.ts: posts for every reason with the CLI token; sends nothing without a token; a thrown fetch or a 500 still ends the session.plugin.jsonandmarketplace.jsondescriptions: a new "Session end" section, and the comment section now mentions the AI summary.Rollout
Deploy the server first. Until it ships, the request gets a 404, which only lands in the debug log.
Test plan
pnpm typecheckpnpm test(31 passed)claude plugin validate --strict plugins/shelltime-statuslineclaude plugin test plugins/shelltime-statusline(32 passed, 4 new)🤖 Generated with Claude Code
https://claude.ai/code/session_016C1wVAG9ZuUfqMapByqem9
Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.