agentic-ai / enact

A framework for generative software.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Store with file backend raises RefError with gui.

MaxwellDeJong opened this issue · comments

Initializing a store with the file backend breaks the gui. For a simple repro, I modified the example notebook quickstart.ipynb so that a store is initialized using a file backend. Changing

"with enact.Store() as store:\n",
to read

with enact.Store(enact.FileBackend('./')) as store:

the example notebook behaves as expected until the gui is created and the invokable is run. Running the invokable through the gui produces

Traceback (most recent call last):
  File "/home/max/Documents/enact/.venv/lib/python3.8/site-packages/gradio/routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "/home/max/Documents/enact/.venv/lib/python3.8/site-packages/gradio/blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "/home/max/Documents/enact/.venv/lib/python3.8/site-packages/gradio/blocks.py", line 1077, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/max/Documents/enact/.venv/lib/python3.8/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/max/Documents/enact/.venv/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/home/max/Documents/enact/.venv/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/home/max/Documents/enact/examples/../src/enact/contexts.py", line 143, in <lambda>
    return lambda *args, **kwargs: _with_contexts(ctx, fun, *args, **kwargs)
  File "/home/max/Documents/enact/examples/../src/enact/contexts.py", line 134, in _with_contexts
    return fun(*args, **kwargs)
  File "/home/max/Documents/enact/examples/../src/enact/guis.py", line 131, in changed_ref_id
    value=f'```\n{pretty_print.pformat(resource)}\n```')
  File "/home/max/Documents/enact/examples/../src/enact/pretty_print.py", line 162, in pformat
    return PPrinter(
  File "/home/max/Documents/enact/examples/../src/enact/pretty_print.py", line 141, in pformat
    pvalue = self._merge(self.pvalue(v, ))
  File "/home/max/Documents/enact/examples/../src/enact/pretty_print.py", line 117, in pvalue
    return formatter(v, depth)
  File "/home/max/Documents/enact/examples/../src/enact/pretty_print.py", line 90, in from_resource
    contents=[
  File "/home/max/Documents/enact/examples/../src/enact/pretty_print.py", line 91, in <listcomp>
    PPValue(field_name, [self.pvalue(field_value, depth + 1)], open=":")
  File "/home/max/Documents/enact/examples/../src/enact/pretty_print.py", line 117, in pvalue
    return formatter(v, depth)
  File "/home/max/Documents/enact/examples/../src/enact/pretty_print.py", line 99, in from_ref
    resource: interfaces.ResourceBase = v.get()
  File "/home/max/Documents/enact/examples/../src/enact/references.py", line 106, in get
    self._cached = Store.current().get(self)
  File "/home/max/Documents/enact/examples/../src/enact/references.py", line 286, in get
    return ref.unpack(packed_resource)
  File "/home/max/Documents/enact/examples/../src/enact/references.py", line 153, in unpack
    cls.verify(packed_resource)
  File "/home/max/Documents/enact/examples/../src/enact/references.py", line 142, in verify
    raise RefError(
enact.references.RefError: Reference <Ref: fb29d44a7ad350aab64625c88ffcfb9008a8163ca97ae7cfaf02978d1da1d961> does not match packed data {'input': {'digest': '4c96e8bf41a32c190562024fe415879c263c6ae3f3eac6c5f1ef5dd8a06c92ab'}, 'invokable': {'digest': '3e4b9be8298d58d44dddaecbfa1897f4fad7c90d6491487f9cf9a3eba7018a75'}}.

This should be fixed once #29 is in