Skip to content

[codex] Implement async public export jobs#13

Merged
Jia-Ethan merged 1 commit into
mainfrom
codex/scnu-v04-async-export-jobs
Apr 21, 2026
Merged

[codex] Implement async public export jobs#13
Jia-Ethan merged 1 commit into
mainfrom
codex/scnu-v04-async-export-jobs

Conversation

@Jia-Ethan

Copy link
Copy Markdown
Owner

Summary

  • add persisted public export Job API for create, poll, cancel, and retry while keeping the synchronous export endpoint compatible
  • move the public UI export flow from synchronous export to background job polling with progress, cancel, and retry affordances
  • document the new public Job API and add backend/frontend coverage

Validation

  • uv run --extra dev pytest tests -q
  • npm run test:smoke --prefix web
  • npm run build --prefix web
  • uv run python scripts/build_web_public.py
  • npm run test:e2e --prefix web
  • uv run python scripts/export_compliance_fixture.py tmp/fixture-export.docx
  • uv run python scripts/check_docx_compliance.py tmp/fixture-export.docx
  • npx vercel build
  • uv run python -m compileall backend/app
  • npm audit --prefix web --omit=dev

Closes #11

@vercel

vercel Bot commented Apr 21, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
scnu-thesis-portal Ready Ready Preview, Comment Apr 21, 2026 4:46am

@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: 652a0eb6c9

ℹ️ 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 backend/app/public_api.py
"download_url": None,
"report_url": None,
"error_code": None,
"cancel_requested": False,

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 Prevent canceled job retry from reviving prior worker

retry_public_export_job flips cancel_requested back to False immediately, but the original worker thread may still be executing export_docx after a cancel. In that window, retry starts a second thread on the same job_id, and the first thread will now observe no cancellation and continue writing progress/artifacts, creating a race where two workers update the same job/export state unpredictably. Gate retry until the previous attempt is definitively finished, or version attempts so stale workers cannot resume after a retry.

Useful? React with 👍 / 👎.

Comment on lines +202 to +205
if (!jobId) {
setExporting(false);
setInlineError({ message: "导出已取消,可重新导出。", code: "EXPORT_CANCELED" });
return;

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 Cancel server job even when job ID is not yet available

When users cancel while createPublicExportJob is still in flight, this branch returns early without calling the backend cancel endpoint. After the create request resolves, the client stops polling due cancelRequestedRef, but the server job keeps running to completion and retains export files, so cancellation is only local/UI-visible. Queue a deferred cancel and issue /cancel as soon as job_id arrives to preserve true cancellation semantics.

Useful? React with 👍 / 👎.

@Jia-Ethan Jia-Ethan merged commit d8ce8f6 into main Apr 21, 2026
3 checks passed
@Jia-Ethan Jia-Ethan deleted the codex/scnu-v04-async-export-jobs branch April 27, 2026 01:08
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.

v0.4.0: Async Thesis Export Job System

1 participant