Skip to content

feat: orient --refresh + assert confirmed-stale (freshness gate) - #122

Merged
takashi-matsuyama merged 1 commit into
mainfrom
freshness-gate
Jun 24, 2026
Merged

takashi-matsuyama merged 1 commit into
mainfrom
freshness-gate

Conversation

@takashi-matsuyama

Copy link
Copy Markdown
Member

Two moat-safe fixes from a takashimatsuyama-blog dogfeedback report: basou orient correctly detected staleness (the v0.21.0 top banner), but the remediation (basou refresh) was advisory only, so a consuming agent skipped it and read the repo directly — bypassing the freshness gate.

[#1 moat-safe] opt-in basou orient --refresh

Imports every adapter first (writes provenance), then renders a guaranteed-fresh position — so a SessionStart hook can close the freshness gate in one command. Bare basou orient stays read-only (it never imports; the dry-run probe only reports staleness). The deliberate invariant — a plain orient never mutates the store — is preserved.

Default-on auto-refresh (the report's proposal #1) was deliberately NOT adopted: it would reverse orient's read-only contract and make every consumer (portfolio view, CI) a writer. The enforcement belongs in the hook layer (which may write), orchestrated via this opt-in flag — not in the read command.

[#4] Assert confirmed staleness instead of hedging

For the confirmed-stale branch only (newSessions>0 || updatedSessions>0), the top banner and bottom verdict now state plainly that the view is stale (with the uncaptured count) + an imperative "run basou refresh first", instead of "might be stale". basou counted the uncaptured work, so it asserts it rather than understating the urgency. The genuinely-uncertain branches keep their hedged wording (un-re-importable grown session: "cannot confirm"; unrun probe: "run refresh to check").

Not adopted (with reasons)

This is consistent with the earlier Stop-hook decision (advisory nudge over forced block): basou's moat is advisory + read-only + human-in-the-loop. The forced-gate proposals are the same enforcement posture already declined there.

Adversarial review (Codex)

No findings. Confirmed: wording confined to the confirmed-stale branch (unverifiable/null branches stay non-asserted), --refresh runs refreshAll before the probe with a full non-dry/non-force import, no stdout pollution of the orient body, bare orient writes no provenance, and a refresh failure routes through the existing clean error handler.

Tests

+1 cli (orient --refresh imports an uncaptured session → verdict flips to current); updated the confirmed-stale wording assertions. Full suite green: core 1143, sdk 18, cli 820. typecheck + lint clean. Verified by smoke against the real workspace.

🤖 Generated with Claude Code

Two moat-safe fixes from a dogfeedback report where a consuming agent
skipped `basou refresh` despite a stale orient and read the repo directly,
bypassing the freshness gate.

[#1 moat-safe] Add opt-in `basou orient --refresh`: imports every adapter
first (writes provenance) then renders a guaranteed-fresh position, so a
SessionStart hook can close the freshness gate in one command. Bare
`basou orient` stays read-only (never imports) - the deliberate invariant
that a plain orient never mutates the store is preserved. Default-on
auto-refresh was deliberately NOT adopted: it would make every orient
consumer (portfolio view, CI) a writer.

[#4] Confirmed-stale wording is asserted, not hedged. The top banner and
the bottom freshness verdict, for the confirmed-stale branch ONLY
(newSessions>0 || updatedSessions>0), now state plainly that the view IS
stale (with the uncaptured count) plus an imperative "run basou refresh
first", instead of the previous "might be stale" hedge. basou counted the
uncaptured work, so it asserts it. The genuinely-uncertain branches (an
un-re-importable grown session; an unrun probe) keep their non-asserted
wording.

Not adopted: suppressing the orient body when stale (removes the honest
hedged orientation the report itself praised); a PreToolUse re-injection
hook (larger design, backlog).

Adversarial review (Codex): no findings - confirmed the wording is
confined to the confirmed-stale branch, --refresh runs refreshAll before
the probe with a full non-dry import, no stdout pollution, bare orient
stays read-only, and a refresh failure routes through the existing clean
error handler.

Tests: +1 cli (orient --refresh imports an uncaptured session, so the
verdict flips to current); updated the confirmed-stale wording assertions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@takashi-matsuyama
takashi-matsuyama merged commit e0a1ee7 into main Jun 24, 2026
7 checks passed
@takashi-matsuyama
takashi-matsuyama deleted the freshness-gate branch June 24, 2026 03:59
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.

1 participant