fix(ci): guard scientific_paper_basic cleanup when OpenAI key missing

- Avoid deleting the workspace when OPENAI_API_KEY is unset
  by guarding cleanup and initializing CONTEXT_DIR
- Prevents downstream Robot suites from losing .nox venv and
  resource files after the basic scientific paper suite is skipped
This commit is contained in:
2026-02-13 04:15:14 +00:00
parent 51a6e76e9e
commit 6ffba3e2ba
2 changed files with 9 additions and 2 deletions
+7
View File
@@ -470,6 +470,13 @@ The following work from the previous implementation has been completed and will
- **CI debug output added** (`noxfile.py`): Comprehensive pre-robot debug block now prints: `sys.executable`, `shutil.which('python')`, full `PATH`, `os.path.exists/isfile/islink/stat` for both `.resource` files, first 100 bytes of each, fixture directory existence checks (`features/fixtures/v2/*`), and Robot Framework version. This will definitively diagnose any remaining resource import issues on the next CI run.
- **Verification**: `nox -s integration_tests` passes locally — 204 tests, 204 passed, 0 failed.
**2026-02-13**: Bugfix - CI `integration_tests` Failures Round 5 (guard cleanup when OpenAI key missing)
- **Observation**: After Round 4, CI still failed mid-suite with a cascade of `Resource file ... does not exist` and `FileNotFoundError` for the venv Python path. The failures started immediately after `Robot.Scientific Paper Basic` was skipped due to missing `OPENAI_API_KEY`.
- **Root cause** (`robot/scientific_paper_basic.robot`): Suite setup begins with `Require OpenAI Key`. When the key is missing, the keyword calls `Skip`, so the rest of setup does not execute. This leaves `${CONTEXT_DIR}` as `${EMPTY}` (it was initialized to empty in the Variables table). In suite teardown, `Remove Directory ${CONTEXT_DIR} recursive=True` runs with an empty string, which resolves to the current working directory. On CI, this can delete the repo root (including `.nox` venv and `robot/*.resource` files), causing downstream suites to fail and the venv Python path to disappear.
- **Fix** (`robot/scientific_paper_basic.robot`): Initialize `${CONTEXT_DIR}` to `${TEMPDIR}/paper_basic_contexts` in the Variables table, and guard cleanup with `Run Keyword If '${CONTEXT_DIR}' != '${EMPTY}'` before removing the directory. This prevents accidental deletion of the workspace when the suite is skipped.
- **Verification**: Not re-run on CI yet; local `nox -s integration_tests` should continue to pass (204/204) with `OPENAI_API_KEY` unset.
**2026-02-06**: CRITICAL ARCHITECTURAL DECISION - Tool-Based Resource Modification
- **REPLACED**: OutputParser/code fence parsing approach
- **WITH**: Tool-based change tracking (modern approach used by Claude Code, Cursor, Aider)
+2 -2
View File
@@ -9,7 +9,7 @@ Suite Teardown Cleanup Test Environment
*** Variables ***
${PYTHON} python
${CONFIG_FILE} ${CURDIR}/../examples/scientific_paper_writer.yaml
${CONTEXT_DIR} ${EMPTY}
${CONTEXT_DIR} ${TEMPDIR}/paper_basic_contexts
${CONTEXT_NAME} ${EMPTY}
${TEST_ID} ${EMPTY}
@@ -72,7 +72,7 @@ Setup Test Environment
Log Test environment setup complete with ID: ${TEST_ID}
Cleanup Test Environment
Run Keyword And Ignore Error Remove Directory ${CONTEXT_DIR} recursive=True
Run Keyword If '${CONTEXT_DIR}' != '${EMPTY}' Remove Directory ${CONTEXT_DIR} recursive=True
Log Test environment cleaned up
Should Contain Any