Skip to content

models: promote project identity and thread source facts#72

Merged
gaelic-ghost merged 3 commits into
mainfrom
runtime/workspace-git-facts
May 8, 2026
Merged

models: promote project identity and thread source facts#72
gaelic-ghost merged 3 commits into
mainfrom
runtime/workspace-git-facts

Conversation

@gaelic-ghost
Copy link
Copy Markdown
Owner

@gaelic-ghost gaelic-ghost commented May 8, 2026

Summary

  • promote CodexWorkspace.ProjectInfo and RepositoryInfo for app-server-owned project identity
  • expose ThreadInfo.source and persist it through library thread snapshots
  • refresh DocC, roadmap, public API audit, and symbol inventory

Validation

  • swift test
  • bash scripts/repo-maintenance/validate-all.sh
  • git diff --check
  • swift package dump-package
  • swift package dump-symbol-graph --minimum-access-level public --skip-synthesized-members
  • env SWIFTASB_LIVE_CODEX_TIMEOUT_SECONDS=120 scripts/run-live-codex-integration-tests.sh release-gate
  • env SWIFTASB_LIVE_CODEX_TIMEOUT_SECONDS=120 scripts/run-live-codex-integration-tests.sh thread
  • env SWIFTASB_ENABLE_LIVE_CODEX_APPROVAL_TESTS=1 SWIFTASB_LIVE_CODEX_TIMEOUT_SECONDS=120 swift test --filter CodexAppServerLiveIntegrationTests/acceptsLiveApprovalRequestAndCompletesTurn
  • env SWIFTASB_LIVE_CODEX_TIMEOUT_SECONDS=120 scripts/run-live-codex-integration-tests.sh server-requests
  • env SWIFTASB_LIVE_CODEX_TIMEOUT_SECONDS=120 scripts/run-live-codex-integration-tests.sh behavior-matrix

Summary by CodeRabbit

  • New Features

    • Thread source badges and origin tracking added (app-server, CLI, editor, custom, sub-agent) for clearer launcher/sidebar context.
    • Improved project identity (repository origin or fallback to directory) for more accurate thread grouping and display.
    • Thread history now persists source and Git SHA for consistent snapshots and UI ordering.
  • Refactor

    • Unified project identity used across grouping, display and session snapshots.
  • Documentation

    • Roadmap and docs updated to reflect these behaviors.

@gaelic-ghost gaelic-ghost added the enhancement New feature or request label May 8, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 66f70e78-53e8-4f99-b0eb-00f12899f542

📥 Commits

Reviewing files that changed from the base of the PR and between d8685ee and edeac46.

📒 Files selected for processing (1)
  • Sources/SwiftASB/SwiftASB.docc/ThreadHistoryAndObservables.md
✅ Files skipped from review due to trivial changes (1)
  • Sources/SwiftASB/SwiftASB.docc/ThreadHistoryAndObservables.md

📝 Walkthrough

Walkthrough

This PR restructures thread metadata models in SwiftASB by introducing CodexWorkspace.ProjectInfo to unify project identity (replacing separate git-origin fields) and CodexAppServer.ThreadSource enum to categorize thread origins. Core Data schema, public API surfaces, wire mapping, and test assertions are updated accordingly throughout.

Changes

Thread Source and Project Identity Refactoring

Layer / File(s) Summary
New Data Models
Sources/SwiftASB/Public/CodexWorkspace.swift, Sources/SwiftASB/Public/CodexAppServer+ThreadLifecycle.swift
Introduces CodexWorkspace.ProjectInfo (Identifiable) with IdentitySource enum to derive id/displayName from Git origin or cwd fallback, RepositoryInfo to hold branch/origin/sha, and CodexAppServer.ThreadSource enum with nested SubAgentSource and ThreadSpawn types for richer thread-origin metadata.
Core Data Schema Updates
Sources/SwiftASB/History/ThreadHistoryStore.swift
Adds gitSHA attribute and sourceData binary attribute to HistoryThread entity; ThreadSnapshot and ThreadListSnapshot include new source: ThreadSource field.
Persistence Logic
Sources/SwiftASB/History/ThreadHistoryStore.swift
Store now decodes sourceData into source field (defaulting to .unknown), extracts gitSHA from info.projectInfo.repository, and encodes thread source into persisted blob.
Library Public API
Sources/SwiftASB/Public/CodexAppServer+Library.swift
Library.ThreadSnapshot exposes projectInfo; Library.ThreadGroup carries optional projectInfo; repository grouping now keys off thread.projectInfo.id and computes consolidated projectInfo per group.
Metadata Update Model
Sources/SwiftASB/Public/CodexAppServer+ThreadManagement.swift
Refactors ThreadMetadataUpdateRequest.gitInfo to use patch model (ThreadMetadataGitInfoUpdate?) with per-field .unchanged/.clear/.replace semantics; removes old GitInfo struct.
Wire Mapping
Sources/SwiftASB/Public/CodexAppServer+WireMapping.swift
Updates ThreadInfo mapping to populate projectInfo and source; adds initializers for ThreadSource, SubAgentSource, and ThreadSpawn from wire protocol values.
Workspace Updates
Sources/SwiftASB/Public/CodexWorkspace.swift
SessionSnapshot replaces gitInfo with projectInfo; adds RepositoryInfo wire initializer.
Tests
Tests/SwiftASBTests/Public/CodexAppServer*.swift
Library tests assert projectInfo.repository and identity source; stored-thread tests validate source as .cli and new custom/sub-agent decoding; thread-management tests use projectInfo instead of gitInfo.
Documentation
ROADMAP.md, Sources/SwiftASB/SwiftASB.docc/*, docs/maintainers/*
ROADMAP clarifies project identity and source models; API docs add ThreadSource and ProjectInfo; removes GitInfo references; refreshes public symbol inventory.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • gaelic-ghost/SwiftASB#69: Both PRs extend ThreadHistoryStore and CodexAppServer.Library to carry enriched thread and project metadata through stored and app-server-owned surfaces.

Poem

🐰 With ProjectInfo's guiding light,
Thread sources shine both clear and bright!
From git origins to custom names—
SubAgents dancing in the flames! ✨
The storage persists, the models unify,
One happy refactor—no threads left awry! 🧵

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'models: promote project identity and thread source facts' directly and concisely summarizes the main objective of this pull request: promoting/exposing project identity and thread source as public API models.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch runtime/workspace-git-facts

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/SwiftASB/SwiftASB.docc/ThreadHistoryAndObservables.md`:
- Line 25: The wording for the ThreadSource description is ambiguous because it
reads like an exhaustive list but omits categories such as exec and unknown;
update the prose in ThreadHistoryAndObservables.md to clarify that
CodexAppServer/ThreadSource (and the exported ThreadSource model) includes those
additional categories or is non-exhaustive—e.g., change the clause listing CLI,
app-server, editor, custom, or sub-agent to either add exec and unknown or
prepend “including”/“such as” to indicate it’s not a complete list; ensure
references to ThreadSource and ThreadInfo remain accurate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ba0de36-8c5c-4dfe-aba4-aad844ad74e4

📥 Commits

Reviewing files that changed from the base of the PR and between 329f1b3 and d8685ee.

📒 Files selected for processing (16)
  • ROADMAP.md
  • Sources/SwiftASB/History/ThreadHistoryStore.swift
  • Sources/SwiftASB/Public/CodexAppServer+Library.swift
  • Sources/SwiftASB/Public/CodexAppServer+ThreadLifecycle.swift
  • Sources/SwiftASB/Public/CodexAppServer+ThreadManagement.swift
  • Sources/SwiftASB/Public/CodexAppServer+WireMapping.swift
  • Sources/SwiftASB/Public/CodexWorkspace.swift
  • Sources/SwiftASB/SwiftASB.docc/CodexAppServer.md
  • Sources/SwiftASB/SwiftASB.docc/CodexThread.md
  • Sources/SwiftASB/SwiftASB.docc/SwiftUIObservableCompanions.md
  • Sources/SwiftASB/SwiftASB.docc/ThreadHistoryAndObservables.md
  • Tests/SwiftASBTests/Public/CodexAppServerLibraryTests.swift
  • Tests/SwiftASBTests/Public/CodexAppServerStoredThreadTests.swift
  • Tests/SwiftASBTests/Public/CodexAppServerThreadManagementTests.swift
  • docs/maintainers/v1-public-api-audit.md
  • docs/maintainers/v1-public-api-symbol-inventory.md
💤 Files with no reviewable changes (1)
  • Sources/SwiftASB/Public/CodexAppServer+ThreadManagement.swift

Comment thread Sources/SwiftASB/SwiftASB.docc/ThreadHistoryAndObservables.md Outdated
Copy link
Copy Markdown

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

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: d8685eec50

ℹ️ 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 on lines +216 to +217
public let projectInfo: CodexWorkspace.ProjectInfo
public let source: ThreadSource
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep ThreadInfo.gitInfo as a compatibility shim

This change replaces ThreadInfo.gitInfo with projectInfo, which is a source-breaking API removal for existing v1 consumers that still read thread.info.gitInfo (or depend on CodexAppServer.GitInfo). Upgrading to this commit will fail their builds even though the underlying data is still available, so this should keep a deprecated compatibility accessor/type (backed by projectInfo.repository) instead of removing the old surface outright.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Skipping this intentionally. This branch is a cleanup pass, and the repo guidance says not to leave legacy compatibility shims after cleanup/typing work without explicit approval; the replacement data is now carried by ThreadInfo.projectInfo.repository.

Comment on lines +341 to +342
public let projectInfo: CodexWorkspace.ProjectInfo
public let source: CodexAppServer.ThreadSource
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve ThreadSnapshot Git accessors for v1 clients

The new projectInfo field is useful, but removing ThreadSnapshot.currentGitBranch/currentGitOriginURL is another source-level break for app code that already consumes Library.ThreadSnapshot directly. Since repository grouping and metadata still depend on these facts, keep deprecated read-only shims that map to projectInfo.repository so existing launcher/sidebar integrations continue compiling across minor upgrades.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Skipping this intentionally for the same cleanup reason. Library.ThreadSnapshot.projectInfo.repository is the promoted replacement, and keeping duplicate Git accessors would preserve the legacy surface this pass is removing.

@gaelic-ghost gaelic-ghost merged commit 95cb2be into main May 8, 2026
2 checks passed
@gaelic-ghost gaelic-ghost deleted the runtime/workspace-git-facts branch May 8, 2026 13:50
This was referenced May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant