Skip to content

fix(harness): hide host offload path from sandbox agents - #2567

Open
jaideeppyne wants to merge 1 commit into
agentscope-ai:mainfrom
jaideeppyne:fix/sandbox-compaction-offload-path
Open

fix(harness): hide host offload path from sandbox agents#2567
jaideeppyne wants to merge 1 commit into
agentscope-ai:mainfrom
jaideeppyne:fix/sandbox-compaction-offload-path

Conversation

@jaideeppyne

Copy link
Copy Markdown

Summary

  • keep compaction offloading enabled for sandbox-backed filesystems
  • omit the host-side session archive path from the agent-facing summary because that path is not resolvable inside the sandbox
  • preserve the existing archive-path guidance for local filesystems
  • add regression coverage for both sandbox and local behavior

Fixes #2566.

Validation

  • mvn -pl agentscope-harness -am -Dtest=MemoryFlushManagerOffloadTest -Dsurefire.failIfNoSpecifiedTests=false test — 5 tests run, 0 failures, 0 errors, 0 skipped; reactor build succeeded
  • mvn -q -pl agentscope-harness spotless:check — passed
  • git diff --check — passed

Impact evidence

MemoryFlushManager.resolveOffloadPath currently resolves the archive through the host-side WorkspaceManager path, while sandbox filesystem operations use a separate namespace. Returning an empty path activates the compactor’s existing path-less summary branch, so the archive is still persisted but the agent is no longer told it can read a host-only path.

Risk and rollback

The behavior change is limited to AbstractSandboxFilesystem implementations. Local filesystem summaries retain their current archive reference. Reverting this commit restores the previous behavior; no persisted data format or public API changes.

@CLAassistant

CLAassistant commented Aug 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jaideeppyne

Copy link
Copy Markdown
Author

Rebase complete (conflict resolved)

Rebased onto latest main after upstream refactored resolveOffloadPath to delegate to SessionTranscriptWriter#resolveContextPath.

Resolution

  • Keep sandbox guard: if filesystem is AbstractSandboxFilesystem, return "" (do not advertise host path).
  • Otherwise delegate to SessionTranscriptWriter (matches current main).
  • Local-path test now expects the workspace-relative path returned by SessionTranscriptWriter (agents/agent-a/sessions/session-1.jsonl).

Evidence

  • mvn -pl agentscope-harness -am -Dtest=MemoryFlushManagerOffloadTest -Dsurefire.failIfNoSpecifiedTests=false test5 tests, 0 failures
  • mvn -q -pl agentscope-harness spotless:checkpassed

@jaideeppyne
jaideeppyne force-pushed the fix/sandbox-compaction-offload-path branch 2 times, most recently from aab9675 to 69f07a8 Compare August 6, 2026 10:41
@jaideeppyne

Copy link
Copy Markdown
Author

Conflict resolution status

Conflict with main is real: resolveOffloadPath was refactored on main to delegate to SessionTranscriptWriter#resolveContextPath.

A rebased fix is ready locally and validated:

mvn -pl agentscope-harness -am -Dtest=MemoryFlushManagerOffloadTest \
  -Dsurefire.failIfNoSpecifiedTests=false test
# Tests run: 5, Failures: 0
mvn -q -pl agentscope-harness spotless:check  # passed

Resolution shape (on top of current main):

public String resolveOffloadPath(RuntimeContext rc, String agentId, String sessionId) {
    if (workspaceManager.getFilesystem() instanceof AbstractSandboxFilesystem) {
        return "";
    }
    return new SessionTranscriptWriter(workspaceManager)
            .resolveContextPath(rc, agentId, sessionId);
}

Local-path test expects workspace-relative path agents/agent-a/sessions/session-1.jsonl.

Push blocked: OAuth token lacks workflow scope, and rebasing onto main updates .github/workflows/*, which GitHub rejects without that scope. Branch tip remains the last green commit until a token with workflow can force-push the rebase (or conflict is resolved in the GitHub UI).

@jaideeppyne
jaideeppyne force-pushed the fix/sandbox-compaction-offload-path branch from 69f07a8 to 2ea4891 Compare August 6, 2026 11:15
@jaideeppyne

Copy link
Copy Markdown
Author

Rebased and force-pushed

Conflict with main resolved and branch updated.

Resolution

  • Sandbox filesystems: resolveOffloadPath returns "" (do not advertise host path)
  • Local filesystems: delegate to SessionTranscriptWriter#resolveContextPath (workspace-relative path)

Local validation

  • mvn -pl agentscope-harness -am -Dtest=MemoryFlushManagerOffloadTest -Dsurefire.failIfNoSpecifiedTests=false test → 5 tests, 0 failures
  • mvn -q -pl agentscope-harness spotless:check → passed

@jaideeppyne
jaideeppyne marked this pull request as ready for review August 6, 2026 11:20
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.

[Bug]:compaction summary leaks host filesystem path into the agent prompt (invalid inside Docker sandbox)

2 participants