Skip to content

bug(chat): conversation file routes call manager methods that do not exist #20225

Closed
8 of 9 issues completed

Description

@mrveiss

Problem

autobot-backend/api/conversation_files.py calls file_manager.upload_file, get_file_info, delete_file and transfer_files. ConversationFileManager (autobot-backend/conversation_file_manager.py:104) defines none of them, has no base class, and no __getattr__; it has add_file, get_session_files, delete_session_files and others. add_file's response also lacks filename, size and uploaded_by, which ConversationFileInfo requires.

Every test mocks the manager, so none exercises this wiring. By reading the code, these routes raise at runtime, for admins too, so chat file upload may never have worked.

Not known

Not run against a live backend; the local install's last update did not finish.

Also

The dedup path logs access with type reference, which the file_access_log CHECK constraint rejects, so the log write fails with a warning on every dedup.

Acceptance criteria

  • Each route calls a method the manager really has, with the response matching its schema.
  • A test exercises the upload route against the real ConversationFileManager on real SQLite, with no mock of the manager.
  • The same is checked for list, download, preview, delete and transfer, or each gap is recorded.
  • A dedup access log write succeeds.
  • Host: an upload succeeds on the local install, after a finished update.

Activity

  1. mrveiss commented on Oct 31, 2026

    @mrveiss
    OwnerAuthor

    Wired on the #20213 branch (not pushed yet). Gaps left, each with file:line on that branch:

    • autobot-backend/conversation_file_route_api.py:27: the list/info extension SQL returns the whole filename for a name with no dot (it is the SUBSTR after INSTR, which is 0 when there is no dot). The upload response (line 47) returns null for that case, so the two disagree. Pre-existing SQL, moved into one shared constant.
    • conversation_file_route_api.py:38: the upload route does not pass the multipart content type to the manager, so the stored mime type is guessed from the filename.
    • conversation_file_transfer.py:49: a transfer to the knowledge base accepts only UTF-8 text files; binary files fail per file with a reason. PDF/Office extraction is wider than this PR.
    • conversation_file_route_api.py:111: a transfer 'move' soft-deletes the source (the row is kept, the file stays on disk for the cleanup queue); nothing is hard-deleted by the route.
    • The dedup access log now uses type upload with reference: true in its metadata, because the CHECK on file_access_log has no reference and changing it needs a schema migration, which an agent may not do.
  2. mrveiss commented on Oct 31, 2026

    @mrveiss
    OwnerAuthor

    To do after PR #20213 lands, from its review: _shared_target in autobot-backend/conversation_file_transfer.py checks exists() and then calls copyfile, which can race, so open the target with exclusive create. Add tests for an existing-target collision, an absolute path and a symlink on the shared target; today only .. is covered. Low severity, not blocking its landing.

  3. 3 remaining items

  4. mrveiss commented on Nov 2, 2026

    @mrveiss
    OwnerAuthor

    Checked against origin/main 87eae8a, by reading the code and tests; the tests were not rerun.

    AC Evidence
    Routes call real methods Met. ConversationFileManager(ConversationFileRouteApi) at conversation_file_manager.py:52; conversation_file_route_api.py defines upload_file, get_file_info, delete_file, transfer_files; list_files at conversation_file_manager.py:864.
    Upload tested on the real manager and real SQLite, no mock Met. api/conversation_files_real_manager_20225_test.py::test_upload_stores_the_file_on_disk_and_in_the_db_with_a_valid_response
    Same for list, download, preview, delete, transfer Met. Same file, one test each, including the transfer destinations.
    Dedup access log write succeeds Met. conversation_file_manager.py:685; test_a_duplicate_upload_in_the_same_session_dedups_and_its_access_log_is_written
    Host upload on the local install Not verifiable from code. Needs a finished builtin update, then an upload.

    Stays open for the host check.

  5. github-actions commented on Nov 13, 2026

    @github-actions
    Contributor

    Landed via the merge train (#21454, merge 87819661d3) via #21401

  6. mrveiss commented on Nov 13, 2026

    @mrveiss
    OwnerAuthor

    Landed with merge train #21454 (8781966), member PR #21401. Checked against origin/main at 8781966, by reading code; tests were not run here.

    PR #21401 touches the file panel and preview only, so it does not move any criterion here. Re-checked on main:

    Criterion Status Evidence
    Each route calls a method the manager really has, response matching its schema delivered by code (already ticked) autobot-backend/conversation_file_manager.py:56 ConversationFileManager(ConversationFileRouteApi); conversation_file_route_api.py defines upload_file (:40), get_file_info (:106), delete_file (:137), transfer_files (:160)
    Upload tested on the real manager and real SQLite, no mock delivered by code (already ticked) api/conversation_files_real_manager_20225_test.py
    Same for list, download, preview, delete, transfer, or each gap recorded delivered (already ticked) same file; gaps recorded as #21402, #21403, #21404
    A dedup access log write succeeds delivered by code (already ticked) covered by the dedup test in the same file; #21404 notes the dedup is recorded as an upload with a metadata flag rather than a reference type
    Host: an upload succeeds on the local install, after a finished update needs host evidence a merge is not host evidence

    Still open: the host criterion; open sub-issues #20487, #21402, #21403, #21404. The issue stays open.

  7. mrveiss commented on Nov 15, 2026

    @mrveiss
    OwnerAuthor

    Closure pass, checked against origin/main at c2b5a4fa95. I read the code and the install's logs. I ran no tests and made no requests that change data.

    Local install state (read-only observation, 2026-11-15): every component's deployed-commit marker reads c2b5a4fa95, which is current main. The builtin update that produced it finished: its play recap reports failed=0, and the backend service restarted after the sync. The fix (merge 87819661d3) is an ancestor of c2b5a4fa95.

    Criterion Ticked? Evidence
    Routes call real manager methods yes (unchanged) spot check: autobot-backend/conversation_file_manager.py:56 class ConversationFileManager(ConversationFileRouteApi); conversation_file_route_api.py upload_file :55, get_file_info :120, delete_file :151, transfer_files :174
    Real-manager upload test, list/download/preview/delete/transfer, dedup log yes (unchanged) autobot-backend/api/conversation_files_real_manager_20225_test.py is present on main
    Host: an upload succeeds on the local install, after a finished update no The update finished and the conversation_files router is registered at startup. However, the backend logs since the update show no upload request to /api/conversation-files/.../upload, only GET .../cleanup/status. The install's conversation-file storage directory holds 0 files. No upload has run, and making one needs an authenticated write, which a read-only check cannot do.

    Still needed: one chat file upload on the local install at c2b5a4fa95 or later, which should show a stored file and a 2xx upload line in the backend log. The open sub-issues stay as they are. The issue stays open.

  8. mrveiss commented on Nov 17, 2026

    @mrveiss
    OwnerAuthor

    State change from PR #21732 (merge df23644): the dedup access log now records a reference access type (#21404, closed) and the upload route forwards the declared content type through one mime rule (#21403, closed); both were gaps recorded from this issue. No criterion here changes: the host criterion still needs host evidence, and the issue stays open.

  9. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    Landed in #21732, merge df23644add

  10. mrveiss commented on Nov 17, 2026

    @mrveiss
    OwnerAuthor

    Host evidence — local install on main @ df23644 (2026-11-17 22:32 Riga)

    The running backend files match the deployed tree at df23644 (which includes #21730 and #21732). The backend was restarted after the deployment.

    AC Verdict Evidence
    Host: an upload succeeds on the local install, after a finished update. PASS (ticked) POST /api/conversation-files/conversation/<session>/upload with a 25-byte evidence.txt (text/plain) returned 200 with success: true, mime_type: text/plain, extension: txt, uploaded_by: admin. The conversation_files row was stored (file_size 25, quota_owner admin, is_deleted 0). A file_access_log row has access_type 'upload'. The backend logged Stored file: … (25 bytes) and Added file <id> to session <id>: evidence.txt (25 bytes), with no errors in the upload window.

    Scope: this upload was made through the API, not the browser UI. The chat-UI path is #20133's host AC, which is still open. The dedup access-log path was not exercised on the host (one upload only). Its AC above is covered by tests, and the CHECK constraint now allows reference on the host (see #21404).

    Not closing: left for the maintainer.

  11. mrveiss commented on Nov 20, 2026

    @mrveiss
    OwnerAuthor

    All 5 acceptance criteria are ticked. The code landed in #21730 and #21732 (merge df23644). The host criteria passed on the local install at df23644; see the host-evidence comment above (2026-11-17). check-issue-close-refs.sh 20225: Gate 2 clear.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions