[BUG] Github repository documents not indexed
Bug Description
Even I connected a specific github repository in chat, and event it seems to be fully indexed without errors, agent says that no documents are available for analysis.
Deployment Type
- [X] SurfSense Cloud (hosted version)
- [ ] Self-hosted version
Expected Behavior
I expect that after indexing, the contents of the repository or repositories specified in the connector will be available for chat, or, alternatively, an error message that makes it clear that the reading was unsuccessful.
Actual Behavior
I open a workspace: I connect the remote repository to the chat using a PAT that has read rights for pages, issues, and pull requests (it’s a private repository); I start the indexing and wait for it to complete successfully. Now I query the agent, asking it to read specific files that I know have always been available; the agent responds that there is no content for the specific repository.
Checklist
- [X] I have searched existing issues to ensure this is not a duplicate
- [X] I have provided all the required information above
- [X] I have added appropriate labels (bug, deployment type)
I installed locally into my docker the environment (difficult: in surfsence_web app is missing Vite module, please check sources, as released it can't work...).
Looking to backend log and then into github_indexer.py source, it seems a bug:
backend-1 | future: <Task finished name='Task-56' coro=<_client_async_logging_helper() done, defined at /usr/local/lib/python3.12/site-packages/litellm/utils.py:879> exception=RuntimeError('Event loop is closed')> backend-1 | Traceback (most recent call last): backend-1 | raise RuntimeError('Event loop is closed') backend-1 | RuntimeError: Event loop is closed backend-1 | [2026-01-02 11:22:32,507: ERROR/ForkPoolWorker-32] Failed to process repository ####: 'dict' object has no attribute '_sa_instance_state' backend-1 | [2026-01-02 11:22:32,558: INFO/ForkPoolWorker-32] Completed task github_repos_indexing: Successfully completed GitHub indexing for connector 1 backend-1 | [2026-01-02 11:22:32,558: ERROR/ForkPoolWorker-32] GitHub indexing failed for connector 1: Failed processing ####: 'dict' object has no attribute '_sa_instance_state'
An effective fix can be:
- adding an helper function able to analyze chunk_data and fix content if necessary:
# GB020126 Start
from app.db import Chunk, Document, DocumentType, SearchSourceConnectorType
def to_chunk_models(chunks_data: list) -> list[Chunk]:
if not chunks_data:
return []
# Se sono già oggetti ORM li lascio come sono:
if hasattr(chunks_data[0], "_sa_instance_state"):
return chunks_data
# Sennò sono dict; da questi devo creare dei Chunk ORM
out: list[Chunk] = []
for c in chunks_data:
out.append(
Chunk(
content=c.get("content") or c.get("text"),
embedding=c.get("embedding"),
)
)
return out
# GB020126 End
- change a couple of rows in body code:
here **existing_document.chunks = to_chunk_models(chunks_data)** # GB020126 orig: ... = chunks_data
and here **chunks=to_chunk_models(chunks_data), ** orig: chunks=chunks_data, # Associate chunks directly
I think I can work on this can you assign it to me ? @MODSetter