feat(runner): native resume_messages on run_task - #100
Conversation
Seed typed ConversationMessage transcript into generator sessions so durable stores (chorus ledger, FileSessionStore) can resume without stuffing history into the intent string. Co-authored-by: Cursor <cursoragent@cursor.com>
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@greptileai please review |
Greptile SummaryAdds typed transcript resumption across sessions, role runs, and the autowired task generator so durable-store callers can continue prior conversations.
Confidence Score: 4/5The transcript handoff should be corrected before merging because later generator sprints lose orientation context seen by the first sprint. The new multi-sprint continuation relies on RunRoleResult.messages, but that snapshot excludes the orientation message inserted only into the engine's local transcript, so resumed provider history differs from the preceding session. Files Needing Attention: src/dream/runner/_role_session.py
|
| Filename | Overview |
|---|---|
| src/dream/session.py | Sanitizes and seeds caller-provided resume messages into the live session transcript. |
| src/dream/runner/_role_session.py | Forwards resume messages and returns the session transcript, but the returned history omits engine-only orientation context. |
| src/dream/runner/_generator_head.py | Carries each successful generator session transcript forward into the next sequential sprint. |
| src/dream/harness.py | Exposes resume_messages through session, role, and autowired task entry points. |
| src/dream/messages.py | Introduces a public facade for conversation messages and supported content blocks. |
Sequence Diagram
sequenceDiagram
participant Store as Durable Store
participant Task as Harness.run_task
participant Head as Generator Head
participant Role as Harness.run_role
participant Session
participant Provider
Store->>Task: resume_messages
Task->>Head: construct with prior transcript
loop Each sprint
Head->>Role: prompt + prior_messages
Role->>Session: start_session(resume_messages)
Session->>Provider: sanitized history + sprint prompt
Provider-->>Session: assistant/tool turns
Session-->>Role: completed transcript
Role-->>Head: RunRoleResult.messages
Head->>Head: replace prior_messages
end
Prompt To Fix All With AI
### Issue 1
src/dream/runner/_role_session.py:260
**Returned transcript drops orientation**
On an initially cold generator session, the engine inserts the orientation message only into its local transcript, while `session.transcript` does not record it. Returning that incomplete transcript for the next sprint causes the resumed provider context to omit instructions that were present during the preceding sprint.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "refactor: rebind generator transcript st..." | Re-trigger Greptile
| final_text="".join(text_chunks), | ||
| cost=session.cost, | ||
| events=tuple(captured), | ||
| messages=tuple(session.transcript), |
There was a problem hiding this comment.
Returned transcript drops orientation
On an initially cold generator session, the engine inserts the orientation message only into its local transcript, while session.transcript does not record it. Returning that incomplete transcript for the next sprint causes the resumed provider context to omit instructions that were present during the preceding sprint.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/dream/runner/_role_session.py
Line: 260
Comment:
**Returned transcript drops orientation**
On an initially cold generator session, the engine inserts the orientation message only into its local transcript, while `session.transcript` does not record it. Returning that incomplete transcript for the next sprint causes the resumed provider context to omit instructions that were present during the preceding sprint.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.…n_task Seed typed ConversationMessage transcript before send, and capture per generator sprint so later sprints keep prior history instead of replaying a single resume list. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep transcript seeding on cold start and Session-owned rewind indices after the human-rewind merge. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the reviewed current-main implementation while joining the original PR branch without rewriting remote history.
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
There was a problem hiding this comment.
divo12 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
User description
Summary
Adds
resume_messagestoHarness.start_session,Harness.run_roleandHarness.run_task(autowired generator head), and exports the publicdream.messagestypes (ConversationMessage, content blocks) for durable-store callers. Resume seeds the live session transcript beforesend, so the provider sees real prior history (and skips orientation) instead of intent-string injection.run_taskinvokes the generator head once per sprint/retry, so a single capturedresume_messageswould replay the original transcript on every sprint and silently drop the preceding sprint's conversation and tool history. Resume now seeds only the first invocation and each later sprint continues from the completed previous session:RunRoleResultgainedmessages(the completed session transcript) to make that possible.Type
Checklist
tests/test_public_api.pyupdated if the public API changedCHANGELOG.mdupdated for user-visible changes.env.local, or credentials in the diffdream(org/company features belong in sibling repos)Test plan
uv run pytest tests/test_runner/ tests/test_subagents/ tests/test_public_api.py -q— 29 passeduv run ruff check src tests/uv run mypyconversation_message/tool_call→resume_messagesand drop intent-injection resumeNotes
Complements dream #92 (FileSessionStore) and chorus #89 (ledger SoT). SecretProxy remains #94.
Link to Devin session: https://app.devin.ai/sessions/4f7deb4af0914056a24a4d660a661713
Requested by: @divo12
CodeAnt-AI Description
Resume conversations from typed message history across sessions and task sprints
What Changed
start_session,run_role, and autowiredrun_taskgenerators can begin with conversation history from a durable storedreamAPIImpact
✅ Conversations continue from stored history✅ Generator sprints retain prior tool and assistant messages✅ Typed transcript support for durable-store integrations💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.