Skip to content

fix(loop): resolve linked worktrees to canonical project store; add loop staleness status - #99

Open
roodboi wants to merge 4 commits into
mainfrom
kit/fclt-loop-canonical-identity
Open

roodboi wants to merge 4 commits into
mainfrom
kit/fclt-loop-canonical-identity

Conversation

@roodboi

@roodboi roodboi commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Linked worktree loop invocations previously selected execution-keyed runtime directories, producing separate worktree_* stores and automation names.

Resolve enrollment and loop commands through the shared Git common directory, verify the linked-worktree registration and primary checkout, and use canonical configuration and repository state. Existing canonical slug stores remain readable. Prior nonempty primary-checkout execution stores now block with a reconciliation message instead of silently losing access to queues, configuration, automations, and history. Shared indexes and graphs also scan canonical assets. Historical worktree stores are retained. Ordinary checkouts retain a stable repository store even though their receipt/execution identity also starts with worktree_; only linked checkout paths redirect to the primary checkout. Environment-selected roots and explicit CLI root/scope precedence remain intact.

Add fclt ai loop status --all-projects --stale-after 8d --json: a read-only report of scheduler status, lastRunAt, lastSuccessfulScheduledRunAt, staleness, and ephemeral legacy stores. That flag identifies the legacy execution-key format; older primary-checkout stores can also have it, so it is not evidence that their data is disposable. Missing, invalid, future, and older run timestamps are stale; recent execution remains distinct from successful scheduled coverage.

Validation:

  • bun run check and bun run type-check
  • Full pre-commit suite: 1,184 passed, 0 failed in an explicit throwaway HOME/XDG environment, with direct Bun/Node runtimes and a 30-second per-test timeout
  • 27 focused loop/root-precedence tests and 19 focused loop/repository-identity tests
  • bun run pack:dry-run, privacy review, and git diff --check
  • Regression coverage for canonical enrollment and indexing, scheduled/manual worktree execution, nested invocation, unsafe Git metadata, existing-state preservation, XDG state alignment, and paused/stale/ephemeral reporting

Post-merge activation plan:

  1. Update the installed fclt runtime. If a prior primary-checkout execution store blocks activation, preserve and reconcile its configuration, queue, automation, and history first; this PR does not migrate it.
  2. From each canonical checkout, run fclt ai loop enable --project to re-enable/unpause the intended per-project automation. Leave historical ephemeral stores and automations untouched pending separate review.
  3. Run fclt ai loop status --all-projects --stale-after 8d --json and verify every real project's canonical store has lastRunAt within eight days. Account for legacy worktree_* rows during reconciliation rather than assuming they are disposable. Check scheduler status and successful scheduled timestamps separately.

No live automations or runtime stores were changed during this work. Scheduling activation remains a post-merge operation.

@roodboi

roodboi commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-10-28T16:33:58.424450Z 3318bd6 Manual request
ℹ️ 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.

@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: dd4422788c

ℹ️ 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 src/paths.ts
Comment thread src/paths.ts
@roodboi roodboi changed the title fix(loop): resolve linked worktrees to the canonical project store (Darwin PROMOTE-1) fix(loop): resolve linked worktrees to canonical project store; add loop staleness status Oct 28, 2026

roodboi commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Both findings from dd44227 are addressed in 7a36c11. The full isolated suite passes: 1,182 tests.

@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: 7a36c1156d

ℹ️ 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 src/cli-context.ts

roodboi commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Updated head: 3318bd6. The environment-root precedence finding is fixed, and regression coverage now explicitly proves that an ordinary checkout keeps one stable repository store despite its worktree-prefixed execution identity, including after adding a remote and linked checkout. Full isolated suite: 1,184 passed.

@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: 3318bd60f9

ℹ️ 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 src/paths.ts
Comment on lines +417 to +421
const canonicalRoot = canonicalProjectAiRoot(rootDir, home, config);
const repositoryKey = repositoryKeyForCanonicalRoot(
canonicalRoot,
home,
config

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep project-render receipts isolated by checkout

When a primary and linked checkout both have project-render inputs, rendering in one now prevents rendering in the other. src/project-render-apply.ts derives its default receipt directory from facultMachineStateDir(home, canonicalRoot), so this change makes both checkouts share project-render/receipt.json. However, projectId() still hashes the real checkout path, and applyProjectRender() rejects the second checkout with “Project render ownership receipt belongs to a different project.” The CLI passes the explicit --root and --project-root through without redirecting them, so this affects normal project render invocations, not just internal callers. Keep checkout-bound render receipts and transactions execution-scoped while sharing the durable loop store.

Useful? React with 👍 / 👎.

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