Skip to content

fix: make startup and cross-layer retrieval answer-ready - #566

Merged
mohanagy merged 11 commits into
mainfrom
agent/openstatus-activation
Jul 17, 2026
Merged

mohanagy merged 11 commits into
mainfrom
agent/openstatus-activation

Conversation

@mohanagy

@mohanagy mohanagy commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • reuse a validated unchanged graph during automatic-refresh startup instead of forcing a rebuild
  • queue the first graph-backed MCP request through bounded reconciliation while keeping MCP control and discovery calls responsive
  • align watcher discovery exclusions with indexing so ignored source paths do not create false additions
  • recover multi-stage questions by explicit query obligations and preserve cross-layer workflow owners
  • compact strict context-pack responses without dropping confidence, first-read, or cache contract fields
  • add a synthetic cross-layer regression and a share-safe packed OpenStatus implementation-acceptance receipt

Addresses #564.
Addresses #565.

Verification

  • all 204 test files accounted for in bounded forked batches: 2,729 passed, 1 skipped
  • npm run typecheck --silent
  • npm run build --silent
  • npm run release:verify
  • npm run registry:validate
  • npm run verify:pack-parity
  • git diff --check

The monolithic Vitest run exhausted fork startup handshakes on this workstation. Every file that failed to start was rerun in its own process and passed; there were no remaining assertion failures.

Packed OpenStatus acceptance

Tested from a clean detached OpenStatus worktree using a fresh install of the local @lubab/madar@0.31.3 tarball (sha256:ea71918c1e74fd7b73609f3054d2f90619f117d9d41bbb57cc167bfca525a645):

  • MCP initialization: 586 ms
  • first and only context_pack response: 3,893 ms
  • graph rebuilt: no
  • serialized response: 1,666 / 1,800 tokens
  • selected evidence: 8 symbols across 7 relevant unique files; 0 unrelated UI files
  • confidence: high / strong / complete / ready (score 0.89)
  • directive: answer_from_pack
  • broad-search fallback: not_needed

Acceptance boundary

This PR provides implementation acceptance, not a new public performance claim. Three consecutive Claude trials, three consecutive Codex trials, and human semantic comparison against the direct-search answer remain pending. Keep #565 open until those gates pass.

Summary by CodeRabbit

  • New Features

    • Improved cross-layer retrieval preserves workflow anchors and reports query-obligation coverage.
    • Added focused evidence snippets and clearer provenance in context packs.
    • Strict MCP mode now exposes only context_pack and context_expand, with one-time verification controls.
    • Codex installs now use workspace-scoped configuration with startup and tool-call timeouts.
  • Bug Fixes

    • Unchanged, valid graphs can be reused without unnecessary rebuilds.
    • Graph-backed requests wait briefly during refresh while discovery remains responsive.
    • Evidence confidence is reduced when required question obligations are missing.
  • Documentation

    • Updated installation, compatibility, security, troubleshooting, and benchmark guidance.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 29abd7f4-00b9-461c-bf3b-e52791f89055

📥 Commits

Reviewing files that changed from the base of the PR and between 41fe1bb and b69f338.

📒 Files selected for processing (1)
  • tests/unit/retrieve.test.ts
📝 Walkthrough

Walkthrough

This PR adds obligation-aware cross-layer retrieval, evidence-aware context-pack compaction, strict MCP context-pack controls, workspace-scoped Codex configuration, graph startup reuse, bounded readiness waits, and expanded regression and acceptance coverage.

Changes

Retrieval and evidence

Layer / File(s) Summary
Obligation-aware retrieval and evidence
src/runtime/retrieve/*, src/runtime/retrieve.ts, src/runtime/context-pack.ts, src/runtime/mcp-response-evidence.ts
Questions are split into bounded obligations; anchors, communities, snippets, coverage, claims, and fallback plans now preserve and report obligation coverage across cross-layer workflows.
Answer-ready pack shaping
src/infrastructure/context-pack-command.ts, src/contracts/context-pack.ts, src/contracts/retrieval-plan.ts
Serialized packs select claim anchors and obligation evidence before culling, compact snippets and metadata under deterministic budgets, and reconcile evidence state after serialization.
Retrieval validation
tests/fixtures/*, tests/unit/retrieve*, tests/unit/context-pack*
Fixtures and tests cover cross-runtime retrieval, evidence snippets, provenance claims, obligation recovery, compaction, and claim-anchor preservation.

Strict MCP and native-agent contracts

Layer / File(s) Summary
Strict MCP tool surface
src/runtime/stdio/definitions.ts, src/runtime/stdio/server.ts, src/runtime/stdio/tools.ts
Strict mode exposes only context_pack and context_expand, validates their arguments, authorizes one verification handle, and limits expansion to a single terminal attempt.
Installed strict guidance
src/infrastructure/install.ts, src/infrastructure/install-skill-templates.ts, docs/reference/*, docs/security/*
Generated guidance requires one verbatim context-pack request, terminal handling for ready results, and bounded verification behavior.
Trace contract validation
src/infrastructure/compare.ts, tests/unit/compare-native-agent.test.ts
Native-agent traces retain tool arguments and events, and strict validation checks exact invocation, prompt equality, exploration timing, terminal behavior, and measurement gaps.

Startup and Codex integration

Layer / File(s) Summary
Graph reuse and readiness
src/infrastructure/watch.ts, src/runtime/freshness.ts, src/runtime/stdio-server.ts
Startup can reuse a fresh unchanged graph, managed instruction files and ignored paths are excluded from freshness inputs, and graph-backed requests wait within a bounded reconciliation window while control calls remain responsive.
Workspace-scoped Codex MCP configuration
src/infrastructure/install.ts, src/infrastructure/doctor.ts, tests/unit/install.test.ts, tests/unit/doctor.test.ts
Codex MCP blocks are managed in the loaded user configuration with workspace-scoped names, locking, atomic updates, timeout settings, conflict detection, and legacy project-local migration handling.
Startup and integration coverage
tests/unit/watch.test.ts, tests/unit/background-auto-refresh.test.ts, tests/unit/stdio-server.test.ts, tests/setup.ts, vitest.config.ts
Tests cover graph reuse, freshness exceptions, bounded waits, responsive discovery, lease contention, and hermetic Codex configuration paths.

Documentation and acceptance artifacts

Layer / File(s) Summary
Documentation and benchmark receipt
CHANGELOG.md, README.md, docs/auto-refresh.md, docs/benchmarks/*, docs/integrations/*, docs/release.md, docs/tutorials/*
Documentation describes obligation-based retrieval, startup reconciliation, strict MCP behavior, workspace-scoped Codex configuration, and the recorded OpenStatus acceptance run.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related issues

Possibly related PRs

  • mohanagy/madar#560 — Modifies the same stdio auto-refresh readiness and graph-not-ready handling paths.
  • mohanagy/madar#543 — Modifies the same Codex installer, doctor, and MCP configuration wiring.
  • mohanagy/madar#557 — Shares the retrieval, evidence, context-pack, strict-mode, and auto-refresh code paths.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.81% 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
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.
Title check ✅ Passed The title is concise and matches the main startup and cross-layer retrieval changes.
Description check ✅ Passed The description covers summary, verification, and related issues; the checklist section is the main missing template piece.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/openstatus-activation

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

@mohanagy

Copy link
Copy Markdown
Owner Author

Pushed feef714.

This PR now includes the activation fixes found in the live OpenStatus trial:

  • Codex registration is written to the loaded user config with an isolated workspace CWD, stable per-workspace name, 180-second startup budget, and 60-second tool-call budget; install/doctor/migration/uninstall are covered.
  • Root managed AGENTS.md / CLAUDE.md guidance no longer makes an otherwise valid graph look stale or forces an avoidable startup reconciliation before the first MCP answer.
  • The strict cross-layer context path has the associated retrieval, evidence, and bounded-recovery improvements.

Verification completed:

  • npm run typecheck
  • npm run build
  • focused installer/doctor/watch/freshness suites: 134 passing
  • focused compare suite: 107 passing
  • npm run pack:dry-run
  • live OpenStatus direct stdio probe: initialization about 0.5 s; complete strict context_pack about 4.5 s after the startup repair

The final automated Codex-CLI receipt remains blocked by a host issue in Codex CLI 0.144.5: it performs MCP initialize and tools/list, then cancels a tool call before it sends tools/call to the server. The same behavior occurs against a minimal temporary MCP server, so it is not a Madar startup, payload, schema, hook, or timeout failure. Full evidence is recorded on #567.

@mohanagy
mohanagy marked this pull request as ready for review July 17, 2026 22:22
@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 16

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/runtime/retrieve.ts (1)

6481-6523: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Retain every node supporting an emitted claim.

Only claim.node_labels[0] is pinned. Other referenced nodes may be culled, their relationships filtered out, and the unsupported claim still emitted. Pin all claim labels atomically; if they cannot fit, omit that claim or adjust the cap.

🤖 Prompt for 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.

In `@src/runtime/retrieve.ts` around lines 6481 - 6523, Update the claim/node
selection logic around claims, pinnedNodes, and matchedNodeCap so every emitted
claim retains all nodes referenced by claim.node_labels, not only the first
label. Treat each claim’s referenced nodes atomically: if all cannot fit within
the node cap, omit that claim (and avoid emitting it in claims) or otherwise
adjust selection so no emitted claim is unsupported, while preserving
relationship filtering for retained nodes.
🟡 Minor comments (7)
docs/integrations/compatibility.md-18-18 (1)

18-18: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the configured Codex home consistently.

These summaries hardcode ~/.codex/config.toml, while the installer supports $CODEX_HOME/config.toml. Document the environment-variable path with the default fallback at every verification surface.

  • docs/integrations/compatibility.md#L18-L18: update the Codex generated-files/config column.
  • docs/reference/cli-and-mcp.md#L17-L17: update the agent-install matrix.
  • docs/release.md#L49-L49: resolve the configured path during the smoke check.
🤖 Prompt for 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.

In `@docs/integrations/compatibility.md` at line 18, Update the Codex config
references to consistently resolve $CODEX_HOME/config.toml, falling back to
~/.codex/config.toml when unset. Apply this to the generated-files/config column
in docs/integrations/compatibility.md:18-18 and the agent-install matrix in
docs/reference/cli-and-mcp.md:17-17; update the smoke check in
docs/release.md:49-49 to resolve the same configured path before validation.
CHANGELOG.md-13-13 (1)

13-13: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Align the readiness contract across release documentation.

The documents currently describe both “wait and complete the same request” and “return a retryable response while reconciling.” Define the bounded-wait timeout behavior once and use it consistently.

  • CHANGELOG.md#L13-L13: state whether retry occurs only after the bounded wait expires.
  • README.md#L76-L76: align the startup/readiness wording with that contract.
🤖 Prompt for 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.

In `@CHANGELOG.md` at line 13, Align the readiness contract in CHANGELOG.md line
13 and README.md line 76: document that graph-backed requests wait during the
bounded transient reconciliation window and return the same request once ready,
with a retryable response occurring only if that wait expires. Update both
documents’ startup/readiness wording consistently without changing the described
rebuild or fail-closed behavior.
docs/auto-refresh.md-39-40 (1)

39-40: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Align the 25-second guarantee with queue behavior.

Later queued requests can currently wait multiple 25-second windows before receiving a response. Keep this wording only after enforcing the deadline from request arrival.

🤖 Prompt for 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.

In `@docs/auto-refresh.md` around lines 39 - 40, Update the auto-refresh request
queue and readiness-wait handling so the 25-second timeout is measured from each
request’s arrival time, not restarted when a queued request begins processing.
Ensure queued requests exceeding that deadline return the documented
madar_graph_not_ready response with the existing retry metadata, then retain
this documentation wording.
tests/unit/retrieve-cross-layer-flow.test.ts-3-3 (1)

3-3: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Move the wall-clock SLA out of the unit test.

The 750 ms assertion depends on runner load and can fail without a behavior regression. Measure latency in a benchmark suite instead.

Proposed fix
-import { performance } from 'node:perf_hooks'
...
-    const started = performance.now()
     const result = retrieveContext(buildCrossLayerMonitorFlowFixture(), {
...
-    const elapsedMs = performance.now() - started
...
-    expect(elapsedMs).toBeLessThan(750)

Also applies to: 35-35, 41-41, 85-85

🤖 Prompt for 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.

In `@tests/unit/retrieve-cross-layer-flow.test.ts` at line 3, Remove the
performance-based timing measurement and 750 ms SLA assertion from the unit
test, including the node:perf_hooks import and related references in the
cross-layer flow test. Keep the functional assertions intact, and move latency
measurement to the project’s benchmark suite if one exists.
tests/unit/retrieval-gate.test.ts-323-323 (1)

323-323: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the execution-owner branch specifically.

The regex accepts any “behavior slice” reason, so runtime-generation classification would also pass.

Proposed fix
-    expect(decision.reason).toMatch(/runtime flow|behavior slice/i)
+    expect(decision.reason).toBe('runtime flow question — behavior slice retrieval')
🤖 Prompt for 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.

In `@tests/unit/retrieval-gate.test.ts` at line 323, Strengthen the assertion for
decision.reason in the execution-owner branch test so it matches the specific
expected execution-owner reason rather than the broad “runtime flow|behavior
slice” alternatives. Keep the assertion case-insensitive while ensuring
runtime-generation classifications cannot satisfy it.
tests/unit/install.test.ts-1250-1250 (1)

1250-1250: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Scope shared Codex-config assertions to the workspace under test.

The user-level config can contain unrelated managed blocks, so file existence, any strict profile string, or any madar_<suffix> section can produce false positives.

  • tests/unit/install.test.ts#L1250-L1250: validate the canonical block for projectDir.
  • tests/unit/install-compatibility.test.ts#L450-L451: replace the existence-only check with workspace-specific content validation.
  • tests/unit/install.test.ts#L1941-L1941: retain the content for workspace-specific validation.
  • tests/unit/install.test.ts#L1950-L1954: replace the generic server regex with isMadarCodexMcpConfig(firstCodexConfig, projectDir).
🤖 Prompt for 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.

In `@tests/unit/install.test.ts` at line 1250, Scope all Codex configuration
assertions to the tested workspace: in tests/unit/install.test.ts lines 1250 and
1941, validate the canonical projectDir-specific block and retain content needed
for that validation; in tests/unit/install-compatibility.test.ts lines 450-451,
replace the existence-only assertion with workspace-specific content validation;
and in tests/unit/install.test.ts lines 1950-1954, replace the generic server
regex with isMadarCodexMcpConfig(firstCodexConfig, projectDir).
tests/setup.ts-1-11 (1)

1-11: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Reset the Codex home between test files.

tests/setup.ts reuses one PID-scoped CODEX_HOME, so any config.toml written by a suite can bleed into the next file or a watch rerun. Remove the directory before recreating it.

Proposed fix
-import { mkdirSync } from 'node:fs'
+import { mkdirSync, rmSync } from 'node:fs'
...
 const testCodexHome = join(tmpdir(), `madar-vitest-codex-home-${process.pid}`)
+rmSync(testCodexHome, { recursive: true, force: true })
 mkdirSync(testCodexHome, { recursive: true })
🤖 Prompt for 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.

In `@tests/setup.ts` around lines 1 - 11, Update the test setup around
testCodexHome to remove the existing PID-scoped directory before recreating it,
then continue setting process.env.CODEX_HOME to that freshly initialized path.
Preserve recursive directory creation so setup remains safe when the path does
not exist.
🧹 Nitpick comments (1)
tests/unit/stdio-tool-profile.test.ts (1)

586-672: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Exercise authorization through the real context_pack request path.

This test calls the transformer directly and then manually seeds the same handle into session state. It cannot catch a regression where context_pack advertises a handle but fails to register it. Extract the handle from an actual pack response and expand it using that same session.

🤖 Prompt for 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.

In `@tests/unit/stdio-tool-profile.test.ts` around lines 586 - 672, The test
should exercise authorization through the real context_pack request path instead
of calling constrainStrictContextPackPayload and manually seeding
contextPackHandles. Within the existing strict session, invoke context_pack,
extract the advertised strict-verify-target handle from the response, then use
that handle for context_expand and the repeated unauthorized expansion
assertion; retain the checks that the response advertises the expected evidence
class and focus file.
🤖 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 `@docs/benchmarks/2026-07-17-openstatus-activation/receipt.share-safe.json`:
- Around line 67-70: Regenerate the benchmark receipt from the canonical source
mappings rather than editing JSON manually: map triggerNotifications() to
apps/workflows/src/checker/utils.ts, computeEffectiveStatus() to
packages/api/src/router/external-service/effective-status.ts, and the incident
schema to packages/db/src/schema/incidents.ts. Then update
docs/benchmarks/2026-07-17-openstatus-activation/README.md lines 18-21 to
republish the 7/7 precision result only after the corrected receipt is
generated.

In `@src/infrastructure/compare.ts`:
- Around line 2810-2819: Update the strict profile guidance around the
context_pack instructions so a ready or ready_with_caveat pack is terminal only
for read-only tasks. For strict implementation tasks, explicitly permit the
required native repository edits and validation commands after context_pack
while continuing to forbid additional MCP calls. Apply the same policy
consistently at the related strict guidance occurrences.
- Around line 5112-5115: Update the prompt comparison logic around
traceContextPackPrompts so a null or otherwise unavailable traced prompt is
classified as not_measured rather than adding the byte-mismatch evidence. Only
emit the existing strict context_pack mismatch evidence when an actual traced
prompt is available and differs from report.question.

In `@src/infrastructure/context-pack-command.ts`:
- Around line 1808-1814: Update the reconciliation logic using existingTargets
so it reuses only verification targets relevant to the lost obligations, rather
than treating any existing target as sufficient. Ensure canVerify and the
resulting answerability state remain monotonic: preserve prior low,
insufficient, and explore_with_caution restrictions and never upgrade them to
medium or broaden verification requirements during reconciliation.

In `@src/infrastructure/install-skill-templates.ts`:
- Around line 328-337: Update the generated Codex strict profile instructions
near the existing Madar routing guidance to remove references to unavailable
tools such as retrieve and relevant_files. Replace that guidance with a strict
routing table limited to the installed context_pack and context_expand tools,
preserving the existing answerability rules and terminal behavior.

In `@src/infrastructure/install.ts`:
- Around line 2289-2330: Serialize Codex config mutations in
installCodexMcpServer and the corresponding uninstall flow by acquiring a lock
for configPath before reading, re-reading the file while locked, and performing
the complete managed-block update within that critical section. Replace direct
writeFileSync updates with an atomic temporary-file replacement that preserves
the existing config permissions, and ensure the lock and temporary resources are
cleaned up on success or failure.

In `@src/runtime/context-pack-recovery.ts`:
- Around line 195-203: Update the recovery gating logic around
conceptualObligationsCovered and recoveryAllowed so a recovered plan does not
disable evidence recovery solely when all conceptual obligations are covered.
Keep the existing answerability/readiness check authoritative, or limit
suppression to duplicate conceptual targets while still allowing missing
relationship and verification evidence recovery.

In `@src/runtime/context-pack.ts`:
- Around line 390-417: Update buildInputProvenanceClaims in
src/runtime/context-pack.ts (lines 390-417) so source_file-scoped snippets do
not attribute router-output consumption to node.label; emit file-level
provenance or require symbol-scoped evidence. Update the serialization logic in
src/infrastructure/context-pack-command.ts (lines 745-752) to preserve
snippet_line_number and snippet_scope, without substituting line_number as the
citation anchor.

In `@src/runtime/retrieve.ts`:
- Around line 4527-4530: Update the Gin inference expression near explicitGin so
the bare “go” token cannot activate Gin-specific filtering or boosts; retain
explicitGin and require an explicit “gin”, “golang”, or an unambiguous
Go-framework phrase before setting gin.

In `@src/runtime/retrieve/conceptual-fallback.ts`:
- Line 121: Update QUERY_EVIDENCE_DELIVERY_OPERATION_PATTERN to include notify*
and trigger* alongside the existing delivery verbs, covering both bare function
calls and member-method calls so normalized `@delivery` operations such as
notifyIncident and triggerIncident satisfy delivery evidence.
- Around line 777-785: Update runtimeScopeForSource so its repository-scope
match in runtimeScopeForSource recognizes paths beginning with apps/ or
packages/ as well as paths containing those segments after a slash. Preserve the
existing lowercase scope format and fallback behavior for paths that do not
match.
- Around line 1597-1617: Update the recovery telemetry around basePlan and
obligationRecoveryNeeded to use the total prompt-obligation count, including
obligations without anchors, rather than diversified.preferredByObligation.size.
Preserve the existing covered-count calculation, but ensure
query_obligations.total and the missing_query_obligations decision reflect every
prompt obligation.

In `@src/runtime/stdio-server.ts`:
- Around line 1231-1244: Bound each auto-refresh request’s readiness wait from
arrival time rather than dequeue time. In src/runtime/stdio-server.ts lines
1231-1244, capture and queue an arrival deadline for each request; in the
polling logic around lines 1154-1179, use only the remaining budget and report
queue time in waited_ms. Update docs/auto-refresh.md lines 39-40 only if needed
to retain the 25-second guarantee once enforced end-to-end.

In `@src/runtime/stdio/definitions.ts`:
- Around line 243-254: Update the shared context-pack tool definitions returned
by activeMcpTools('full') so their descriptions remain full-capable and do not
require prompt/task-only usage or forbid retrieve expansions. Move strict-only
wording and field restrictions into strictToolSchema(), including the related
definition at the additional location, while preserving the advertised budget,
freshness, delta-session, and verbose options in full mode.

In `@src/runtime/stdio/tools.ts`:
- Around line 903-946: Update the authorization construction around the returned
target so authorization.entry is a bounded clone using the same focus_files and
focus_ranges lists exposed by target, each limited to five items. Preserve the
existing entry metadata and avoid retaining the original unbounded follow_up
arrays, ensuring context_expand cannot access scope outside the listed
verification target.

In `@src/shared/discovery-safety.ts`:
- Line 127: Update ENVIRONMENT_CONFIG_INTENT_PATTERN to recognize
credential-related questions, including terms such as credential(s), cloud
credentials, and authentication keys, while preserving the existing .env,
configuration, deployment, environment, runtime-variable, secret, and settings
matches. Ensure the expanded pattern drives the same environment-file exclusion
and confidence handling used by existing matches.

---

Outside diff comments:
In `@src/runtime/retrieve.ts`:
- Around line 6481-6523: Update the claim/node selection logic around claims,
pinnedNodes, and matchedNodeCap so every emitted claim retains all nodes
referenced by claim.node_labels, not only the first label. Treat each claim’s
referenced nodes atomically: if all cannot fit within the node cap, omit that
claim (and avoid emitting it in claims) or otherwise adjust selection so no
emitted claim is unsupported, while preserving relationship filtering for
retained nodes.

---

Minor comments:
In `@CHANGELOG.md`:
- Line 13: Align the readiness contract in CHANGELOG.md line 13 and README.md
line 76: document that graph-backed requests wait during the bounded transient
reconciliation window and return the same request once ready, with a retryable
response occurring only if that wait expires. Update both documents’
startup/readiness wording consistently without changing the described rebuild or
fail-closed behavior.

In `@docs/auto-refresh.md`:
- Around line 39-40: Update the auto-refresh request queue and readiness-wait
handling so the 25-second timeout is measured from each request’s arrival time,
not restarted when a queued request begins processing. Ensure queued requests
exceeding that deadline return the documented madar_graph_not_ready response
with the existing retry metadata, then retain this documentation wording.

In `@docs/integrations/compatibility.md`:
- Line 18: Update the Codex config references to consistently resolve
$CODEX_HOME/config.toml, falling back to ~/.codex/config.toml when unset. Apply
this to the generated-files/config column in
docs/integrations/compatibility.md:18-18 and the agent-install matrix in
docs/reference/cli-and-mcp.md:17-17; update the smoke check in
docs/release.md:49-49 to resolve the same configured path before validation.

In `@tests/setup.ts`:
- Around line 1-11: Update the test setup around testCodexHome to remove the
existing PID-scoped directory before recreating it, then continue setting
process.env.CODEX_HOME to that freshly initialized path. Preserve recursive
directory creation so setup remains safe when the path does not exist.

In `@tests/unit/install.test.ts`:
- Line 1250: Scope all Codex configuration assertions to the tested workspace:
in tests/unit/install.test.ts lines 1250 and 1941, validate the canonical
projectDir-specific block and retain content needed for that validation; in
tests/unit/install-compatibility.test.ts lines 450-451, replace the
existence-only assertion with workspace-specific content validation; and in
tests/unit/install.test.ts lines 1950-1954, replace the generic server regex
with isMadarCodexMcpConfig(firstCodexConfig, projectDir).

In `@tests/unit/retrieval-gate.test.ts`:
- Line 323: Strengthen the assertion for decision.reason in the execution-owner
branch test so it matches the specific expected execution-owner reason rather
than the broad “runtime flow|behavior slice” alternatives. Keep the assertion
case-insensitive while ensuring runtime-generation classifications cannot
satisfy it.

In `@tests/unit/retrieve-cross-layer-flow.test.ts`:
- Line 3: Remove the performance-based timing measurement and 750 ms SLA
assertion from the unit test, including the node:perf_hooks import and related
references in the cross-layer flow test. Keep the functional assertions intact,
and move latency measurement to the project’s benchmark suite if one exists.

---

Nitpick comments:
In `@tests/unit/stdio-tool-profile.test.ts`:
- Around line 586-672: The test should exercise authorization through the real
context_pack request path instead of calling constrainStrictContextPackPayload
and manually seeding contextPackHandles. Within the existing strict session,
invoke context_pack, extract the advertised strict-verify-target handle from the
response, then use that handle for context_expand and the repeated unauthorized
expansion assertion; retain the checks that the response advertises the expected
evidence class and focus file.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a7c75a04-a507-458d-91c7-57daa936578e

📥 Commits

Reviewing files that changed from the base of the PR and between d81f90e and b42a140.

📒 Files selected for processing (59)
  • CHANGELOG.md
  • README.md
  • docs/auto-refresh.md
  • docs/benchmarks/2026-07-17-openstatus-activation/README.md
  • docs/benchmarks/2026-07-17-openstatus-activation/receipt.share-safe.json
  • docs/integrations/compatibility.md
  • docs/reference/cli-and-mcp.md
  • docs/release.md
  • docs/security/mcp-threat-model.md
  • docs/tutorials/agent-quickstarts.md
  • src/contracts/context-pack.ts
  • src/contracts/retrieval-plan.ts
  • src/infrastructure/compare.ts
  • src/infrastructure/context-pack-command.ts
  • src/infrastructure/doctor.ts
  • src/infrastructure/indexing-manifest.ts
  • src/infrastructure/install-skill-templates.ts
  • src/infrastructure/install.ts
  • src/infrastructure/watch.ts
  • src/runtime/context-pack-recovery.ts
  • src/runtime/context-pack.ts
  • src/runtime/freshness.ts
  • src/runtime/mcp-response-evidence.ts
  • src/runtime/retrieval-gate.ts
  • src/runtime/retrieve.ts
  • src/runtime/retrieve/conceptual-fallback.ts
  • src/runtime/retrieve/expansion.ts
  • src/runtime/retrieve/pipeline.ts
  • src/runtime/retrieve/slicing.ts
  • src/runtime/stdio-server.ts
  • src/runtime/stdio/definitions.ts
  • src/runtime/stdio/tools.ts
  • src/shared/discovery-safety.ts
  • tests/fixtures/cross-layer-monitor-flow.ts
  • tests/setup.ts
  • tests/unit/background-auto-refresh.test.ts
  • tests/unit/compare-native-agent.test.ts
  • tests/unit/compare.test.ts
  • tests/unit/context-pack-adapter-gating.test.ts
  • tests/unit/context-pack-command.test.ts
  • tests/unit/context-pack-recovery.test.ts
  • tests/unit/context-pack.test.ts
  • tests/unit/doctor.test.ts
  • tests/unit/freshness-surfaces.test.ts
  • tests/unit/indexing-completeness.test.ts
  • tests/unit/install-compatibility.test.ts
  • tests/unit/install-docs.test.ts
  • tests/unit/install-templates.test.ts
  • tests/unit/install.test.ts
  • tests/unit/mcp-response-evidence.test.ts
  • tests/unit/mcp-schema-budget.test.ts
  • tests/unit/retrieval-gate.test.ts
  • tests/unit/retrieve-conceptual-fallback.test.ts
  • tests/unit/retrieve-cross-layer-flow.test.ts
  • tests/unit/retrieve.test.ts
  • tests/unit/stdio-server.test.ts
  • tests/unit/stdio-tool-profile.test.ts
  • tests/unit/watch.test.ts
  • vitest.config.ts

Comment thread src/infrastructure/compare.ts
Comment thread src/infrastructure/compare.ts
Comment thread src/infrastructure/context-pack-command.ts
Comment thread src/infrastructure/install-skill-templates.ts
Comment thread src/runtime/retrieve/conceptual-fallback.ts Outdated
Comment thread src/runtime/stdio-server.ts
Comment thread src/runtime/stdio/definitions.ts Outdated
Comment thread src/runtime/stdio/tools.ts
Comment thread src/shared/discovery-safety.ts Outdated
@mohanagy
mohanagy force-pushed the agent/openstatus-activation branch from d3a0755 to 41fe1bb Compare July 17, 2026 23:33

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/infrastructure/compare.ts (1)

5131-5159: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply the implementation exception to the later broad-exploration check.

Line 5131 permits required native implementation work, but Lines 5149-5160 still classify any resulting broad exploration as not_measured or violated. Skip that generic check for task === 'implement', while continuing to reject later MCP calls.

Proposed fix
-  if (report.madar_trace.broad_exploration_tool_call_count > 0) {
+  if (
+    report.task !== 'implement'
+    && report.madar_trace.broad_exploration_tool_call_count > 0
+  ) {
🤖 Prompt for 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.

In `@src/infrastructure/compare.ts` around lines 5131 - 5159, Update the later
broad-exploration check guarded by
report.madar_trace.broad_exploration_tool_call_count to bypass its
not_measured/violated classification when report.task === 'implement'. Preserve
the existing generic behavior for other tasks and continue rejecting later MCP
calls through the earlier validation.
🤖 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 `@tests/unit/retrieve.test.ts`:
- Around line 3248-3250: Update the claim-integrity assertions in the
compact-result test so they first verify the expected retained claim count or
claim identity is present, preventing an empty claims array from passing
vacuously. Keep the existing node-label anchor validation for each retained
claim after this assertion.

---

Outside diff comments:
In `@src/infrastructure/compare.ts`:
- Around line 5131-5159: Update the later broad-exploration check guarded by
report.madar_trace.broad_exploration_tool_call_count to bypass its
not_measured/violated classification when report.task === 'implement'. Preserve
the existing generic behavior for other tasks and continue rejecting later MCP
calls through the earlier validation.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 25bf4ca9-91c8-4b0f-8014-3199f562e695

📥 Commits

Reviewing files that changed from the base of the PR and between 8d6edce and 41fe1bb.

📒 Files selected for processing (15)
  • src/infrastructure/compare.ts
  • src/infrastructure/context-pack-command.ts
  • src/infrastructure/install-skill-templates.ts
  • src/infrastructure/install.ts
  • src/runtime/context-pack.ts
  • src/runtime/retrieve.ts
  • src/runtime/retrieve/conceptual-fallback.ts
  • src/runtime/stdio-server.ts
  • src/runtime/stdio/definitions.ts
  • src/runtime/stdio/tools.ts
  • src/shared/discovery-safety.ts
  • tests/unit/install-templates.test.ts
  • tests/unit/install.test.ts
  • tests/unit/retrieve.test.ts
  • tests/unit/stdio-slice-surface.test.ts
💤 Files with no reviewable changes (1)
  • src/infrastructure/install-skill-templates.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • tests/unit/install-templates.test.ts
  • src/shared/discovery-safety.ts
  • src/runtime/stdio/definitions.ts
  • src/runtime/stdio-server.ts
  • src/infrastructure/install.ts
  • src/infrastructure/context-pack-command.ts
  • src/runtime/stdio/tools.ts
  • src/runtime/retrieve.ts
  • src/runtime/retrieve/conceptual-fallback.ts

Comment thread tests/unit/retrieve.test.ts
@mohanagy
mohanagy merged commit e8f7d1d into main Jul 17, 2026
7 checks passed
@mohanagy
mohanagy deleted the agent/openstatus-activation branch July 17, 2026 23:50
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