Skip to content

feat(ask): honor optional knowledge cutoff on Global Ask - #658

Open
seonghobae wants to merge 29 commits into
mainfrom
feat/global-ask-knowledge-cutoff-v219
Open

feat(ask): honor optional knowledge cutoff on Global Ask#658
seonghobae wants to merge 29 commits into
mainfrom
feat/global-ask-knowledge-cutoff-v219

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Buyer gap

Issue #271: Global Ask still assembled only the live source_post row. A dated question could receive a current answer with no machine-verifiable statement that the cited body existed by that clock.

Contract (ADR 0216)

POST /api/ask now accepts optional knowledge_cutoff (ISO 8601 / UTC).

  • Omit the field: live-query contract is unchanged (delivery 1.0).
  • Set the field: retrieve only posts whose available time (created_at) is at or before the cutoff, cite the covering source_post_revision, and never substitute the live title or body.
  • Missing historical body is an explicit historical_body_unavailable limitation.
  • Current-only semantic, graph, source-hint, and Event Lineage neighbor facts stay out of an as-of answer (no available-time contract on this path).
  • The answer names fully_cutoff_grounded or partially_cutoff_grounded. A live-only answer is never labeled as-of.
  • Delivery 1.1 versions the cutoff field for browser and future MCP consumers of the same assembler.

Buyer next action

On Ask Agent, leave the cutoff blank to ask against live evidence, or enter a UTC clock. Open a cited post to compare the retained body with the live rewrite.

Tests

Synthetic fixtures only. RED→GREEN coverage in tests/test_global_ask_cutoff.py and the Ask Agent frontend test:

  1. Revised post contributes the cutoff body, not the live body.
  2. Post created after cutoff is excluded.
  3. Current semantic facts do not leak.
  4. Missing historical body never falls back silently.
  5. Two cutoffs produce revision-specific citations.
  6. Unauthorized historical posts remain hidden.
  7. Live queries without a cutoff stay backward compatible.
  8. Delivery versions the cutoff field on 1.1 only.

Does not mix into open stacks #579 / #629 / #631 / #632 / #636 / #639 / #640 / #643 / #644.

Independent APPROVE on this exact head is required. Do not squash-merge without it.


Open in Devin Review

Dated questions retrieve posts available by that clock and cite the
retained source-post revision, never the live rewrite. Omitting the
cutoff keeps the live-query contract (ADR 0216 / #271).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 34 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 212b703c-8ffb-4e9d-885d-8cbe31168c31

📥 Commits

Reviewing files that changed from the base of the PR and between ff7431b and 5f3bc38.

📒 Files selected for processing (17)
  • AGENTS.md
  • ARCHITECTURE.md
  • CHANGELOG.d/2.19.0-global-ask-knowledge-cutoff.md
  • CHANGELOG.md
  • CLAUDE.md
  • backend/app/main.py
  • backend/app/post_chat_ingestion.py
  • backend/app/source_post_revision.py
  • frontend/src/App.test.tsx
  • frontend/src/App.tsx
  • frontend/src/AskAgentCutoff.stories.tsx
  • frontend/src/AskAgentPanel.test.tsx
  • frontend/src/api.ts
  • frontend/src/i18n.ts
  • lineageweave/post_chat.py
  • tests/test_global_ask_sources.py
  • tests/test_source_post_revision.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head review at 12791b1c403165b28dc11d4c7f88d7471319f8a1: targeted cutoff/queue/source-revision tests passed (21 passed in 8.67s). No local failure identified; hosted checks and two independent approvals remain required before protected merge.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Fixed the confirmed review bug at exact head 708e8849: a cutoff query with zero authorized sources no longer claims fully_cutoff_grounded. The cutoff remains explicit, delivery stays contract 1.1, and grounding code/statement are omitted until evidence exists. Added regression coverage; focused cutoff/queue/source-revision suite passes 22 passed, with git diff --check clean.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Follow-up ADR consistency repair at be1d681f: live Global Ask responses now explicitly expose grounding_code=live_only and its non-as-of statement, matching ADR 0216 and the existing frontend type. Cutoff behavior remains unchanged; focused suite remains 22 passed and git diff --check is clean.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Concurrent fixes were respected and my UI repair was rebased without force-push. Current exact head 6138073e converts the local datetime input to UTC before submission, with an explicit local-time label. Frontend App suite passed 96/96, frontend lint passed, backend cutoff/queue/source-revision suite passed 22 passed, and git diff --check is clean.

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 25, 2026 18:56
@seonghobae
seonghobae enabled auto-merge (squash) August 25, 2026 18:56
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head reconciliation at 09d5bd0518f9cdb882f7f1a9890c09fc4a0a4694: the reported post-cutoff lineage/image leak is already fixed by d9ae8141 and retained at this head. Current-only graph expansion and images are gated off when knowledge_cutoff is present, with regression coverage; backend cutoff/queue/source-revision suite passes 23 passed.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Addressed the actionable cutoff review finding at exact head 3e47cf9c: live_after_cutoff now derives from the covering source_post_revision.superseded_at, so unrelated source_post.updated_at touches no longer imply content changed after the cutoff. Added a synthetic regression case. Verification: uv run --extra dev --extra backend pytest -q tests/test_global_ask_cutoff.py tests/test_source_post_revision.py → 20 passed.

Codex added 2 commits August 26, 2026 04:07
…ng-contract

# Conflicts:
#	backend/app/post_chat_ingestion.py
#	backend/app/source_post_revision.py
#	tests/test_global_ask_cutoff.py
devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Revalidated exact head fe830b0a9636b05545cb94c7e30bad2b1f9b1331: cutoff/source-revision focused suite passes (20 passed). The revision-interval live-after boundary and invalid-cutoff validation remain intact; current hosted Checks are pending and independent approval remains required.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Merged current protected-main base and retained both the Global Ask cutoff and semantic-unit changelog entries. New exact head: f007a5edd79025e8aaf0768464730478319f93a6. Hosted checks and independent review remain required.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Addressed the open review thread in backend/app/post_chat_ingestion.py: the revision lookup now carries the raw timezone-aware timestamp (written_at_datetime) and normalizes it directly, avoiding serialize/reparse round-trips. Concurrent branch work was merged without force-push. New exact head: f497a6e854fd5f355cd6b48ee1c75f44a183fd72. Focused cutoff/revision tests: 20 passed.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Confirmed the live_after contract is intentionally revision-based, not updated_at-based: migration 0024 installs source_post_revision_write on every title/body insert or rewrite, while metadata-only updates do not create a revision. The existing cutoff tests cover metadata-only touches and retained body revisions, so no code change is required.

# Conflicts:
#	backend/app/global_ask_queue.py
#	backend/app/main.py
#	backend/app/post_chat_ingestion.py
#	backend/app/source_post_revision.py
#	docs/adr/0216-global-ask-knowledge-cutoff.md
#	frontend/src/App.tsx
#	frontend/src/api.ts
#	frontend/src/i18n.ts
#	lineageweave/post_chat.py
#	tests/test_global_ask_cutoff.py
#	tests/test_global_ask_queue.py
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 08:56
@seonghobae

Copy link
Copy Markdown
Contributor Author

The failed exact-head Strix artifact contains no vulnerability report: NVIDIA attempts ended in HTTP 429/410, and the final OpenAI fallback rejected Strix function tools with reasoning_effort on Chat Completions. This is provider/workflow infrastructure evidence, not a product-code finding. The failed job has been re-run fail-closed; the owning central workflow is being audited separately rather than changing this PR or suppressing the gate.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread backend/app/post_chat_ingestion.py
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