Skip to content

impl(pm-stack): break-glass — outage queueing + local owner token CLI (#1253 split 6) #9608

Open

Description

@dezren39

Implementation split 6 of 6 from the #1253 design record (doc/2026-11-10T23-58-00Z_design_pm_stack_identity, section 6, merged in PR #8351).

Scope: Break-glass: outage queueing + the local owner token CLI.

Acceptance: during an entry/IdP outage, reads keep working from last-known state; eligible writes queue stamped provenance: outage-queued and are held out of verified-authorship surfaces until identity is confirmed by a fresh login; the owner can issue a single-use, at-most-1-hour admin stack token from the laptop via the aggregator's local CLI, with the issuance itself written as an audit event before the token works. Asserted authorship as a fallback mode does not exist; anything else fails closed.

Gate: the comment-surface part is gated on Drew's answer to design question 4 (queue-and-confirm for comments vs fail closed) — see #1253.

Parent: #1253 · Epic: #1184

Activity

  1. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-a — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-a posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  2. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 14, 2026
  3. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-a (outcome: free). Revalidated open, no hard-stop labels; design merged in PR #8351 (section 6). Released free untouched: implementation (break-glass outage queueing + local owner token CLI) is laptop worktree work; laptop transport down tonight (agent proxy closed; queue health fallback:true). First laptop-up lane implements per acceptance on #9608.

  4. added and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 14, 2026
  5. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-b — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-b posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  6. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 14, 2026
  7. 177 remaining items

  8. added
    work/assignedQueue worker lifecycle state
    and removed on Nov 14, 2026
  9. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-any-c: revalidated: OPEN, no hard-stop labels; #1253 split 6 break-glass needs laptop; laptop down - releasing free

  10. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-any-c (outcome: free). Revalidated fresh: #9608 OPEN (#1253 split 6, break-glass - outage queueing + local owner token CLI), no held/user-owned/do-not-* labels. Remains: laptop worktree implementation of split 6 - impossible this shift: laptop transport + queue broker DOWN (laptop-agent HTTP 502 tunnel :4799 EAGAIN; fleet queue health exit 3 tunnel :4801 EAGAIN).

  11. added and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 14, 2026
  12. removed their assignment
    on Nov 20, 2026
  13. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · claimed — Lane FP (archer) working this now.

    Slice: the §6 owner break-glass token half of #9608 — a local aggregator CLI that issues a single-use, ≤1-hour admin stack token, with the issuance written as an audit event before the token works (audit-write failure ⇒ no token; token stored only as a hash; consume is single-use and fails closed on unknown/expired/reused).

    Premise re-verified fresh: #9608 OPEN, no live claim (last claims all released 2026-11-14), design §6 in doc/2026-11-10T23-58-00Z_design_pm_stack_identity (PR #8351), splits 1/2/4/5 closed (#9603/#9604/#9606/#9607), split 3 (#9605) still open. The Q4 gate covers only the comment surface — this slice does not touch comments. Outage queueing and server-side acceptance of the token on admin routes remain as named follow-on slices.

  14. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · progress — Lane FP (archer)

    Slice landed: the §6 owner break-glass token. PR: #12941

    After this PR, on the laptop: bun run scripts/issue-break-glass-token.ts in pm-stack/aggregator issues a single-use admin stack token (default and maximum life one hour), having first written a break-glass-token-issued audit event — if the audit write fails, no token exists. Only the token's sha256 hash is persisted (~/.local/state/pm-aggregator/break-glass-tokens.json); consume is single-use and fails closed on unknown/expired/reused/empty tokens.

    Evidence (laptop worktree off origin/main): new test/break-glass.test.ts failed on main (module absent), now 7 pass / 0 fail; neighbouring identity-registry/config/events/access-identity suites green (22 pass in the final combined run); tsc --noEmit clean for touched files; CLI smoke at 45 minutes wrote exactly one audit event + one hash-only record, and 61 minutes was refused with exit 1. (test/boot.test.ts fails identically on pristine origin/main — pre-existing, untouched by this slice.)

    Acceptance state for #9608:

    • ✅ Owner issues a single-use, ≤1-hour admin token from the laptop via the aggregator's local CLI, issuance audited before the token works — this PR (module + CLI + consume, all tested).
    • ⬜ Next slice: server-side acceptance — wire consumeBreakGlassToken into the aggregator's admin-route auth so a presented token actually authorizes, exactly once, in the running server.
    • ⬜ Outage queueing: reads from last-known state + eligible non-comment writes stamped provenance: outage-queued, held out of verified-authorship surfaces until a fresh login confirms the claimant.
    • ⬜ Comment surface: still gated on Drew's answer to design question 4 on design(pm-stack): one identity across the stack — SSO propagation from the public entry into every layer, roles replace asserted authorship #1253 — untouched by this slice, per the gate.
  15. added a commit that references this issue on Nov 23, 2026
  16. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · claimed — Lane HI (archer) working this now.

    Slice: the server-side acceptance remainder named by Lane FP — wire consumeBreakGlassToken into the aggregator's admin-route auth so a presented break-glass token actually authorizes, exactly once, in the running server. Premise re-verified fresh: #9608 open, PR #12941 merged (token module + CLI + consume landed), no live claim on this slice. The outage-queueing and comment-surface remainders are NOT in this slice (comment surface stays gated on Drew's #1253 Q4 answer).

  17. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · held — Lane HI (archer)

    Premise verified and the slice is fully designed, but landing is held on a platform execution-risk flag: the laptop worktree for this slice (~/wt-lane-hi-9608) failed an execution-risk check mid-setup, so no code was written, built, or tested in it, and it sits untouched. Per the standing pattern for these flags, this needs Drew's plain-words go-ahead (or an unflagged venue) before any lane works in that checkout.

    Prepared design (from read-only inspection before the flag):

    • src/break-glass.ts: add presentedBreakGlassToken(req) (Authorization: Bearer, the codebase's token convention), breakGlassConsumptionAuditEvent(...) mirroring the issuance event, and a consume+audit authorize helper that fails closed (audit-write failure ⇒ not authorized, token burned).
    • src/server.ts: construct BreakGlassTokenStore from the existing cfg.breakGlassFile; in the /api/admin/identity-registry gate, Access-verified owner proceeds exactly as today (token never touched); otherwise a presented token is consumed atomically — success authorizes exactly one admin request with audit actor owner:break-glass:<id>; failure returns 403 with the consume error; no token ⇒ today's responses unchanged.
    • Tests: unit coverage in test/break-glass.test.ts style + a boot-based route test (no token ⇒ 403; valid token ⇒ 200 once; replay ⇒ 403). Note: boot tests need bun install in the worktree (missing web-push is why test/boot.test.ts fails on pristine main in a fresh worktree — pre-existing, unrelated).

    Baseline before the flag: test/break-glass.test.ts 7 pass / 0 fail on origin/main. The outage-queueing remainder and the #1253-Q4-gated comment surface are untouched, as scoped.

  18. added a commit that references this issue on Nov 23, 2026
  19. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — Lane IU (archer), executing after Drew's 2026-11-23 ~00:50 CST approval of this flagged item ("all 8 approved")

    The auth-wiring slice designed in Lane HI's record above is landed: PR #13009 merged (db0b5c21a7a, head 02c164a33b7 SHA-guarded; wiring verified present on main post-merge).

    What shipped, exactly per the design:

    • src/break-glass.ts: presentedBreakGlassToken(req) (Authorization: Bearer, the codebase's token convention), breakGlassConsumptionAuditEvent(...) mirroring the issuance event, and authorizeWithBreakGlassToken(...) — consume + audit, fail closed both ways (audit-write failure ⇒ not authorized, token already burned).
    • src/server.ts: BreakGlassTokenStore constructed from the existing cfg.breakGlassFile; in the /api/admin/identity-registry gate, an Access-verified owner proceeds exactly as before (token never touched); otherwise a presented token is consumed atomically — success authorizes exactly one admin request with audit actor owner:break-glass:<id>; failure returns 403 with the consume error; no token ⇒ today's responses unchanged.

    Verification:

    • bun test test/break-glass.test.ts test/break-glass-route-9608.test.ts — 12 pass / 0 fail (baseline was 7): unit coverage for the helper (consume-once + consumption audit event, audit-failure burns the token, event shapes, Bearer extraction) plus a boot-based route test (no token ⇒ 403; valid token ⇒ 200 once; replay ⇒ 403).
    • Manual boot against the real server confirmed the same sequence live, with the break-glass-token-consumed event (actor owner:break-glass:<id>) present in the events file afterward.
    • Neighboring suites green: identity-registry, access-identity, stack-token; tsc --noEmit clean.
    • boot.test.ts still fails in a fresh worktree for the pre-existing environmental reason HI noted in substance: the live aggregator holds freshness port 4871, so the test's server dies with EADDRINUSE before readiness. Unrelated to this change — the new route test pins a free freshness port.

    This issue stays open, as scoped in HI's design: the remainders are (1) outage queueing (reads from last-known state; eligible writes queued with outage provenance, held out of verified-authorship surfaces until a fresh login confirms identity) and (2) the comment surface, still gated on Drew's answer to #1253 question 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions