Skip to content

[Bugfix:Autograding] Fix Python input echo and newline#12626

Closed
tijaruS wants to merge 2 commits into
Submitty:mainfrom
tijaruS:fix/echo_keyboard_input_to_output
Closed

[Bugfix:Autograding] Fix Python input echo and newline#12626
tijaruS wants to merge 2 commits into
Submitty:mainfrom
tijaruS:fix/echo_keyboard_input_to_output

Conversation

@tijaruS

@tijaruS tijaruS commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Why is this change important & necessary?

Fixes #7583

This PR fixes two major discrepancies between local Python execution and Submitty's autograding environment:

  1. Missing echo: When using dispatcher_actions (interactive input), student output logs previously omitted the user's typed input because STDIN was redirected from a pipe.
  2. Extra newline bug: Input lines containing Windows-style carriage returns (\r) were not being normalized, leading to unexpected character counts and logic errors in student code.

What is the new behavior?

  • Manual input echo: The C++ supervisor (execute.cpp) now identifies the student's output file and manually appends an echo of every input line sent via the dispatcher. This ensures the STDOUT log matches what a student would see in a real terminal.
  • Input normalization: The cin_reader thread now surgically strips trailing \r characters from input lines, ensuring cross-platform compatibility for instructor-provided input files.
  • Improved robustness: Added a get_std_outfile helper to accurately locate the redirection target from the command string.

How to reproduce or test

  1. Create a Python gradeable using dispatcher_actions to provide interactive input.
  2. Include a prompt like s = input("Enter name: ") and a length check len(s).
  3. Submit a solution and verify that:
    • The input text appears on the same line as the prompt in the "Student Program Output".
    • The length of the received string does not include hidden carriage returns.

Screenshots

Before

260320_16h13m38s_screenshot

After

260321_17h25m42s_screenshot

Other information

  • Breaking change? No
  • Migrations? No.

@Eli-J-Schwartz Eli-J-Schwartz self-assigned this Mar 24, 2026
@codecov

codecov Bot commented Mar 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.66%. Comparing base (a853d1b) to head (47834a2).
⚠️ Report is 55 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #12626   +/-   ##
=========================================
  Coverage     21.66%   21.66%           
  Complexity     9637     9637           
=========================================
  Files           268      268           
  Lines         36222    36222           
  Branches        487      487           
=========================================
  Hits           7847     7847           
  Misses        27892    27892           
  Partials        483      483           
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.68% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tijaruS tijaruS changed the title [Bugfix:Autograding] Fix Python input echo and newline normalization [Bugfix:Autograding] Fix Python input echo and newline Mar 24, 2026

@Eli-J-Schwartz Eli-J-Schwartz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @tijaruS,
I tested, the changes, and the dispatched input now shows up in the student view, just as intended.
Image

However, the original issue mentioned the usage of piped input, such as python3 submission.py < input.txt. Since this doesn't involve the dispatcher, it isn't covered by this fix, still wouldn't appear correctly. Do you have any thoughts as to how to add this info to the student view as well.

I also expect many of the autograder tests to fail, since there is now additional text in the output that wasn't there before; the tests should be updated for this new behavior. Also, make sure the description part of the title is 40 characters or less.

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Mar 24, 2026
@github-actions github-actions Bot added the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label Apr 8, 2026
@Eli-J-Schwartz

Copy link
Copy Markdown
Contributor

Since I have not heard from the PR author in over 2 weeks, and the functionality is incomplete, I am closing this PR as abandoned.

@github-project-automation github-project-automation Bot moved this from Work in Progress to Done in Submitty Development Apr 10, 2026
@tijaruS

tijaruS commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

Hi! I am working on this. Can this be reopened?

@Eli-J-Schwartz

Copy link
Copy Markdown
Contributor

Of course, my apologies! Let me know when you make further progress.

@tijaruS

tijaruS commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

Sure, thank you for opening.

@bmcutler

Copy link
Copy Markdown
Member

closed due to inactivity

@bmcutler bmcutler closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Echo Keyboard Input to Output for Autograding Display

3 participants