Skip to content

openadapt quickstart exits 1 with default encryption at rest: run summary written in plaintext into the sealed run #2682

Done

Description

@abrichr

What happens

On a fresh machine, openadapt quickstart exits 1 with encryption at rest on, which has been the default since #2423 (Flow 4.0.0). The first run reaches "Saved and checked", the break-the-save act completes, and then sealing the runs fails:

  File "openadapt/quickstart/engine.py", line 884, in seal_runs
    seal = seal_run(run.run_dir, home=seal_home(), enqueue=False)
  File "openadapt_flow/offline_seal.py", line 415, in seal_run
    raw = sealed_set.read_bytes(report_path)
  File "openadapt_flow/sealed_set.py", line 1407, in open_set
    return SealedSet.open(base, passphrase)
  File "openadapt_flow/sealed_set.py", line 835, in open
    files = _reconcile_run_files(base, files, present)
  File "openadapt_flow/sealed_set.py", line 921, in _reconcile_run_files
    raise SealedSetError(
openadapt_flow.sealed_set.SealedSetError: .../openadapt-quickstart/run-1 holds run-summary.json in plaintext, outside its sealed index

The above exception was the direct cause of the following exception:
  ...
openadapt_flow.offline_seal.LocalSealError: report_unreadable: .../openadapt-quickstart/run-1/report.json

With OPENADAPT_ENCRYPT_AT_REST=0 the same command exits 0.

Affected versions

Reproduce

Run with an empty HOME, so there is no key and no seal home yet:

python3.12 -m venv /tmp/qs && /tmp/qs/bin/pip install "openadapt==1.24.0" "openadapt-flow==4.0.0"
mkdir -p /tmp/qs-home /tmp/qs-work && cd /tmp/qs-work
env -i PATH=/tmp/qs/bin:/usr/bin:/bin HOME=/tmp/qs-home \
  OPENADAPT_FLOW_KEY_STORE=file OPENADAPT_FLOW_BROWSER=bundled \
  /tmp/qs/bin/openadapt quickstart; echo "exit=$?"   # exit=1

On my repro, OPENADAPT_FLOW_KEY_STORE=file kept the key out of the OS keychain and OPENADAPT_FLOW_BROWSER=bundled used Playwright's headless shell. Neither setting is needed to trigger the bug.

Cause

The tutorial path (openadapt_flow.tutorial.run_tutorial and the launcher's openadapt/quickstart/engine.py) calls openadapt_flow.receipt.write_receipt after the run finished. write_receipt writes run-summary.json, run-summary.md and run-summary.png with plain Path.write_bytes/write_text/Image.save, straight into the encrypted run folder. The run's sealed set does not know those names: before Flow 3.5 the summary was receipt.json/.md/.png, and the run inventory still lists only those names as allow-listed plaintext. So the next read of the run (here seal_run) refuses the folder, as it should for any plaintext file outside the index.

The OpenEMR quickstart (--app openemr) has the same problem in its halted run. It writes screen.png (driver Session.screenshot) and quickstart-readback.json, which names a synthetic patient, directly into run-broken.

Why CI missed it

The launcher's quickstart tests use a fake engine, and tests/conftest.py sets OPENADAPT_FLOW_PLAINTEXT_AT_REST. The one real encrypted quickstart test (test_real_quickstart) is opt-in (OPENADAPT_REAL_QUICKSTART=1) and no workflow sets that. The Flow suite's encrypted lane (OPENADAPT_TEST_DEFAULT_AT_REST=1) has no test that drives the quickstart or seals a run after the summary is written. The weekly quickstart-lifecycle job installs Flow from PyPI.

Fix direction

Write the summary through the run's sealed set, so the folder's index names it, and add the three run-summary.* names to the run inventory as allow-listed plaintext, next to their old receipt.* names. Write the OpenEMR files through the set too. Keep seal_run and the reconcile step as they are: any other plaintext file must still make the run refuse. Add an encrypted, empty-HOME quickstart test that runs in the Flow encrypted CI lane and checks that every file in each sealed folder is in that folder's index.

Activity

  1. abrichr commented on Nov 25, 2026

    @abrichr
    MemberAuthor

    Traceback from the released packages (openadapt 1.24.0, openadapt-flow 4.0.0 from PyPI, clean venv, empty HOME), paths shortened:

    Traceback (most recent call last):
      File ".../openadapt_flow/offline_seal.py", line 415, in seal_run
        raw = sealed_set.read_bytes(report_path)
      File ".../openadapt_flow/sealed_set.py", line 1481, in read_bytes
        return _reader(root).read_bytes(rel)
      File ".../openadapt_flow/sealed_set.py", line 1459, in _reader
        return open_set(root)
      File ".../openadapt_flow/sealed_set.py", line 1407, in open_set
        return SealedSet.open(base, passphrase)
      File ".../openadapt_flow/sealed_set.py", line 835, in open
        files = _reconcile_run_files(base, files, present)
      File ".../openadapt_flow/sealed_set.py", line 921, in _reconcile_run_files
        raise SealedSetError(
    openadapt_flow.sealed_set.SealedSetError: .../openadapt-quickstart/run-1 holds run-summary.json in plaintext, outside its sealed index
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File ".../openadapt", line 12, in <module>
        sys.exit(main())
      File ".../click/core.py", line 1653, in __call__
        return self.main(*args, **kwargs)
      File ".../click/core.py", line 1560, in main
        rv = self.invoke(ctx)
      File ".../openadapt/cli.py", line 76, in invoke
        return super().invoke(ctx)
      File ".../click/core.py", line 2054, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File ".../click/core.py", line 1414, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File ".../click/core.py", line 911, in invoke
        return callback(*args, **kwargs)
      File ".../click/decorators.py", line 34, in new_func
        return f(get_current_context(), *args, **kwargs)
      File ".../openadapt/cli.py", line 953, in quickstart
        outcome = run_quickstart(
      File ".../openadapt/quickstart/__init__.py", line 110, in run_quickstart
        return run_story(
      File ".../openadapt/quickstart/story.py", line 342, in run_story
        outcome.seal = sealing.result()
      File ".../python3.12/concurrent/futures/_base.py", line 449, in result
        return self.__get_result()
      File ".../python3.12/concurrent/futures/_base.py", line 401, in __get_result
        raise self._exception
      File ".../python3.12/concurrent/futures/thread.py", line 59, in run
        result = self.fn(*self.args, **self.kwargs)
      File ".../openadapt/quickstart/story.py", line 316, in <lambda>
        sealing = _in_background(lambda: engine.seal(list(outcome.runs)))
      File ".../openadapt/quickstart/engine.py", line 762, in seal
        return seal_runs(runs)
      File ".../openadapt/quickstart/engine.py", line 884, in seal_runs
        seal = seal_run(run.run_dir, home=seal_home(), enqueue=False)
      File ".../openadapt_flow/offline_seal.py", line 418, in seal_run
        raise LocalSealError("report_unreadable", str(report_path)) from exc
    openadapt_flow.offline_seal.LocalSealError: report_unreadable: .../openadapt-quickstart/run-1/report.json
    
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions