First stab at crude and simple workspace recovery hooks #4063
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.
This was born out of the frustration of agpt crashing on me with 100+ files in a directory and not knowing a thing about those artifacts afterwards (or its previous actions/search results). Have played with different schemes and also have different ideas on disk, this one seemed like the most straightforward option to actually extend it easily.
NOTE: This is NOT a proper persistence scheme (no pickle for #822, #1176, #1531, #3382, #3933 etc), it's just a way to keep track of past actions and xref those with artifacts and action results (more akin to #3542). For now, the motivation is to have sufficient metadata to prime the new agent/instance and provide it with enough context to make heads and tails of the original workspace.
Using a JSON based set of "workspace history" files, I've been able to get restarted agents to properly use scripts generated during previous sessions by other agents, which is rather promising and more than I was hoping for. But obviously, that requires a ton of context.
so, just a stub for now - just to keep people in the loop and get some more feedback/ideas and hopefully help.
also, please don't bother about the python code - it's more important to me to have something functional rather than something beautiful or elegant. So, ideas and suggestions are welcome - but styling is going to be subject to whoever is gonna review/integrate or even just use this. :-)
The basic idea is workable (seeing massive reuse of artifacts here when interrupting/resuming an agent), but can obviously be extended to make it much more useful (at the cost of adding a ton of meta data). This is proof of concept, mainly to gather feedback/ideas and help. If anybody has a better scheme in mind, please speak up ! For now this is only supposed to be better than the status quo, which is a ... pity.
Background
as mentioned in another comment here, what's key to make this work at this point without a major re-arch, is encoding statefulness of different actions/commands. The best results I have locally seen is when I am using the result of an action and hashing that for the origin of the action (command + params): basically a recursive chain of cause / effect
Changes
Documentation
Test Plan
PR Quality Checklist