Workflow wait review fixes: worker evidence¶
Task: fc2b2863-47eb-483c-b010-97af14388b71, frozen version 2, read through MCP.
Execution: 1253325f-fee8-4fc4-b99b-b9853191dcac.
Repository: h8v6/heyaira; origin: [email protected]:h8v6/heyaira.git.
Branch: heyaira/fc2b2863.
Source and starting candidate: 76b30c22be2aa5caa5cb29d5c8ce8c09cb0e05e5.
Starting parent: 587d6733f1f1ecb39994853184df5daeb6cae655.
The initial tree was clean. This result adds a new local commit above the
candidate; no amend, rebase or reset. The resulting SHA is in the RESULT/receipt
(this evidence file is part of that commit).
Working directory for the commands below:
/Users/jablonskib/HeyAira-agents/.heyaira-worktrees/heyaira/fc2b2863-worker.
Baseline commands ran on the candidate with new regression tests but unchanged
runtime files. Passing commands ran on the intended precommit working tree above
that candidate; the committed code is the same tested code.
Cause, correction and confidence¶
The workflow presence join used the identity's enrollment project to find its
Mac, but did not require the foreign project's active delegation. It now checks
the active node-project binding in the same repeatable-read snapshot and excludes
the node from the join when unauthorized. That projection reports unknown and
null heartbeat/wake timestamps. Same-enrollment-project behavior is preserved.
The real PostgreSQL regression failed before this fix (online != unknown) and
passes after it for both online and asleep initial states, through both MCP tools,
including a fresh heartbeat after revocation.
The event cursor was applied to a replacement workflow. The optional positive
revision now pins it; a mismatch resets the history cursor inside the same
snapshot. Wait also detects ID/revision changes between reads. Its response
includes top-level workflow_id, revision and replaced; replacements return
changed=true, replaced=true and the new history from sequence 1.
The pinned SDK's stateless JSON POST handling waits on an internal response
stream without monitoring disconnects during tool execution. The authorized
fallback is four waits per server-derived principal and 64 per process, with
immediate wait_capacity_exceeded rejection and cleanup on every exit, including
cancellation. Tests rotate synthetic token IDs within one principal, check both
limits, admit another principal, and prove cancellation releases capacity.
docs/BRIDGE_PROTOCOL.md explains the choice and its limitation: a disconnected
JSON client is bounded, not detected.
One asyncio.timeout now covers acquisition, reads and sleep. Expiry returns the
last fully read snapshot, or wait_timeout if none was read, without a final
unbounded read. Regressions cover a held single-slot pool, a real PostgreSQL
pg_sleep(3) while a connection is acquired, and a later delayed read after a
known snapshot. The contract manifest was regenerated for the two affected tools.
Confidence is high for these locally tested behaviors. PostgreSQL and registered MCP handlers are real; catalog Git content and authentication contexts are synthetic. There was no listening transport test; the capacity alternative is the frozen K3 option. Bridge independent verification and remote CI are pending. No follow-up changes outside this task were included.
Test output¶
Initial named baseline, exit 2:
python -m pytest tests/test_workflow_wait.py -q
ModuleNotFoundError: No module named 'heyaira'
1 error in 1.58s
Source-path rerun without the database variable, exit 0, not acceptance:
PYTHONPATH=src python -m pytest tests/test_workflow_wait.py -q
24 skipped in 1.70s
Reason: set HEYAIRA_EXECUTION_E2E_DATABASE_URL to an isolated PostgreSQL database
The prepared HEYAIRA_TEST_ADMIN_DATABASE_URL was available. The repository's
runner creates and drops only its own random disposable test databases over the
prepared local socket; no DSN or credentials are retained here. Baseline, exit 0:
PYTHONPATH=src python scripts/test_postgres.py tests/test_workflow_wait.py -q -p no:cacheprovider
........................ [100%]
postgres_acceptance=passed: selected tests, zero skipped tests
Before fixing runtime, exit 1:
PYTHONPATH=src python scripts/test_postgres.py tests/test_workflow_wait.py -k 'foreign_bridge_presence_hidden or cancel_and_redispatch or capacity_limits or deadline_includes' -p no:cacheprovider --tb=short -s
FAILED test_foreign_bridge_presence_hidden_after_binding_revocation_postgres[False]
FAILED test_foreign_bridge_presence_hidden_after_binding_revocation_postgres[True]
AssertionError: assert 'online' == 'unknown'
FAILED test_workflow_wait_capacity_limits_and_cancellation_release[principal]
FAILED test_workflow_wait_capacity_limits_and_cancellation_release[global]
Expected regex: 'wait_capacity_exceeded'; Actual message: ''
FAILED test_workflow_wait_deadline_includes_database_delay[acquire]
FAILED test_workflow_wait_deadline_includes_database_delay[read]
Expected regex: 'wait_timeout'; Actual message: ''
7 failed, 24 deselected in 12.85s
That combined run's seventh failure was redispatch fixture setup
(project_admin_required), not a demonstrated runtime defect. Initial test
authoring also exposed use of dataclass replacement on the SDK's Pydantic token,
and subsequent redispatch setup runs exposed repository_locked and
account_not_allowed. Those synthetic fixture errors were corrected without
changing runtime. The completed real cancel/send regression then failed for the
intended reason on unchanged runtime, exit 1:
PYTHONPATH=src python scripts/test_postgres.py tests/test_workflow_wait.py -k cancel_and_redispatch -p no:cacheprovider --tb=short -s
FAILED test_workflow_wait_cancel_and_redispatch_resets_revision_cursor
assert (746753.807982291 - 746748.803731291) < 1
1 failed, 30 deselected in 7.20s
After runtime fixes, the same seven selected cases passed, exit 0:
PYTHONPATH=src python scripts/test_postgres.py tests/test_workflow_wait.py -k 'foreign_bridge_presence_hidden or cancel_and_redispatch or capacity_limits or deadline_includes' -p no:cacheprovider --tb=short -s
workflow_wait acquire deadline elapsed=1.002s
workflow_wait read deadline elapsed=1.001s
7 passed, 24 deselected in 5.82s
postgres_acceptance=passed: selected tests, zero skipped tests
After adding ongoing-replacement/last-state cases and strengthening the delayed
read with real pg_sleep, final database and view checks, exit 0:
PYTHONPATH=src python scripts/test_postgres.py tests/test_workflow_wait.py tests/test_workflow_view.py -p no:cacheprovider --tb=short -s
workflow_wait timeout elapsed=5.003s
workflow_wait event elapsed=2.102s
workflow_wait acquire deadline elapsed=1.002s
workflow_wait read deadline elapsed=1.012s
62 passed in 45.98s
postgres_acceptance=passed: selected tests, zero skipped tests
The exact K5 command was also invoked by a Python subprocess with PYTHONPATH=src
and HEYAIRA_EXECUTION_E2E_DATABASE_URL pointing to one fresh disposable database
on that same prepared test server. The harness uses the existing runner's URL
validation and database URL helpers, and drops that database in finally.
Exit 0, no skips:
python -m pytest tests/test_workflow_wait.py -q
................................... [100%]
35 passed in 32.28s
Additional checks, each exit 0:
PYTHONPATH=src python -m pytest tests/test_mcp_runtime_contract.py tests/test_docs_contract.py -q -p no:cacheprovider --tb=short
26 passed in 6.18s
PYTHONPATH=src python scripts/check_docs_contract.py
documentation contract passed: 47 MCP tools covered
PYTHONPATH=src python scripts/export_mcp_contract.py --check
MCP contract is up to date
git diff --check
Git commands use the installed Xcode Git directly, avoiding /usr/bin/git's
denied xcrun cache writes. Precommit git diff <source> --stat and the staged
paths were checked. The commit must contain only these seven paths; postcommit
HEAD/parent, full path diff, ancestry and clean-tree output are saved in RESULT:
contracts/mcp-tools.json
docs/BRIDGE_PROTOCOL.md
docs/reports/2026-10-11-fc2b2863-workflow-wait-fixes.md
src/heyaira/server.py
src/heyaira/workflow.py
tests/test_workflow_view.py
tests/test_workflow_wait.py
Frozen criterion checklist and worker results¶
Methods are copied unchanged from task v2. These are worker results, not an independent acceptance verdict.
K1 method: Run the new P1 regression in tests/test_workflow_wait.py with pytest -> passed; RESULT states it failed before the fix. K2 method: Targeted pytest -> passed. K3 method: Targeted pytest -> passed; read the docs paragraph. K4 method: Targeted pytest -> passed. K5 method: python -m pytest tests/test_workflow_wait.py -q -> passed K6 method: git diff --name-only 76b30c22be2aa5caa5cb29d5c8ce8c09cb0e05e5..HEAD and git merge-base --is-ancestor 76b30c22be2aa5caa5cb29d5c8ce8c09cb0e05e5 HEAD -> only allowed paths, ancestor true.
criterion_id: K1
outcome: pass
evidence_path: docs/reports/2026-10-11-fc2b2863-workflow-wait-fixes.md
feedback: Real PostgreSQL regression failed before the fix (online != unknown); focused run exit 0 and final 35-test file exit 0 verify get/wait hide all presence timestamps after binding revocation and a fresh heartbeat.
criterion_id: K2
outcome: pass
evidence_path: docs/reports/2026-10-11-fc2b2863-workflow-wait-fixes.md
feedback: Real MCP cancel/send regression failed before the fix at 5.004 s; focused pytest exit 0 verifies immediate changed/replaced, revision 2, new ID and history sequences [1,2]. Ongoing unpinned replacement also passes.
criterion_id: K3
outcome: pass
evidence_path: docs/reports/2026-10-11-fc2b2863-workflow-wait-fixes.md
feedback: Focused pytest exit 0; four waits per principal and 64 globally reject excess with wait_capacity_exceeded and release slots on cancellation. BRIDGE_PROTOCOL documents the pinned stateless JSON transport limitation and chosen fallback.
criterion_id: K4
outcome: pass
evidence_path: docs/reports/2026-10-11-fc2b2863-workflow-wait-fixes.md
feedback: PostgreSQL pytest exit 0; timeout_seconds=1 completes in 1.002 s with held acquisition and 1.012 s with a delayed PostgreSQL read, both below 2 s. Last-known-state timeout also passes.
criterion_id: K5
outcome: pass
evidence_path: docs/reports/2026-10-11-fc2b2863-workflow-wait-fixes.md
feedback: Exact python -m pytest tests/test_workflow_wait.py -q, with isolated test DB and source path configured: exit 0, 35 passed in 32.28 s, no skips.
criterion_id: K6
outcome: pass
evidence_path: docs/reports/2026-10-11-fc2b2863-workflow-wait-fixes.md
feedback: New commit above candidate; only the seven allowed paths listed above. Postcommit full diff and merge-base --is-ancestor results are retained in RESULT/receipt.
No push, PR creation, merge, installation, deployment or production mutation was
performed. RESULT and receipt are appended through the execution's task_result;
Bridge owns independent verification and publication.