Skip to content

feat(clients): bring AEGIS Omega App Intents package under version control - #242

Open
Tarik Skalić (tarikskalic33) wants to merge 3 commits into
mainfrom
feat/app-intents-under-version-control
Open

feat(clients): bring AEGIS Omega App Intents package under version control#242
Tarik Skalić (tarikskalic33) wants to merge 3 commits into
mainfrom
feat/app-intents-under-version-control

Conversation

@tarikskalic33

Copy link
Copy Markdown
Member

Why

The package existed only in a transient agent scratch directory — Documents\Codex\2026-07-28\build-ios-apps-ios-app-intents-2\outputs\.

That is the same class of location where the holon-gram compiler (8 files, +4446/−889) was lost permanently: reported complete, never pushed, container reclaimed. Verified this session — it appears in zero git objects and in zero of 492 local session transcripts as source; only the +1599 diffstat survives. Untracked agent output is one cleanup away from gone.

What changed

Six source files + a README, unmodified in behaviour on Apple platforms.

Cross-platform guard. AppIntents ships only in Apple SDKs, so swift build fails off-Apple. The two AppIntents-dependent sources are wrapped in #if canImport(AppIntents), as is the test exercising AEGISSessionModeIntentValue (it referenced an AppIntents-only type, so the suite wouldn't compile either). The pure-Foundation AEGISIntentRoute / AEGISIntentRouter and their tests now build and run on Linux/Windows — the routing logic stays continuously verifiable without a Mac.

Three added tests:

  • route equality distinguishes payloads (continueContext("a")continueContext("b"); differing mode ≠)
  • AEGISSessionMode raw-value round trip across allCases, plus rejection of an unknown value
  • clear() on a superseded handoff must not drop the current one

One test-isolation fix: router tests mutate the AEGISIntentRouter.shared singleton and previously left it dirty; they now reset via defer.

Reviewer notes

  • No behaviour change on Apple platforms — the guards compile to nothing there.
  • iOS builds still require macOS + Xcode. No Windows toolchain can produce an iOS app; off-Apple only the cross-platform core is exercised.
  • swift build on Windows additionally needs MSVC link.exe (VC++ workload, elevated install). Documented in the README and in CLAUDE.md § Verified Failure Modes.
  • Branch cut from origin/main; no unrelated files included.

…ntrol

The package existed only in a transient agent scratch directory
(Documents\Codex\2026-07-28\...\outputs\). That is the same class of location
where the holon-gram compiler was lost permanently when its container was
reclaimed. Untracked agent output is one cleanup away from gone.

Also makes it build off-Apple: AppIntents ships only in Apple SDKs, so the two
AppIntents sources and the test exercising AEGISSessionModeIntentValue are
guarded with #if canImport(AppIntents). The pure-Foundation route model and
router then compile and test on Linux/Windows, keeping the routing logic
verifiable without a Mac. Apple builds are unchanged.

Adds three tests: route equality by payload, AEGISSessionMode raw-value round
trip including rejection of an unknown value, and that clear() on a superseded
handoff does not drop the current one. Router tests reset the shared singleton
via defer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
aegisomega f05304e Commit Preview URL

Branch Preview URL
Jul 29 2026, 07:45 PM

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hook-generator Ready Ready Preview, Comment Jul 29, 2026 7:46pm
hub Ready Ready Preview, Comment Jul 29, 2026 7:46pm
platform-picker Ready Ready Preview, Comment Jul 29, 2026 7:46pm

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Vendor AEGIS Omega App Intents Swift package and make core testable cross-platform

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Add the AEGIS Omega App Intents Swift package to the repo for long-term retention.
• Guard AppIntents-dependent sources/tests with canImport(AppIntents) to keep non-Apple builds
 green.
• Expand XCTest coverage for routing equality, session-mode raw values, and router handoff clearing
 semantics.
Diagram

graph TD
  ext{{"Apple SDK (AppIntents)"}} --> mod["AEGISOmegaAppIntents pkg"] --> router["AEGISIntentRouter"] --> app["App root scene"]
  mod --> route["Route + SessionMode"]
  mod --> tests["XCTest suite"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Split into two targets (Core + AppleAppIntents)
  • ➕ Avoids #if canImport(AppIntents) in source files by isolating Apple-only code
  • ➕ Keeps cross-platform core smaller and more reusable across clients
  • ➕ Makes dependency boundaries explicit in Package.swift
  • ➖ Slightly more package/target plumbing (additional target, exports, and test structure)
  • ➖ May be premature for a small package with only two Apple-only files
2. Use SwiftPM conditional compilation flags / platform-specific target settings
  • ➕ Can keep file contents cleaner by controlling compilation via build settings
  • ➕ Centralizes platform decisions in Package.swift
  • ➖ SwiftPM platform-conditioned settings can become harder to reason about than canImport
  • ➖ Still requires careful test gating for AppIntents-only types
3. Move router/route model into an existing shared client/core module
  • ➕ Reduces the number of small packages and potential duplication across clients
  • ➕ Promotes a single routing/handoff abstraction if multiple entry points exist
  • ➖ Requires finding/creating the right shared module boundary now
  • ➖ Higher risk of cross-cutting dependency changes compared to vendoring this package

Recommendation: The chosen approach (vendoring the package + canImport(AppIntents) guards) is the best fit for preserving work while keeping non-Apple CI/builds functional. If AppIntents surface area grows, consider splitting into Core vs Apple-only targets to remove conditional compilation from source and make dependencies clearer.

Files changed (8) +341 / -3

Enhancement (5) +217 / -0
Package.swiftAdd SwiftPM package definition for AEGISOmegaAppIntents +27/-0

Add SwiftPM package definition for AEGISOmegaAppIntents

• Introduces a new Swift package with iOS 17 / macOS 14 platform constraints, a library product, and a test target for the module.

clients/aegis-omega-app-intents/Package.swift

AEGISAppIntents.swiftAdd Apple-only AppIntent entry points and session-mode AppEnum mapping +105/-0

Add Apple-only AppIntent entry points and session-mode AppEnum mapping

• Defines AppIntent conformances that accept system input and forward routes into AEGISIntentRouter.shared. Wraps the entire file in '#if canImport(AppIntents)' to avoid non-Apple build failures.

clients/aegis-omega-app-intents/Sources/AEGISOmegaAppIntents/AEGISAppIntents.swift

AEGISAppShortcuts.swiftAdd Apple-only AppShortcutsProvider phrases for intents +39/-0

Add Apple-only AppShortcutsProvider phrases for intents

• Defines shortcut phrases and metadata for Continue/Start/Inspect intents. Entire file is guarded with '#if canImport(AppIntents)' for cross-platform compilation.

clients/aegis-omega-app-intents/Sources/AEGISOmegaAppIntents/AEGISAppShortcuts.swift

AEGISIntentRoute.swiftIntroduce cross-platform intent route model and session-mode enum +14/-0

Introduce cross-platform intent route model and session-mode enum

• Adds a pure-Foundation 'AEGISIntentRoute' model and 'AEGISSessionMode' enum designed to be shared across Apple and non-Apple builds.

clients/aegis-omega-app-intents/Sources/AEGISOmegaAppIntents/AEGISIntentRoute.swift

AEGISIntentRouter.swiftAdd observable main-actor router singleton for pending handoffs +32/-0

Add observable main-actor router singleton for pending handoffs

• Implements 'AEGISIntentRouter.shared' with a 'pendingHandoff' and safe 'accept'/'clear' semantics based on handoff identity to avoid clearing superseded routes.

clients/aegis-omega-app-intents/Sources/AEGISOmegaAppIntents/AEGISIntentRouter.swift

Tests (1) +70 / -0
AEGISIntentRouteTests.swiftAdd unit tests for routing equality, session-mode raw values, and router handoff lifecycle +70/-0

Add unit tests for routing equality, session-mode raw values, and router handoff lifecycle

• Adds cross-platform tests validating route equality and 'AEGISSessionMode' raw-value round trips, plus main-actor tests for router replacement/clearing behavior. AppIntents-specific test coverage is gated behind '#if canImport(AppIntents)' and router singleton state is reset via 'defer' for isolation.

clients/aegis-omega-app-intents/Tests/AEGISOmegaAppIntentsTests/AEGISIntentRouteTests.swift

Documentation (1) +51 / -0
README.mdDocument package purpose, layout, cross-platform build guard, and prerequisites +51/-0

Document package purpose, layout, cross-platform build guard, and prerequisites

• Adds rationale for bringing the package under version control, explains which files are cross-platform vs Apple-only, and documents build/test commands including Windows linker prerequisites and iOS/macOS requirements.

clients/aegis-omega-app-intents/README.md

Other (1) +3 / -3
.claude.jsonRefresh cognitive-state manifest anchors +3/-3

Refresh cognitive-state manifest anchors

• Updates the manifest provenance to point at the current branch/source ref and updates the computed state hash accordingly.

.claude.json

@qodo-code-review

qodo-code-review Bot commented Jul 29, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 11 rules

Grey Divider


Remediation recommended

1. Mutable handoff bypasses router ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
AEGISIntentRouter exposes pendingHandoff as a publicly writable property, so any consumer can
drop/replace the current handoff without going through accept(_:) / clear(_:), bypassing the
identity guard in clear(_:). This makes handoff-loss bugs easier to introduce and harder to reason
about because the router’s intended invariants are not enforced by its public API.
Code

clients/aegis-omega-app-intents/Sources/AEGISOmegaAppIntents/AEGISIntentRouter.swift[20]

+    public var pendingHandoff: Handoff?
Relevance

●● Moderate

API-encapsulation change; likely valued, but could break intended public usage/tests. No close
precedent found.

PR-#188
PR-#179

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The router currently allows external code to directly assign pendingHandoff, while clear(_:)
contains logic intended to prevent clearing the wrong handoff via id matching; direct assignment
bypasses that protection. The tests’ defer { router.pendingHandoff = nil } also demonstrates that
the public setter is being used to mutate shared singleton state directly.

clients/aegis-omega-app-intents/Sources/AEGISOmegaAppIntents/AEGISIntentRouter.swift[18-31]
clients/aegis-omega-app-intents/Tests/AEGISOmegaAppIntentsTests/AEGISIntentRouteTests.swift[15-63]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`AEGISIntentRouter.pendingHandoff` is currently `public var`, which allows arbitrary external writes that bypass `accept(_:)` and the id-matching semantics in `clear(_:)`.

### Issue Context
This router is intended as a controlled handoff point (note `clear(_:)` only clears when ids match), but public write access undermines that contract. Tests currently rely on direct mutation to reset shared state.

### Fix Focus Areas
- clients/aegis-omega-app-intents/Sources/AEGISOmegaAppIntents/AEGISIntentRouter.swift[18-31]
- clients/aegis-omega-app-intents/Tests/AEGISOmegaAppIntentsTests/AEGISIntentRouteTests.swift[15-63]

### Proposed fix
- Change to `public private(set) var pendingHandoff: Handoff?`.
- Provide a controlled reset/clear API for cleanup (e.g., `public func clearPendingHandoff()` or an `internal func _resetForTests()` callable via `@testable import`).
- Update tests to call the reset/clear method instead of assigning `pendingHandoff = nil` directly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@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: 2884ed4bb6

ℹ️ 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 (@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 (@codex) address that feedback".

…iscovery

Three findings from review of #242:

- AEGISIntentRouter.pendingHandoff is now public private(set). It was publicly
  writable, which let a caller bypass the id-matching guard in clear(_:) and
  drop a handoff that had already been superseded.
- Adds AEGISOmegaAppIntentsPackage so an app target can declare this package in
  includedPackages. Intents defined in a package are not indexed by Siri,
  Spotlight, or Shortcuts without that registration.
- Test methods are nonisolated and async, with the main-actor hop inside each
  body. SwiftPM derives its test-discovery list from unapplied method
  references, so @mainactor on a method changes that reference's type to
  (Self) -> @mainactor () -> Void. Mixed isolation failed to compile off-Apple
  with a conflicting-'Element' error; uniform type-level isolation compiled but
  then failed to cast at run time, and the runner silently executed 0 tests.

Verified on Windows (Swift 6.3.3, x86_64-unknown-windows-msvc):
swift test -> Executed 4 tests, with 0 failures. The fifth test is inside
#if canImport(AppIntents) and is correctly excluded off-Apple.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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