Repository navigation
Description
Describe the bug
WorkspaceMessageBus.logAppend returns a normal entry-id cursor when Filesystem.write reports WriteResult.fail(...) or WriteResult.alreadyExists(...). If the write did not persist anything, reading the log returns no event despite that successful acknowledgement.
This also reaches MessageBus.sessionPublishEvent: its default implementation appends to the replay log and then publishes the live event with _entry_id. A failed replay write currently does not prevent live fan-out.
To Reproduce
Use the normal temporary-directory LocalFilesystem with a fault-injecting write override. No model, remote service, or credentials are required:
Filesystem fs = new LocalFilesystem(tempDir, true, 10) {
@Override
public WriteResult write(RuntimeContext rc, String path, String content) {
if (path.contains("/logs/") && path.endsWith(".json")) {
return WriteResult.fail("permission denied");
}
return super.write(rc, path, content);
}
};
WorkspaceMessageBus bus = new WorkspaceMessageBus(fs, "/bus");
StepVerifier.create(bus.logAppend("failed", Map.of("value", "lost"), 0))
.expectError(IllegalStateException.class)
.verify(); // fails on current main: receives onNext(cursor)
assertTrue(bus.logRead("failed", null, 10).block().isEmpty());The accompanying JUnit regression class runs the same case with/without a cap and with a create-if-absent conflict. It also covers the session-event path, a later successful write, and an uncertain acknowledgement after bytes have already been persisted.
Expected behavior
A reported backend write failure should propagate as a reactive error before returning a cursor, capping the log, or publishing the live session event. Keep the backend diagnostic.
An error is not proof that no bytes were persisted: a backend may commit and then lose the acknowledgement. Do not automatically retry the append or delete the uncertain entry.
Error messages / evidence
On unmodified main production code, the final regression class runs 8 cases: 7 assertion failures, 0 errors, and the successful-write control passes. Failure example: expectErrorSatisfies expected onError() but received onNext(<entry id>).
Environment
- AgentScope-Java:
2.1.0-SNAPSHOT, mainc8875287f808deb3cd0b3c2d85d671f1860fbbec - Java: Temurin 17.0.15
- OS: Windows
- Maven: 3.9.12
- Storage: temporary local filesystem with deterministic
WriteResultfault injection
Additional context / root cause
agentscope-harness/src/main/java/io/agentscope/harness/agent/bus/WorkspaceMessageBus.java, logAppend: fs.write(RC, path, json) discards its result and proceeds to capping/returning the entry id. In contrast, queuePush already checks WriteResult.isSuccess() and signals an error.
I checked open/closed issues and PRs using logAppend, WorkspaceMessageBus + write, replay log + fail, and sessionPublishEvent. The merged queue-drain/claim work concerns Mode A, while this is the Mode C append acknowledgement path. I did not find a matching fix or an existing implementation claim.
I am implementing the minimal result check with these regressions and paired EN/ZH documentation, and will submit the linked PR in this round. Please assign this issue to @pengmoubuaixuexi if assignment is required; I am taking responsibility for the implementation.
AI assistance: investigated and implemented with Codex; the diff and runnable regression evidence were reviewed by the coding agent. This is not a claim of an independent human review or a production incident.
Activity
fix(harness): propagate replay log write failures (agentscope-ai#4139)