fix(author bootstrap): restore missing runtime identity and session helpers #943
Open
opened 2026-07-26 07:29:45 -05:00 by jcwalker3
·
2 comments
No Branch/Tag Specified
master
fix/issue-943-runtime-context-helpers
fix/issue-941-scope-guard-bootstrap-wiring
docs/issue-930-remote-mcp-coupling-inventory
fix/issue-927-pytest-config
feat/issue-708-mcp-namespace-attachment
fix/issue-892-author-bootstrap-deadlock
fix/issue-686-detect-reject-manual-mcp
feat/issue-707-cross-project-boundaries
fix/issue-690-review-profile-switch-guard
fix/issue-704-prevent-env-workspace-bindings
fix/issue-700-durable-walls
fix/issue-672-mcp-config-drift
fix/issue-689-deterministic-mcp-namespace
fix/issue-678-codex-mcp-reconnect
feat/issue-649-sentry-console-correlation
feat/issue-666-concurrent-mcp-restart-tests
feat/issue-659-maintenance-drain-mode
feat/issue-648-notifications-console
fix/issue-670-direct-master-incident
feat/issue-644-console-recovery
feat/issue-650-providers-insights
feat/issue-669-scoped-component-recovery
docs/issue-668-mcp-ha-rolling-restart
feat/issue-667-console-restart-controls
feat/issue-665-restart-audit
feat/issue-664-break-glass-restart
feat/issue-645-linkage-console
feat/issue-643-request-preview-initiate
fix/issue-897-permission-stale-runtime-classification
feat/issue-641-runtime-session-view
feat/issue-663-restart-classes
feat/issue-661-drain-proof-hard-gate
fix/issue-854-semantic-container-exclusion
issue-640
fix/issue-682-starlette-httpx2
v1.1.0
Labels
Clear labels
allocator
anti-stomp
architecture
bug
chore
codex
concurrency
contamination
control-plane
dashboard
database
design
documentation
enhancement
gitea
glitchtip
important
incident
incident-bridge
integration
jenkins
labels
leases
mcp
mcp-health
mcp-menu
multi-project
mutating
nice-to-have
observability
portability
preflight
protected-branch
queue
read-only
reconnect
recovery
refactor
release
reliability
resumable-review
reviewer
roadmap
safety
security
self-hosted
sentry
stale-runtime
status:blocked
status:in-progress
status:pr-open
status:ready
terminal-lock
testing
tracker
type:bug
type:feature
type:feature
type:guardrail
visibility
workflow
workflow-hardening
workflow-hardening
Controller-owned work allocator
Prevent concurrent LLM session stomping
Architecture / structural design
OpenAI Codex client / workflow session surface
Concurrent session safety
Workflow or session contamination incident
MCP control-plane coordination and allocation authority
MCP operational dashboard/queue view
Internal coordination storage (SQLite/Postgres)
Design / investigation, no implementation
Docs / runbooks
New feature or improvement
Gitea MCP workflow
GlitchTip integration
Operational or process incident requiring durable audit trail
Sentry-to-Gitea incident bridging
Integration testing
Jenkins integration
Label taxonomy management
Lease adopt/release/expire lifecycle
MCP server / tooling
MCP namespace and runtime health
MCP menu surface
Work spanning multiple monitoring projects or Gitea repos
Mutating action; requires gating
Observability, metrics, traces, error reporting
Cross-platform / portability
Shared preflight gates before mutation
Protected branch / stable-branch policy concern
Work queue visibility and allocation
Read-only, no mutation
MCP client reconnect/reload recovery path
Recovery paths for stale/foreign leases
Code refactor / restructure
Release / versioning
Reliability / failure handling
Persist and resume prepared review verdicts across sessions
Reviewer workflow tooling
Roadmap / umbrella issue
Safety rails and fail-closed mutation guards
Security / trust boundary
Self-hosted infrastructure integration
Sentry error monitoring integration
Stale backend daemon / runtime-vs-master parity failures
Issue is blocked
Issue is being worked on
Issue has an open pull request
Issue is ready for work
Terminal review lock (#332) path
Tests / test coverage
Issue tracker hygiene / meta
Bug or defect
Feature or enhancement
Feature or enhancement
Safety gate or guardrail
Workflow state visibility for LLMs/operators
Cross-tool workflow
LLM workflow coordination hardening
LLM workflow coordination hardening
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Scaled-Tech-Consulting/Gitea-Tools#943
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The sanctioned
gitea_bootstrap_author_issue_worktreecapability crashes before enteringauthor_issue_bootstrap.bootstrap_author_issue_worktreebecausegitea_mcp_server.pyreferences three undefined helpers:_active_username_active_profile_name_current_session_idThis makes native author issue-worktree bootstrap unusable for every caller, including
dry_run=true.Observed failure
Commissioning was performed against deployed revision:
aab54d4825270f5a5c6f9c1abc1ab09eb4f3e218The sanctioned call used:
Result:
The failure occurs while evaluating arguments around
gitea_mcp_server.py:10235, before the underlying bootstrap function executes.Source inspection found:
_active_username_active_profile_name_current_session_idProvenance
The undefined references were introduced by commit
a942afe, "Implement native author issue worktree bootstrap (#850)."This is separate from #941 and PR #942. PR #942 successfully corrected the bootstrap scope guard: commissioning passed
verify_preflight_purityand advanced beyond the formermissing_issue_worktreerefusal before reaching this latentNameError.Impact
gitea_bootstrap_author_issue_worktreeis unconditionally broken at the deployed revision.Expected behavior
The MCP wrapper must obtain the active username, profile, and session identifier through defined, canonical runtime-context accessors and invoke the underlying bootstrap service successfully.
With
dry_run=true, the capability must:NameError, internal errors, or reliance on undefined globals.Acceptance criteria
gitea_bootstrap_author_issue_worktree(dry_run=true).Related work
[THREAD STATE LEDGER] Issue #943 / PR #944 — implementation delivered, awaiting independent review
What is true now:
f49e781102aab54d4825(verified as the commit parent)What changed:
f49e781102, PR #944 opened, issue #943 moved to status:pr-openWhat is blocked:
Who/what acts next:
f49e781102Canonical Issue State
STATE: Implementation for #943 is complete and delivered as PR #944 at head
f49e781102. Four globals referenced by gitea_bootstrap_author_issue_worktree and defined nowhere are now defined: _active_username, _active_profile_name, _current_session_id, and _author_mutation_block. The fourth was not in the original report and was found by the generalised AST regression test.WHO_IS_NEXT: reviewer
NEXT_ACTION: Review PR #944 against the #943 acceptance criteria with the head pinned to
f49e781102, then post APPROVE or REQUEST_CHANGES from a reviewer namespace.NEXT_PROMPT:
WHAT_HAPPENED: Commissioning #941 against deployed revision
aab54d4825cleared the scope guard PR #942 fixed and then failed with builtins.NameError, name '_active_username' is not defined, while evaluating call arguments at gitea_mcp_server.py:10235. Source inspection found three such globals, each with one reference and no definition, introduced by commita942afeunder #850. Issue #943 was filed. This branch defines all three plus a fourth, _author_mutation_block, on the reviewer-stop refusal path. _active_username reads the immutable #714 session context seeded by gitea_whoami; _active_profile_name prefers the live get_profile with the session context as fallback; _current_session_id mints the same profile-pid-hex shape as the three pre-existing lease call sites, bound once per process; _author_mutation_block returns the uniform refusal shape the other author mutations already use. The diff is 2 files, +534 / -0, with no guard, signature, permission, or role change.WHY: The bootstrap capability was unusable for every caller including dry_run=true, because the NameError fired before the bootstrap service was entered. That left authors with no sanctioned path to an issue-backed worktree and kept issue #931 unable to start through the canonical workflow. The defect was masked until PR #942 removed the scope-guard refusal that preceded it.
RELATED_PRS: PR #944 (open, head
f49e781102, closes #943); PR #942 (merge performed ataab54d4825, closed #941, exposed this defect); PR #926 (merge performed, closed #892)BLOCKERS: no blocker
VALIDATION: New suite pre-fix against unmodified
aab54d48: 20 failed, 13 passed. New suite post-fix: 27 passed, 12 subtests. Targeted suites for 943, 941, 892, author_issue_bootstrap, create_issue_bootstrap, 683, 757, anti_stomp_preflight, root_checkout_guard, 618: 245 passed, 59 subtests. Full suite from the branches worktree: 28 failed, 5552 passed, 6 skipped, 1006 subtests in 151.72s; the 28 are the standing baseline and every one also fails against the unmodified base, verified by failing-test identity rather than by count.LAST_UPDATED_BY: jcwalker3 / prgs-author / gitea-author namespace, session author_issue_work-d1a91a7d2c7d43df, pid 18161
[THREAD STATE LEDGER] Issue #943 / PR #944 — REQUEST_CHANGES posted to Gitea (review 622)
What is true now:
f49e781102aab54d4825(live master, unmoved during review)f49e781102, not dismissed, not staleWhat changed:
What is blocked:
Who/what acts next:
Canonical Issue State
STATE: PR #944 for issue #943 carries one formal REQUEST_CHANGES review (622) from sysadmin at head
f49e781102. Two blocking findings and two lesser findings are open. Three of the four restored helpers are correct; the fourth makes the allocator-driven bootstrap path unusable.WHO_IS_NEXT: author
NEXT_ACTION: Author jcwalker3 must make owner_session resolve to the control-plane session that owns the supplied lease instead of minting a per-process identifier, add a test that supplies assignment_id plus lease_id and asserts the ownership comparison succeeds, unify the identity and profile authorities on one source, narrow the bare exception handler around get_profile, then push and publish a new head-pinned handoff for a fresh independent review.
NEXT_PROMPT:
WHAT_HAPPENED: An independent reviewer read both changed files at the exact head, traced all four previously undefined globals to their data sources and call sites, and drove the real bootstrap service rather than trusting the author's summary. _author_mutation_block, _active_username and _active_profile_name behave correctly in the paths that matter, and the AST-based regression test is sound and is what originally surfaced _author_mutation_block. _current_session_id, however, mints a fresh identifier that can never equal the control-plane session which owns an allocated lease; an isolated temporary control-plane DB reproduced lease_session_mismatch, and the same gate passed when handed the true owner session. The wrapper exposes no session_id parameter, so no caller can supply the correct value. The new test file never supplies assignment_id or lease_id, leaving that path uncovered. Full suites were run at the head and at a clean base checkout: 28 failed / 5552 passed / 1006 subtests versus 28 failed / 5525 passed / 994 subtests, with identical failing test id sets, so the branch causes no regression.
WHY: The tool's purpose is bootstrapping an allocated author issue worktree, and ownership of that allocation is compared by session identifier. A minted identifier cannot match the allocator's session, so the canonical flow stays refused and issue #931 still cannot start through it. Process-lifetime identity also contradicts #790, whose own documentation states the long-lived daemon's process identity proves nothing about task ownership, and contradicts live control-plane data showing several distinct author sessions under a single PID.
RELATED_PRS: PR #944 (open, head
f49e781102, closes #943, review 622 REQUEST_CHANGES); PR #942 (merge performed ataab54d4825, closed #941, exposed the #943 defect); PR #924 (open, #690 cross-profile session invalidation, relevant to finding F3)BLOCKERS: code blocker
VALIDATION: New #943 suite at head: 27 passed, 12 subtests. Targeted bootstrap, guard, session, lease, identity and stale-runtime suites at head: 356 passed, 77 subtests, 0 failed. Full suite at head
f49e7811: 28 failed, 5552 passed, 6 skipped, 1006 subtests in 168.20s. Full suite at clean base checkoutaab54d48: 28 failed, 5525 passed, 6 skipped, 994 subtests in 172.64s. Failing test id sets identical between head and base, so no regression originates from this branch; the extra 27 passes are this PR's new tests. Isolated temporary control-plane DB probe reproduced lease_session_mismatch for the wrapper-minted session and passed for the true owner session.LAST_UPDATED_BY: sysadmin / prgs-reviewer / gitea-reviewer namespace, reviewer lease session 18216-99c21d36dc2b