Shared-session concurrency harness defect: override_get_session yields one Session to every request — SQLAlchemy Sessions not thread-safe, breaks ~12 tests in test_integration_concurrent.py #105

Closed
opened 2026-08-20 02:42:23 +00:00 by Mark · 4 comments
Owner

Tracked by #122 (replaces #121, which was non-mergeable due to a stale base branch; #122 is rebased onto origin/main and now reports mergeable=true).

The fix swaps the shared-session override (one Session for every concurrent request) for a per-request session strategy backed by QueuePool + WAL SQLite. Each FastAPI request now gets an independent Session with its own DBAPI connection — the safe shape under concurrency.

14/14 concurrency tests pass; 47/47 test_api_cases tests pass; broader integration suite shows 13 fewer failures than pristine main (37 pre-existing failures remain, none introduced by this change).

Leaving this issue open per tasker-worker protocol — closing is the user's call once the PR is reviewed.

Tracked by https://forgejo.tail018ac4.ts.net/Mark/osint-hub/pulls/122 (replaces #121, which was non-mergeable due to a stale base branch; #122 is rebased onto origin/main and now reports mergeable=true). The fix swaps the shared-session override (one Session for every concurrent request) for a per-request session strategy backed by QueuePool + WAL SQLite. Each FastAPI request now gets an independent Session with its own DBAPI connection — the safe shape under concurrency. 14/14 concurrency tests pass; 47/47 test_api_cases tests pass; broader integration suite shows 13 fewer failures than pristine main (37 pre-existing failures remain, none introduced by this change). Leaving this issue open per tasker-worker protocol — closing is the user's call once the PR is reviewed.
Author
Owner

Launcher re-dispatch for this issue was blocked by the in-repo .gsd/gates/pre-dispatch.sh gate, not by anything in the issue itself.

Gate output

pre-dispatch BLOCKED: worktree has uncommitted changes outside .gsd/, .venv/, and .kilo/
  dirty paths:
    ?? .worktrees/

Cause — .worktrees/t_5df1a1a4/ is a leftover from a prior kilo-gsd run (likely the #109 dispatch). The in-repo gate whitelists only .gsd/, .venv/, .kilo/, so any .worktrees/ directory marks the worktree as dirty and the gate refuses every subsequent dispatch for the whole repo until the directory is cleaned up (or the gate is updated).

Suggested fix for janitor — either git worktree remove .worktrees/t_5df1a1a4 (if safe) or update .gsd/gates/pre-dispatch.sh to whitelist .worktrees/. After either, the next launcher pass should be able to dispatch this issue normally.

Issue status — still unclaimed; no live tmux session or kilo-gsd pid for #105. The blocked:preflight label is still on the issue but no in-progress claim is active. This comment does not consume the issue.

(Automated launcher report from kanban task t_4ed5aeda.)

Launcher re-dispatch for this issue was blocked by the in-repo `.gsd/gates/pre-dispatch.sh` gate, not by anything in the issue itself. **Gate output** ``` pre-dispatch BLOCKED: worktree has uncommitted changes outside .gsd/, .venv/, and .kilo/ dirty paths: ?? .worktrees/ ``` **Cause** — `.worktrees/t_5df1a1a4/` is a leftover from a prior kilo-gsd run (likely the #109 dispatch). The in-repo gate whitelists only `.gsd/`, `.venv/`, `.kilo/`, so any `.worktrees/` directory marks the worktree as dirty and the gate refuses every subsequent dispatch for the whole repo until the directory is cleaned up (or the gate is updated). **Suggested fix for janitor** — either `git worktree remove .worktrees/t_5df1a1a4` (if safe) or update `.gsd/gates/pre-dispatch.sh` to whitelist `.worktrees/`. After either, the next launcher pass should be able to dispatch this issue normally. **Issue status** — still unclaimed; no live tmux session or kilo-gsd pid for #105. The `blocked:preflight` label is still on the issue but no `in-progress` claim is active. This comment does not consume the issue. (Automated launcher report from kanban task t_4ed5aeda.)
Author
Owner

Re-dispatch blocked by the in-repo .gsd/gates/pre-dispatch.sh gate, not by anything in the issue itself.

Gate output

pre-dispatch BLOCKED: worktree has uncommitted changes outside .gsd/, .venv/, and .kilo/
  dirty paths:
    M backend/app/modules/base.py
    M backend/app/services/investigations/orchestrator.py
    M backend/app/services/investigations/orchestrator_enhanced.py
    M backend/app/services/investigations/retry_handler.py

Cause — different from the prior attempt. The .worktrees/ leftover from 2026-09-08 is gone. The worktree is dirty because Mark/osint-hub#101's kilo-gsd.py run is in mid-flight on the SAME checkout: live tmux kilo-gsd-osint-hub-101-bugfix, orchestrator pid 997726, salvage-state current_phase=Bugfix, _bugfix_gate=Verify, 2/3 Bugfix retries used. The bugfix agent is editing backend/app/modules/base.py + the orchestrator/retry_handler files trying to clear the 452-error Verify gate. The in-repo gate (md5=318649854b08...; whitelists only .gsd/, .venv/, .kilo/) sees those edits as dirty and refuses every dispatch until they are committed or stashed.

Suggested fixes for janitor

  • Let #101's bugfix loop land: its next phase will either commit/push the working tree changes or wrap up.
  • If #101 is genuinely stuck, SIGTERM the orchestrator (pid 997726) or send Ctrl-C to kilo-gsd-osint-hub-101-bugfix, then git -C /home/b/Projects/osint-hub checkout -- backend/app/modules/base.py backend/app/services/investigations/orchestrator.py backend/app/services/investigations/orchestrator_enhanced.py backend/app/services/investigations/retry_handler.py (or stash) to clean the worktree.
  • Optionally widen the in-repo gate whitelist to include .worktrees/ for future runs.

Issue status — still unclaimed; no live tmux session or kilo-gsd pid for #105. The blocked:preflight label is still on the issue but no in-progress claim is active. This comment does not consume the issue.

(Automated launcher report from kanban task t_4ed5aeda.)

Re-dispatch blocked by the in-repo `.gsd/gates/pre-dispatch.sh` gate, not by anything in the issue itself. **Gate output** ``` pre-dispatch BLOCKED: worktree has uncommitted changes outside .gsd/, .venv/, and .kilo/ dirty paths: M backend/app/modules/base.py M backend/app/services/investigations/orchestrator.py M backend/app/services/investigations/orchestrator_enhanced.py M backend/app/services/investigations/retry_handler.py ``` **Cause** — different from the prior attempt. The `.worktrees/` leftover from 2026-09-08 is gone. The worktree is dirty because Mark/osint-hub#101's kilo-gsd.py run is in mid-flight on the SAME checkout: live tmux `kilo-gsd-osint-hub-101-bugfix`, orchestrator pid 997726, salvage-state `current_phase=Bugfix`, `_bugfix_gate=Verify`, 2/3 Bugfix retries used. The bugfix agent is editing backend/app/modules/base.py + the orchestrator/retry_handler files trying to clear the 452-error Verify gate. The in-repo gate (md5=318649854b08...; whitelists only `.gsd/`, `.venv/`, `.kilo/`) sees those edits as dirty and refuses every dispatch until they are committed or stashed. **Suggested fixes for janitor** - Let #101's bugfix loop land: its next phase will either commit/push the working tree changes or wrap up. - If #101 is genuinely stuck, SIGTERM the orchestrator (pid 997726) or send Ctrl-C to `kilo-gsd-osint-hub-101-bugfix`, then `git -C /home/b/Projects/osint-hub checkout -- backend/app/modules/base.py backend/app/services/investigations/orchestrator.py backend/app/services/investigations/orchestrator_enhanced.py backend/app/services/investigations/retry_handler.py` (or stash) to clean the worktree. - Optionally widen the in-repo gate whitelist to include `.worktrees/` for future runs. **Issue status** — still unclaimed; no live tmux session or kilo-gsd pid for #105. The `blocked:preflight` label is still on the issue but no `in-progress` claim is active. This comment does not consume the issue. (Automated launcher report from kanban task t_4ed5aeda.)
Author
Owner

kilo-gsd pre-dispatch gate is BLOCKED at the canonical repo (/home/b/Projects/osint-hub). Worktree has uncommitted PostScript files os and sys (ImageMagick dumps, ~8KB each) at the repo root, outside the gate whitelist (.gsd/, .venv/, .kilo/). The launcher cannot remediate per contract (forbidden to run git clean / git reset on the runner path). Operator one-liner: cd /home/b/Projects/osint-hub && rm os sys and re-dispatch. No live tmux/pid for #105; no commit on origin/main referencing #105.

kilo-gsd pre-dispatch gate is BLOCKED at the canonical repo (/home/b/Projects/osint-hub). Worktree has uncommitted PostScript files `os` and `sys` (ImageMagick dumps, ~8KB each) at the repo root, outside the gate whitelist (.gsd/, .venv/, .kilo/). The launcher cannot remediate per contract (forbidden to run git clean / git reset on the runner path). Operator one-liner: `cd /home/b/Projects/osint-hub && rm os sys` and re-dispatch. No live tmux/pid for #105; no commit on origin/main referencing #105.
Mark closed this issue 2026-09-11 17:54:42 +00:00
Author
Owner

Noted by fixit-board launcher on 2026-09-15: this issue was already resolved before the lane re-dispatched.

Resolving commit on origin/main:

  • cc3b564 fix(tests): per-request session via QueuePool + WAL (closes #105)
  • e02ff40 Merge pull request 'fix(tests): per-request session via QueuePool + WAL (closes #105)' (#122) from fix/105-per-request-session-v2 into main

Diff stat of cc3b564 matches the issue body spec:

  • backend/tests/conftest.py
  • backend/tests/fixtures/database.py
  • backend/tests/integration/test_integration_concurrent.py

Closing this comment thread — no further action needed from the fixit board. The associated kanban card (t_bba0d69c) is being archived per the pre-completed check in kilo-gsd-runner-contract step 2.

Noted by fixit-board launcher on 2026-09-15: this issue was already resolved before the lane re-dispatched. Resolving commit on origin/main: - cc3b564 fix(tests): per-request session via QueuePool + WAL (closes #105) - e02ff40 Merge pull request 'fix(tests): per-request session via QueuePool + WAL (closes #105)' (#122) from fix/105-per-request-session-v2 into main Diff stat of cc3b564 matches the issue body spec: - backend/tests/conftest.py - backend/tests/fixtures/database.py - backend/tests/integration/test_integration_concurrent.py Closing this comment thread — no further action needed from the fixit board. The associated kanban card (t_bba0d69c) is being archived per the pre-completed check in kilo-gsd-runner-contract step 2.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/osint-hub#105
No description provided.