Skip to content

Codex live projector's usableInBandCwd should reuse sessionMetaCwd now that #466/LLP 0150 landed #478

Description

@philcunliffe

hypaware-core/plugins-workspace/codex/src/exchange-projector.js's
usableInBandCwd(cwd, ctx) (added by PR #474, head 50919416) inlines its own
copy of the non-blank-and-absolute cwd predicate:

if (cwd.trim().length > 0 && isAbsolute(cwd)) return cwd

PR #474's own body says this is deliberate and temporary: "the docstring names
sessionMetaCwd and says to unify them once #466 lands... Duplicating two
boolean checks was preferred over either blocking this fix on #466 or moving a
shared predicate into core in the same change that #466 is already moving code
around in."

#466 has since merged (1555f13), together with LLP 0150
("one reader for the Codex session_meta header"), which exports exactly this
predicate as sessionMetaCwd from src/core/codex/rollout_session_meta.js for
precisely this reuse case: "exported because the codex backfill folds
turn_context.cwd as a fallback for the same field into the same gate, and so
must answer the question identically instead of keeping a looser copy."
hypaware-core/plugins-workspace/codex/src/backfill.js, which sits in the same
directory as exchange-projector.js, already imports it:
import { sessionMetaCwd } from '../../../../src/core/codex/rollout_session_meta.js'.

LLP 0150 itself does not mandate this: its "Still outstanding" section
explicitly scopes the in-band cwd path out ("a different source with a
different trust story... tightening it is its own decision rather than a
consequence of this one"). So this is not a violated invariant, and it changes
no behavior today (both predicates are byte-identical: non-blank-after-trim AND
path.isAbsolute). But LLP 0150 exists specifically because two independent
copies of this exact rule have already drifted and shipped wrong twice (#453,
#459) in this codebase, and #474's own body names unification as the intended
next step once the dependency it was blocked on landed. That dependency has now
landed.

Ask: replace usableInBandCwd's local predicate with a call to
sessionMetaCwd, keeping the local wrapper only for the error_kind
(cwd_blank vs cwd_not_absolute) classification the shared predicate does not
expose (it can still call the two checks separately for logging while trusting
sessionMetaCwd's return value as the source of truth), and update
exchange-projector.js's docstring plus the llp/0083-codex-live-cwd-from-rollout.decision.md
bullet that currently describes this as still depending on an unmerged PR.

Non-blocking: filed as a follow-up, not a reason to hold #474.

Metadata

Metadata

Assignees

No one assigned

    Labels

    neutral:fixDelegate this issue to neutral for an autonomous fix attempt (reproduce -> fix -> PR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions