feat: implement session management for blog writing, including session persistence and follow-up handling - #32
Merged
Merged
Conversation
…n persistence and follow-up handling
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The follow-up text is stored in ResearchState.CurrentSubTask, but that field is overwritten by the Blogger stage before the Author stage runs, so follow-ups won’t reliably reach the author prompt.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds session management to the BlogWriter console workflow so users can persist state locally, resume prior sessions, and request follow-up revisions on an existing draft.
Changes:
- Introduces a persisted
BlogSessionmodel plus anIBlogSessionStoreabstraction with a JSON-on-diskFileBlogSessionStoreimplementation. - Updates the console app to create/save sessions, resume by session ID, and accept follow-up requests after printing results.
- Extends author prompting to include an optional “user follow-up” and adds
ResearchState.StartFollowUp(...)with associated tests.
File summaries
| File | Description |
|---|---|
| ResearchState.cs | Adds StartFollowUp(...) helper to reset review-cycle state for a follow-up. |
| Prompts.cs | Updates author instructions to mention optional user follow-up input. |
| Program.cs | Adds session store wiring; supports resume <session-id> and follow-up loop. |
| IBlogSessionStore.cs | New session persistence abstraction for creating/loading/saving sessions. |
| HostedAgents/Author/AgentPrompt.cs | Keeps hosted Author prompt aligned with console app prompt changes. |
| FileBlogSessionStore.cs | New file-backed JSON session store implementation. |
| BlogSession.cs | New persisted session model (id/timestamps/state). |
| AuthorAgent.cs | Includes “User Follow-Up” field in the author-turn user message; adds test-client constructor overload. |
| BlogWriter.Tests/ResearchStateTests.cs | Adds unit test covering StartFollowUp(...) behavior. |
| BlogWriter.Tests/FileBlogSessionStoreTests.cs | Adds round-trip test coverage for file session persistence. |
| docs/deployment.md | Documents follow-ups, session persistence location, and resume flow. |
| docs/configuration.md | Documents BLOG_SESSION_STORE_PATH configuration key. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+32
to
+40
| /// <summary>Prepares an approved or revision-capped draft for a user-requested follow-up.</summary> | ||
| public void StartFollowUp(string followUp) | ||
| { | ||
| ArgumentException.ThrowIfNullOrWhiteSpace(followUp); | ||
| CurrentSubTask = followUp.Trim(); | ||
| ReviewNotes = ""; | ||
| RevisionNumber = 0; | ||
| NextStep = ""; | ||
| } |
Comment on lines
+45
to
+49
| ArgumentNullException.ThrowIfNull(session); | ||
| if (!IsValidId(session.Id)) | ||
| { | ||
| throw new ArgumentException("Session ID must be a 32-character hexadecimal GUID.", nameof(session)); | ||
| } |
Comment on lines
+3
to
+4
| /// <summary>Persists completed workflow state so a user can continue a draft.</summary> | ||
| public interface IBlogSessionStore |
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.
Add session object and abillty to ask follow up questions.