Skip to content

test: reproduce #4813 state ownership regressions and restore - #29

Draft
enyst wants to merge 1 commit into
review-target/pr4813-a4e7a74from
test/pr4813-state-ownership
Draft

test: reproduce #4813 state ownership regressions and restore#29
enyst wants to merge 1 commit into
review-target/pr4813-a4e7a74from
test/pr4813-state-ownership

Conversation

@enyst

@enyst enyst commented Sep 11, 2026

Copy link
Copy Markdown
Owner

HUMAN:


AGENT:

Why

This tests-only follow-up is for OpenHands/software-agent-sdk#4813, at a4e7a74c0fb8f989a2c58ca1717c176f0aa1aaff. Its base, enyst:review-target/pr4813-a4e7a74, is an exact mirror of that head. Engel requested executable regressions for the five review findings and conversation-restore coverage under tests/cross.

The state-ownership refactor fixes the original restart bug, but these tests reproduce five remaining regressions. The five failing tests are intentional ordinary assertions. They are not marked xfail or skipped. Please make them green by fixing the implementation in OpenHands#4813.

Summary

Adds tests/cross/test_conversation_state_ownership.py and shared fixtures in tests/cross/conftest.py. No production code changes.

Regression test Failure on OpenHands#4813
test_acp_stream_masks_secrets_added_after_start The real ACP bridge emits an added dummy secret through the token callback without masking it.
test_server_fork_preserves_request_secrets A request token is missing from the server-created fork. After this is fixed, the test also checks parent/fork independence and fork rehydration.
test_server_fork_preserves_guardrail_credentials The fork's persisted ToolShield API key reloads as None.
test_encrypted_start_decrypts_guardrail_credentials The analyzer still holds the encrypted key when the new conversation is ready.
test_local_fork_keeps_guardrail_history_independent A fork-only command appears in the parent's subsequent guardrail prompt.

The five passing restore cases cover:

  • Updated policy, analyzer, and rotated/added secrets surviving idle eviction and server restart (two cases), with a secret durability check before close, encrypted storage, event-history continuity, and further execution.
  • Removing an analyzer and relaxing confirmation surviving restart.
  • Older meta.json fields not overriding canonical state on restore.
  • Encrypted request secrets surviving restart.

Inference uses the SDK's TestLLM. Its scripted response queue is reattached after serialization before resumed execution. The ACP test replaces the subprocess handshake while running the real bridge setup, incoming session update, and streaming callback. The restore cases use real ConversationService / LocalConversation instances and temporary encrypted files; no live provider credentials are needed.

Issue Number

OpenHands#4810

How to Test

uv run pytest tests/cross/test_conversation_state_ownership.py -q

Verified against OpenHands#4813 at a4e7a74: 5 failed, 5 passed. Every failure reaches the assertion for its corresponding review finding.

uv run pytest tests/cross/test_conversation_restore_behavior.py tests/cross/test_conversation_state_ownership.py -q

Verified: 5 failed, 18 passed. All 13 existing restore tests and all five new restore cases pass.

uv run pre-commit run --files tests/cross/conftest.py tests/cross/test_conversation_state_ownership.py

Formatting, lint, type checking, import rules, and tool-registration checks pass.

Local validation used Python 3.13.15 and the existing SDK development environment, with LITELLM_LOCAL_MODEL_COST_MAP=True to use the bundled model metadata.

Video/Screenshots

Not applicable. Reproductions and expected assertion failures are listed above.

Design Doc

Not applicable; tests only.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

GitHub's connection returned 403: Resource not accessible by integration when creating this PR directly against BSmick6/software-agent-sdk:claude/github-issue-4810-51c120. This draft uses the exact mirrored base in the enyst fork instead; merging it here will not update the original PR.

To apply the tests to the original PR branch:

git fetch https://github.com/enyst/agent-sdk.git test/pr4813-state-ownership
git cherry-pick 89a32c424aaf14638703caaebc857c05fb4f5b69

Created by Codex for Engel's review. The branch starts directly at OpenHands#4813's reviewed head so it adds only these tests. The enyst fork's main was independently fast-forwarded to upstream 50080b58d35b4824fda25fca2345d80bcd08aeff.

Co-authored-by: openhands <openhands@all-hands.dev>
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant