Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Restores original task instructions after native compaction and updates related documentation and tests.
Changes:
- Detects preserved input content across providers.
- Expands compaction and checkpoint regression coverage.
- Updates native compaction documentation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Summary |
|---|---|
packages/agents/tests/test_checkpoint_generator.py |
Tests reminder restoration after checkpoint resume. |
packages/agents/tests/test_agent.py |
Covers native continuation and reconstructed inputs. |
packages/agents/src/metr_agents/agents.py |
Adds content-based preservation detection. |
packages/agents/README.md |
Documents enabled native compaction behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+384
to
+397
| user_messages = [message for message in messages if message.role == "user"] | ||
| user_text = "\n".join(message.text for message in user_messages) | ||
| user_content = [ | ||
| content | ||
| for message in user_messages | ||
| if not isinstance(message.content, str) | ||
| for content in message.content | ||
| ] | ||
| return all( | ||
| content.text in user_text | ||
| if isinstance(content, inspect_ai.model.ContentText) | ||
| else content in user_content | ||
| for content in input_content | ||
| ) |
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.
Anthropic native compaction returns a generic user message,
Please continue working., after its summary. The generator previously treated any user text as evidence that the original task survived, so that continuation suppressed restoration of the task instructions.Check for the actual original input content instead. This restores missing instructions after Anthropic compaction while recognizing OpenAI's preserved inputs even when compaction assigns new IDs and
source="generate". The checkpointed original-input mechanism remains unchanged. Also replace the stale README warning that native compaction is disabled.Validation:
2203ee7a8, including Anthropic's continuation shape, repeated compactions without duplicate reminders, checkpoint restoration, and reconstructed OpenAI inputs.f98d522implementation.git diff --checkpass. Changed agent source has no type diagnostics with the repository-pinned Inspect; the changed-file type check reports 0 errors and 38 existing dependency typing warnings in tests.