Skip to content

Account instruction layers — worker evidence

Task: 30a02b80-cfd2-4216-8ae0-b78cd6118afc, frozen version 3. Execution: 3198e00c-64fd-4d03-95aa-a011c71200a4. Repository: h8v6/heyaira; branch: heyaira/30a02b80. Source and starting HEAD: 1e5f61028a970edf87098e9915e7a438a0e10bc4. Starting parent commits: e420fc7814140f6f929bcde00af0144a5f9becef, c793bed30ec115d3786cc8f4ecbbb753f997b1d9. The starting worktree was clean, with no carried candidate. All commands ran in /Users/jablonskib/HeyAira-agents/.heyaira-worktrees/heyaira/30a02b80-worker. Test runs used that starting HEAD plus the intended changes subsequently committed with this evidence; the final run contains the final code and tests. The RESULT/receipt records the resulting commit and post-commit scope check.

Change and confidence

The original dispatch assembled only project role documents, so account-wide core and mode instructions were absent outside the HeyAira project. Migration 057 adds separate account repository bindings and instruction allowlists, with same-account foreign keys, safe docs/agents/ paths, instruction-only roles and exclusive pinned/tracking references. Admin commands bind, register and revoke these sources; there are no new MCP write tools.

Both catalog dispatch APIs automatically freeze core and role-specific mode before existing instructions. Account branch heads are resolved once per branch per dispatch and never inferred from the task base commit. Layer metadata hashes raw content and estimates tokens as ceil(chars/4). Source bytes and assembled profile limits are enforced without truncating layers. Account provenance, binding configuration and revocation are revalidated at the transaction boundary. Compact workflow metadata is already preserved by the existing view, so no server view change was necessary.

Confidence: high for the frozen behavior, verified through production MCP handlers and real PostgreSQL. Authentication and Git responses are synthetic; these tests do not establish public GitHub connectivity or production rollout. The Bridge owns independent verification and publication. Full-suite CI and production configuration are subsequent stages, not worker results.

Actual runs

Initial named baseline:

python -m pytest tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py -q
exit: 2
ModuleNotFoundError: No module named 'heyaira'
2 errors in 1.58s

Equivalent baseline with this checkout's import path (before implementation):

PYTHONPATH=src python -m pytest tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py -q
exit: 0
28 passed in 15.59s

New regressions against the base implementation, before adding migration or code:

PYTHONPATH=src python -m pytest tests/test_account_instruction_sources.py -q
exit: 1
1 failed, 16 errors in 10.86s
test_no_account_sources_preserves_instructions: KeyError: 'layers_missing'
account_sources setup: asyncpg.exceptions.UndefinedTableError: relation "account_repositories" does not exist

First implementation run:

PYTHONPATH=src python -m pytest tests/test_account_instruction_sources.py tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py -q
exit: 0
45 passed in 22.04s

Expanded optional-layer, CLI and boundary checks before the final boundary fix:

PYTHONPATH=src python -m pytest tests/test_account_instruction_sources.py tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py tests/test_dispatch_project_binding.py tests/test_workflow_view.py -q
exit: 0
102 passed in 55.50s

Reachable assembled-size regression, reproduced before fixing the stable error:

PYTHONPATH=src python -m pytest tests/test_account_instruction_sources.py::test_account_layers_near_limit_return_stable_profile_error -q --tb=short
exit: 1
Expected regex: 'catalog_profile_too_large'
Actual message: 'Error executing tool workflow_send'
1 failed in 2.12s

Final behavioral run after fixing that boundary (no skips):

PYTHONPATH=src python -m pytest tests/test_account_instruction_sources.py tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py tests/test_dispatch_project_binding.py tests/test_workflow_view.py -q
exit: 0
........................................................................ [ 66%]
....................................                                     [100%]
108 passed in 42.14s

Supplemental existing checks:

PYTHONPATH=src python -m pytest tests/test_admin.py tests/test_documents.py tests/test_migration_runner.py tests/test_concurrent_migrations.py -q
exit: 0
21 passed, 6 skipped in 0.61s

Those six skips require HEYAIRA_EXECUTION_E2E_DATABASE_URL. A temporary database was created on the provided test PostgreSQL using HEYAIRA_TEST_ADMIN_DATABASE_URL; its isolated URL was passed only to the subprocess running the migration tests, then the database was dropped in finally. No URL or credential was printed or saved. The Python wrapper invoked the following exact argv:

python -m pytest tests/test_migration_runner.py tests/test_concurrent_migrations.py -q
exit: 0
.......                                                                  [100%]
7 passed in 1.71s
isolated migration checks exit=0

The wrapper initially could not start through a shell here-document (can't create temp file for here document: operation not permitted, exit 1, twice). The equivalent python -c wrapper above ran successfully without a permission exception, install or external mutation.

PYTHONPATH=src python scripts/export_mcp_contract.py --check
exit: 0
MCP contract is up to date

PYTHONPATH=src python scripts/check_docs_contract.py
exit: 0
documentation contract passed: 46 MCP tools covered

PYTHONPATH=src python -m compileall -q src/heyaira/catalog_workflow.py src/heyaira/admin.py tests/test_account_instruction_sources.py
exit: 0
output: none

git diff --check
exit: 0
output: none

Git reads use /Applications/Xcode.app/Contents/Developer/usr/bin/git directly because /usr/bin/git's xcrun wrapper attempted a denied cache write. Git's global-ignore read warning does not affect its successful exit codes.

Frozen criterion records

criterion_id: K1
method: Run the new targeted test file(s) for account instruction sources with pytest -> passed; read the assertions.
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Final behavioral command; exit 0; 108 passed with no skips. test_account_layers_dispatch_without_project_repository exercises workflow_send and workflow_dispatch_catalog, asserts no account repository bound to the task project, exact core/mode prefixes for both profiles, all three account source IDs and tracking:main provenance, one branch-head read, cached core content, validation and immutable replay.

criterion_id: K2
method: Targeted pytest test -> passed; existing tests/test_tracking_sources_compat.py and tests/test_tracking_document_sources.py still pass.
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Final behavioral command; exit 0; 108 passed. test_no_account_sources_preserves_instructions asserts the exact original worker/verifier instruction text and layers_missing=["core","mode"]. Both named compatibility files passed in baseline (28 passed) and final run.

criterion_id: K3
method: Targeted pytest test -> passed; inspect the migration CHECK.
outcome: pass
evidence_path: migrations/057_account_instruction_sources.sql
feedback: Final behavioral command; exit 0; 108 passed. test_account_path_check_and_cli asserts PostgreSQL CheckViolationError and CLI SystemExit before pool access for README.md, traversal, empty filename and empty path segments. Migration CHECK restricts safe docs/agents/ paths and document_role='instruction'; additional real database tests cover exclusive pins and same-account binding constraints.

criterion_id: K4
method: Targeted pytest test -> passed.
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Final behavioral command; exit 0; 108 passed. Manifest tests assert ordered core, mode, responsibilities, methodology, optional role instructions, soul and skill layers, raw-content SHA-256, Unicode character counts, ceil(chars/4), source identities and null responsibility provenance. Compact view retains the metadata.

criterion_id: K5
method: Targeted pytest test -> passed.
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Final behavioral command; exit 0; 108 passed. test_account_source_changed_after_dispatch[revoke] asserts catalog_source_changed_or_revoked after account-source revocation; additional mutations and revoke-during-read checks reject changed configuration without storing a workflow.

criterion_id: K6
method: git diff --stat <base>..HEAD and git diff --name-only <base>..HEAD -> only allowed paths.
outcome: pass
evidence_path: docs/agent-work/30a02b80-evidence.md
feedback: The staged patch and post-commit source..HEAD scope check contain only the seven intended files listed below. Post-commit command outputs and resulting SHA are attached to RESULT; no forbidden functions or paths were modified.

Intended committed files:

docs/GIT_DOCUMENT_ACCESS.md
docs/agent-work/30a02b80-evidence.md
docs/operations/document-sources.md
migrations/057_account_instruction_sources.sql
src/heyaira/admin.py
src/heyaira/catalog_workflow.py
tests/test_account_instruction_sources.py

No changes to docs/agents/**, Bridge, skill_get, runtime_bootstrap_get, or continuity_context. No pushes, PRs, merges, installs, deployments or production configuration changes. No unresolved blocker or extra feature work is included; next step is independent Bridge verification.

CI follow-up — carried candidate correction

Execution: a1239a84-21e2-47c4-a26b-54491f6ce212. Frozen task version: 3, reread through MCP before editing; identity matches the supplied project, instance and resource. Starting candidate/base: 3ac5376d99e472098bf0cfbc1cafcb08fc376ad0; original source: 1e5f61028a970edf87098e9915e7a438a0e10bc4. Same repository, branch and working directory as above; starting worktree clean. The earlier sections describe the original implementation attempt. This correction adds a new commit above the carried candidate, preserving it. The new RESULT/receipt records the final SHA and its parent.

Reported CI failure: https://github.com/h8v6/heyaira/actions/runs/38151373168. The CI log read was unavailable: gh run view 38151373168 --repo h8v6/heyaira --log-failed exited 1 because its configuration file is outside the allowed reads. A public GitHub API read was rejected by the tool's network allowlist. No credential reads, permission exceptions or alternative network bypasses were attempted. The failure addressed here was reproduced locally on the exact carried candidate; remote job logs were not obtained.

Cause and correction

Migration 057 adds two durable user-configuration tables, but the backup schema-classification test did not list them in MARKER_TABLES. Its exhaustive comparison therefore fails deterministically on the candidate. The production backup reader already includes every table except an explicit bookkeeping exclusion list; both new tables are included automatically.

The correction changes only tests/test_backup_state_marker.py and this evidence file. It classifies account_document_sources and account_repositories as durable data while retaining the exhaustive check. Two new real-PostgreSQL parameter cases prove that registration, configuration updates, revocation and deletion move the backup marker for each table. Existing per-user-table marker checks now exercise both new tables too. No runtime backup change, allowlist weakening or new migration is needed.

Confidence: high for the reproduced classification defect and its correction. Full CI parity cannot be established in this sandbox; the limitations below are separate from the passing frozen criteria.

Actual correction checks

All runs used the working directory listed above. The pre-fix run used clean HEAD 3ac5376; subsequent runs used that HEAD plus the test-only correction committed with this evidence.

Before the correction:

PYTHONPATH=src python scripts/test_postgres.py --ignore=tests/test_ios_companion_contract.py --deselect=tests/test_workflow_e2e.py::test_workflow_indexed_list_performance_synthetic_tasks --tb=short -x
exit: 1
test_every_table_is_classified:
AssertionError: ('unclassified tables', {'account_document_sources', 'account_repositories'}, 'missing tables', frozenset())
1 failed, 172 passed, 11 skipped, 3 deselected in 28.76s

The unchanged task files also passed through the CI database runner before the correction (the extra -q suppresses the numerical pytest summary):

PYTHONPATH=src python scripts/test_postgres.py tests/test_account_instruction_sources.py tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py -q --tb=short
exit: 0
postgres_acceptance=passed: selected tests, zero skipped tests

After the correction, the affected checks plus every frozen behavioral method:

PYTHONPATH=src python scripts/test_postgres.py tests/test_backup_state_marker.py::test_every_table_is_classified tests/test_backup_state_marker.py::test_a_change_to_any_user_table_moves_the_marker tests/test_backup_state_marker.py::test_account_instruction_configuration_changes_move_the_marker tests/test_account_instruction_sources.py tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py --tb=short
exit: 0
63 passed in 22.85s
postgres_acceptance=passed: selected tests, zero skipped tests

Other CI checks:

PATH="/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH" PYTHONPATH=src python scripts/check_product_name.py
exit: 0
Product name check passed: use HeyAira in tracked text files

PYTHONPATH=src python scripts/validate_runtime.py
exit: 0
runtime_validation=passed

PYTHONPATH=src python scripts/export_mcp_contract.py --check
exit: 0
MCP contract is up to date

PYTHONPATH=src python scripts/check_docs_contract.py
exit: 0
documentation contract passed: 46 MCP tools covered

node --test tests/site-consent.test.cjs tests/design-system-copy.test.cjs ops/cloudflare/server-beat-watchdog/test/*.mjs
exit: 0
# tests 57
# pass 57
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 932.610208

git diff --check
exit: 0
output: none

Supplemental limitations — not passing acceptance evidence

The whole backup-marker file plus the frozen behavior files was also run:

PYTHONPATH=src python scripts/test_postgres.py tests/test_backup_state_marker.py tests/test_account_instruction_sources.py tests/test_tracking_document_sources.py tests/test_tracking_sources_compat.py --tb=short
exit: 1
3 failed, 140 passed, 4 errors in 41.13s

The three failures are unchanged statistics-reset tests: the provided test role lacks permission for pg_stat_reset() and pg_stat_reset_shared('wal'). The four teardown errors report permission denied to terminate process during DROP DATABASE ... WITH (FORCE). The focused run above successfully tests classification and account marker movement without needing those capabilities.

A second full CI Python selection ran after the correction:

PYTHONPATH=src python scripts/test_postgres.py --ignore=tests/test_ios_companion_contract.py --deselect=tests/test_workflow_e2e.py::test_workflow_indexed_list_performance_synthetic_tasks --tb=short
result: interrupted by the execution tool; no completed exit code or totals
Network access to "server" was blocked: local/private network addresses are blocked by the sandbox policy.

It also encountered the above PostgreSQL limitations and existing synthetic deployment-fixture failures. One such failure was reproduced separately:

PYTHONPATH=src python -m pytest tests/test_deployment_guard.py -x -q --tb=short
exit: 1
test_failed_health_rolls_back_with_overlay_and_previous_revision:
expected 'health=failed'; actual ops/deploy-heyaira.sh: line 856: cannot create temp file for here document: Operation not permitted
1 failed, 4 passed in 1.80s

No completed full-suite totals are inferred from progress output. These existing checks and their permissions were not changed. No production deploy was attempted by the synthetic deployment tests.

Updated frozen criterion records

criterion_id: K1
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Frozen method unchanged: targeted pytest and assertion inspection. CI database runner selection exited 0, 63 passed, zero skipped; real PostgreSQL account sources, both dispatch APIs and role-specific core/mode prefixes pass.

criterion_id: K2
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Frozen method unchanged: targeted pytest plus both named compatibility files. Same 63-test run exited 0; original instructions and layers_missing remain asserted, and both tracking files pass.

criterion_id: K3
outcome: pass
evidence_path: migrations/057_account_instruction_sources.sql
feedback: Frozen method unchanged: targeted pytest and migration CHECK inspection. Same 63-test run exited 0; database/CLI path rejection remains green; migration unchanged from the accepted candidate.

criterion_id: K4
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Frozen method unchanged: targeted pytest. Same 63-test run exited 0; ordered layers, source provenance, SHA-256, Unicode chars and ceil(chars/4) remain green.

criterion_id: K5
outcome: pass
evidence_path: tests/test_account_instruction_sources.py
feedback: Frozen method unchanged: targeted pytest. Same 63-test run exited 0; account-source revocation after dispatch still raises catalog_source_changed_or_revoked.

criterion_id: K6
outcome: pass
evidence_path: docs/agent-work/30a02b80-evidence.md
feedback: Frozen method unchanged: source..HEAD --stat and --name-only, plus candidate..HEAD checks. Correction adds only this evidence and tests/test_backup_state_marker.py; total task diff has eight allowed files. Post-commit SHA/parent, diff output and clean worktree are recorded in the new RESULT.

Full CI parity limitation:

what: Remote CI logs unavailable; full local CI selection interrupted by blocked private network access, with existing PostgreSQL permission and shell temporary-file limitations.
who_moves: Bridge for publication/CI rerun; coordinator and environment operator for any dependency-complete local full-suite rerun.
needed: Publish the appended local correction through the authorized Bridge and rerun CI in its prepared runner; do not loosen this worker's sandbox.

No frozen criterion is blocked. No push, PR, merge, install, deploy or production configuration change was performed by the worker.