Skip to content

fix(workspace): treat write-probe cleanup as best effort - #2455

Closed
Mahdi-Hasan wants to merge 1 commit into
HKUDS:devfrom
Mahdi-Hasan:fix/2453-probe-cleanup-guard
Closed

Mahdi-Hasan wants to merge 1 commit into
HKUDS:devfrom
Mahdi-Hasan:fix/2453-probe-cleanup-guard

Conversation

@Mahdi-Hasan

@Mahdi-Hasan Mahdi-Hasan commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

ContentWorkspaceService._ensure_ready runs on every turn. It touches outputs/.deeptutor-write-probe-<uuid>, then calls probe.unlink(). Only OSError was handled. Any other exception from unlink escaped the request.

The report in #2453 shows this: a delete guard in the reporter's environment refused the probe delete with SAFE_DELETE_BULK_CONFIRM_REQUIRED and the exception escaped the ASGI stack.

Changes:

  • The writability check is the touch. Removing the probe is cleanup, so it is now best effort: failures are logged as a warning and the turn continues.
  • The touch failure path is unchanged, so an unwritable folder still raises WorkspaceError.
  • unlink(missing_ok=True) replaces unlink().

Behavior change: a probe that cannot be removed no longer reports the folder as "not writable". It could not have been created otherwise.

I cannot confirm the "process dies" part of the report. This PR fixes the part that is visible in DeepTutor's own code.

Related Issues

Module(s) Affected

  • Other: services/workspace
  • tests

Checklist

  • This PR targets dev (not main).
  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run the pre-commit hooks. All pass except deeptutor-repo-hygiene, which calls python3 and fails only on Windows. python scripts/check_repo_hygiene.py passes.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary). Not needed: no user docs cover this path.
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

  • New test: test_a_failing_probe_cleanup_does_not_fail_the_workspace in tests/api/test_workspace_router.py. It fails on dev and passes here.
  • tests/api/test_workspace_router.py: 9 passed.
  • 7 tests/services/workspace/test_data_migration.py tests fail on Windows with and without this change.

The per-turn workspace readiness check touches a probe file, then
unlinks it. Only OSError was handled, so any other exception from
`unlink` (for example one raised by a delete guard that refuses a bulk
delete) escaped the request and left the turn without a response.

The touch already proves the outputs folder is writable. Removing the
probe is cleanup, so log a warning and carry on if it fails.

Fixes HKUDS#2453

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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