Skip to content

FIX-1564: BR-17's positive half goes through the transport door - #2175

Merged
jhoffner merged 6 commits into
mainfrom
fix/FIX-1564
Sep 24, 2026
Merged

jhoffner merged 6 commits into
mainfrom
fix/FIX-1564

Conversation

@jhoffner

@jhoffner jhoffner commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

The problem

The DevForce lab goal says it proves two things about the HTTP front door: a read with no verified organization is turned away, and the same read with one gets through. It only checked the first. The "gets through" half bypassed the door and called the seat directly, so a door that refused every request, authenticated or not, still passed. That weakness was flagged on #2073 and merged without an answer, and the W5 epic spec cites this goal as the re-proof of that rule. The proof was weaker than it said.

What this does

Both halves now go through the same door. The refusal half is unchanged: no credential, a session nothing has used, and it must get a 401. The positive half sends the same read through that same door, carrying the lab's own verified bearer token on a separate fresh session. That way its organization can only come from the token, not from something already stored. It must come back successful with the seat's own facts: its id and the document it names. The seat hands those facts to the caller on a stream-only item it emits for that purpose, so the goal no longer depends on debug tracing being switched on. Each half now has a check that turns red when it's wrong. Before, only the refusal did.

What's asked of you

Nothing here is yours to decide. This is a bug fix on the direct route, so this PR is the only gate.

Parts worth reviewing closely

The rest of this is for whoever reviews the code.

  • goals/devforce-lab/lab/seat-config.mts, readOwnFacts, now also emits its facts as a stream-only component item (devforce-seat-facts, transient: true). An HTTP caller has no intended surface for a handler's return value: the POST stream carries it only on block_trace, the request record stores no output, and ?include=trace is gated by trace observability. Is putting the result on a client item the right call for a lab entry, given that it changes what every inspect call streams? If it's wrong, the change is contained to this lab.
  • goals/devforce-lab/lab/host.mts, the door branch of inspect. The probe selects that component by name, and fails with a message that says whether request.completed fired at all. Earlier heads read the trace item.updated. That only reached the caller through a client-filter leak, which is being filed against the engine separately, and it was absent entirely under NODE_ENV=production / FSDEV_TRACE_OBSERVABILITY=false.
  • Where I'm unsure: red states 1 and 2 print the same 401 line. They are different perturbations, but the transcript doesn't tell them apart. Deliberately not here: no packages/* change, including the client-filter leak.

FIX-1564 · epic FIX-1457 (W5) · fixes the P1 on #2073 · bug route, no spec · merges after review

How to review this — altitude, what's in scope, what's deliberately unsettled

How to review this. This is a bug fix on the direct route: there is no spec and no
spec PR, because the hard part was the diagnosis and it happened in code. This PR is the
only gate
, so unlike a spec-backed change, the approach is in scope — nothing here was
signed off upstream.

Most valuable here: the diagnosis chain — does the repro actually reproduce the reported
failure, is the named cause the real one, does the fix address that cause rather than the
symptom, and does the regression test fail without the fix? Then the second path (the legacy
shape, the null boundary, the concurrent case, the cancel path).

In scope to challenge: where the guard was placed, any behaviour change a user could
notice, and whether this should have been a spec'd feature instead of a fix.

Engineering calls — decided along the way, no product sign-off needed
  • inspect(seatId, { omitOrg: true }) becomes inspect(seatId, { door: "org-less" | "bearer" }): one discriminant instead of two booleans that could both be set. The only caller is this goal. If it's wrong, it's a rename.
  • The two probes use separate fresh session ids (org-less-<seat>, bearer-<seat>). With a shared id, once the bearer probe created that session, any org-less probe that ran after it would inherit the session's stored org and never be refused.
  • The positive half is graded on the seat's own facts, not just "no error". A door that answered with an empty body would otherwise pass.
  • The facts component is transient, so readOwnFacts still writes nothing durable. That keeps the never-woken reviewer seat's silence meaningful.
  • The router is built after the lab's logger is installed. Otherwise the request that now lands printed the engine's default logs to stdout.
Verification — the defect on main, red states, trace settings, green, checks

All runs are model-free, with FSDEV_DEFAULT_MODEL and every FSDEV_INTENT_* removed from the environment. Command: pnpm tsx goals/devforce-lab/it-wakes-the-seat-a-file-declared/run.mts. Each red state was produced by a sed on a copy of the file and restored from that copy.

The defect on main. On main's host.mts, the resolver was changed to refuse every request. The goal still printed PASS and exited 0.

Red state Failure line (exit 1)
1. Resolver refuses every bearer the same read carrying a verified bearer did not land — 401: {"error":"Request requires a verified organization: no verified principal was presented."}
2. Bearer header dropped from the positive request same 401 line
3. Org-less probe given the bearer an org-less read of eng.em was answered rather than refused
4. request.completed stripped … did not land — request.completed never fired (events: request.created, request.in_progress, item.added, item.done, item.updated)
5. Probe selects a different component name … did not land — request.completed fired with no devforce-seat-facts component (events: …, request.completed)
6. Seat stops emitting the component (default env; the trace item.updated is still on the wire) … did not land — request.completed fired with no devforce-seat-facts component (events: request.created, request.in_progress, item.updated, request.completed)

Trace settings. The goal passes (exit 0), with nothing forced, under the default env, FSDEV_TRACE_OBSERVABILITY=false, and NODE_ENV=production. At the earlier trace-reading head with no env forcing, the last two failed with request.completed fired with no inline block output.

Green. Exit 0, and all five GOAL_CONTROL controls still go red. Recorded in the goal's verdict log.

Checks. pnpm turbo run typecheck --filter=@flow-state-dev/goals passed. pnpm --filter @flow-state-dev/goals guard:control-shape passed. pnpm knip:ci exited 0. validate-model-strings and validate-no-nul-bytes passed.

No changeset: goals/ is private.

🤖 Generated with Claude Code

https://claude.ai/code/session_016qaz1VpRK4wCQzxpjzZ4Hz

The "read with an org lands" half of BR-17 called a direct runAction,
which never reaches the lab's principal resolver, so a door that refused
every request still passed. It now sends the same read through the same
router carrying the lab's verified bearer, on a fresh session id so its
org can only come from that bearer, and is graded on the seat's own
facts off the inline stream.

The router is now built after the lab's logger is installed, so the
request that lands does not print the engine's default logs.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qaz1VpRK4wCQzxpjzZ4Hz
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qaz1VpRK4wCQzxpjzZ4Hz
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Sep 24, 2026 8:19pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Sep 24, 2026 8:19pm UTC
flow-state-dev-ui Ignored Ignored Preview Sep 24, 2026 8:19pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T20:10:45.499761Z 7147ea1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor

cursor Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_b05c0781-5916-434d-87a0-d29fd8e5f3c8)

@linear-code

linear-code Bot commented Sep 24, 2026

Copy link
Copy Markdown

FIX-1564

@jhoffner jhoffner left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second-look + a light architecture pass, since the PR description explicitly invites a review of the approach (bug fix on the direct route, this PR is the only gate).

Approach. Routing both halves of BR-17 through the same transport door, on separate fresh session ids, and grading the positive half on the seat's own facts rather than just "no error" is the right shape — it closes exactly the hole #2073 flagged (a door that refuses everything still passing). The omitOrg?: boolean → door: "org-less" | "bearer" discriminant is a good simplification (was two independently-settable booleans, is now one). Verified the diagnosis against the evidence in the PR body: the defect (resolver refuses everything → still PASS on main) and all three red states line up with the code paths they claim to exercise.

Architecture. No refactor opportunity here beyond the one thing raised inline below — this is a scoped fix to a private test harness (goals/), the manual SSE data: parsing matches the existing convention used elsewhere in this same file and in goals/workforce-conventions/*/run.mts rather than introducing a new one, and the PR is explicit that packages/* is deliberately untouched. Forcing a broader abstraction here (e.g. a shared SSE-stream-to-facts helper) would be premature — this is still a single call site.

Router/logger reorder. The getRouter() after logger-install reorder checks out against how createFlowState resolves/mutates runtime.runtimeConfig — didn't find anything that contradicts the empirical before/after log-count evidence in the PR body.

Two inline notes below (one on the "last inline output" selection the PR description itself asks about, one a small message-clarity nit) — neither blocks, both are cheap to address or to leave as a comment for whoever revisits this file next.


Generated by Claude Code

Comment thread goals/devforce-lab/lab/host.mts Resolved
Comment thread goals/devforce-lab/lab/host.mts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7147ea1274

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread goals/devforce-lab/lab/host.mts Resolved
Review on #2175:
- Name the single-handler dependency behind "last inline output". The
  wire patch carries no provenance, so the root block can't be selected
  by id (BP-011 note).
- Replace the always-2xx status in the no-output error with whether
  request.completed fired at all, or fired with no inline output.
- Force trace capture for the door request only, then restore it. The
  facts ride on the handler's block_trace item, which the engine does
  not emit under NODE_ENV=production or FSDEV_TRACE_OBSERVABILITY=false.
- The positive-half note reads "did not land" instead of "refused too",
  because not every failure is a refusal.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qaz1VpRK4wCQzxpjzZ4Hz
The positive half read the seat's facts off a block_trace item.updated.
It only reached the caller because the client filter drops a hidden
item's added/done events but not its updates. The engine also captures
no trace at all under NODE_ENV=production or
FSDEV_TRACE_OBSERVABILITY=false.

The inspect entry now also emits its facts as a stream-only component
item (transient, so nothing is persisted). The probe selects that item
by component name. This drops the env forcing and the BP-011 "last
inline output" dependency: the selection is by name, so it no longer
depends on which block emitted last.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qaz1VpRK4wCQzxpjzZ4Hz
@jhoffner
jhoffner merged commit dbb5b12 into main Sep 24, 2026
12 checks passed
@jhoffner
jhoffner deleted the fix/FIX-1564 branch September 24, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants